diff --git a/Example.cpp b/Example.cpp index de10c6b..6beb910 100644 --- a/Example.cpp +++ b/Example.cpp @@ -104,21 +104,21 @@ class ExampleASTConsumer : public ASTConsumer { class ExampleFrontendAction : public ASTFrontendAction { public: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, StringRef file) { - return new ExampleASTConsumer(&CI); // pass CI pointer to ASTConsumer + virtual std::unique_ptr CreateASTConsumer(CompilerInstance &CI, StringRef file) { + return std::unique_ptr(new ExampleASTConsumer(&CI)); // pass CI pointer to ASTConsumer } }; - int main(int argc, const char **argv) { // parse the command-line args passed to your code - CommonOptionsParser op(argc, argv); + static cl::OptionCategory MyToolCategory("My tool options"); + CommonOptionsParser op(argc, argv, MyToolCategory); // create a new Clang Tool instance (a LibTooling environment) ClangTool Tool(op.getCompilations(), op.getSourcePathList()); // run the Clang Tool, creating a new FrontendAction (explained below) - int result = Tool.run(newFrontendActionFactory()); + int result = Tool.run(newFrontendActionFactory().get()); errs() << "\nFound " << numFunctions << " functions.\n\n"; // print out the rewritten source code ("rewriter" is a global var.) diff --git a/Makefile b/Makefile index f7c7cc2..1624a5e 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option USEDLIBS = clangFrontend.a clangSerialization.a clangDriver.a \ clangTooling.a clangParse.a clangSema.a \ - clangAnalysis.a clangRewriteFrontend.a clangRewriteCore.a \ + clangAnalysis.a clangRewriteFrontend.a clangRewrite.a \ clangEdit.a clangAST.a clangLex.a clangBasic.a include $(CLANG_LEVEL)/Makefile diff --git a/run_example.sh b/run_example.sh index 55a44cc..9e3660a 100755 --- a/run_example.sh +++ b/run_example.sh @@ -1,3 +1,3 @@ #!/bin/bash -LLVM_DIR=~/static_analysis/llvm/ #the location of your llvm dir -$LLVM_DIR/Debug+Asserts/bin/example test.c -- +LLVM_DIR=~/build_llvm #the location of your llvm dir +$LLVM_DIR/Release+Asserts/bin/example test.c --