Mercurial > hg > CbC > CbC_llvm
diff clang/docs/RAVFrontendAction.rst @ 221:79ff65ed7e25
LLVM12 Original
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Jun 2021 19:15:29 +0900 |
parents | 1d019706d866 |
children | c4bab56944e8 |
line wrap: on
line diff
--- a/clang/docs/RAVFrontendAction.rst Tue Jun 15 19:13:43 2021 +0900 +++ b/clang/docs/RAVFrontendAction.rst Tue Jun 15 19:15:29 2021 +0900 @@ -27,8 +27,7 @@ public: virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer( clang::CompilerInstance &Compiler, llvm::StringRef InFile) { - return std::unique_ptr<clang::ASTConsumer>( - new FindNamedClassConsumer); + return std::make_unique<FindNamedClassConsumer>(); } }; @@ -114,8 +113,7 @@ virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer( clang::CompilerInstance &Compiler, llvm::StringRef InFile) { - return std::unique_ptr<clang::ASTConsumer>( - new FindNamedClassConsumer(&Compiler.getASTContext())); + return std::make_unique<FindNamedClassConsumer>(&Compiler.getASTContext()); } Now that the ASTContext is available in the RecursiveASTVisitor, we can @@ -189,8 +187,7 @@ public: virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer( clang::CompilerInstance &Compiler, llvm::StringRef InFile) { - return std::unique_ptr<clang::ASTConsumer>( - new FindNamedClassConsumer(&Compiler.getASTContext())); + return std::make_unique<FindNamedClassConsumer>(&Compiler.getASTContext()); } }; @@ -205,9 +202,20 @@ :: + set(LLVM_LINK_COMPONENTS + Support + ) + add_clang_executable(find-class-decls FindClassDecls.cpp) - target_link_libraries(find-class-decls clangTooling) + target_link_libraries(find-class-decls + PRIVATE + clangAST + clangBasic + clangFrontend + clangSerialization + clangTooling + ) When running this tool over a small code snippet it will output all declarations of a class n::m::C it found: