diff --git a/Example.cpp b/Example.cpp index de10c6b..d95e918 100644 --- a/Example.cpp +++ b/Example.cpp @@ -104,8 +104,8 @@ 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 unique_ptr CreateASTConsumer(CompilerInstance &CI, StringRef file) { + return make_unique(&CI); // pass CI pointer to ASTConsumer } }; @@ -113,12 +113,12 @@ class ExampleFrontendAction : public ASTFrontendAction { int main(int argc, const char **argv) { // parse the command-line args passed to your code - CommonOptionsParser op(argc, argv); + CommonOptionsParser op(argc, argv, llvm::cl::GeneralCategory); // 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..7c7c99e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CLANG_LEVEL := ../.. -TOOLNAME = example #the name of your tool's executable +TOOLNAME = kevinaboos_example #the name of your tool's executable SOURCES := Example.cpp #the Clang source files you want to compile @@ -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