문제

I have downloaded LLVM 3.1 and build it successfully. My requirement is to add some few debugging lines in a C++ source code files. I have coded module using CLANG 3.1. But CLANG reports a lot of AST error which gcc does not. Note my code compiles fine with gcc compiler. Further my C++ program has a lot of #include statements. LLVM expects the same to be available in a path and fails at different level again.

도움이 되었습니까?

해결책

Clang has a new library named libTooling to ease writing source-to-source tools with clang. I suggest you check it out. The most complete example of using it is clang-format, which reformats arbitrary C++ code according to a set of formatting guidelines. It demonstrates how to rewrite C++ code at the source-level while preserving all the semantics. It shouldn't be hard to hack it to add insertion of certain statements at certain places.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top