aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
diff options
context:
space:
mode:
authorAnkur <arsenic.secondary@gmail.com>2023-07-03 17:23:07 +0530
committerAnkur <arsenic.secondary@gmail.com>2023-07-03 17:32:30 +0530
commit8e9145e4314202b960dd883e6a7b21707ed5c176 (patch)
treef551dd604baa9d0e65d1484de4343594706b7ab4 /clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
parent783222efded0ac5f7d76ea41ec03eb2bf83ff918 (diff)
downloadllvm-8e9145e4314202b960dd883e6a7b21707ed5c176.zip
llvm-8e9145e4314202b960dd883e6a7b21707ed5c176.tar.gz
llvm-8e9145e4314202b960dd883e6a7b21707ed5c176.tar.bz2
[clang][ExtractAPI] Add --emit-symbol-graph option
Add new --emit-symbol-graph=<DIR> option which generates ExtractAPI symbol graph information of .c/.m files on regular compilation job and put them in the provided "DIR" directory. Reviewed By: dang Differential Revision: https://reviews.llvm.org/D152356
Diffstat (limited to 'clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp')
-rw-r--r--clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
index 47157ca..310f677 100644
--- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
+++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
@@ -178,6 +178,14 @@ CreateFrontendAction(CompilerInstance &CI) {
}
#endif
+ // Wrap the base FE action in an extract api action to generate
+ // symbol graph as a biproduct of comilation ( enabled with
+ // --emit-symbol-graph option )
+ if (!FEOpts.SymbolGraphOutputDir.empty()) {
+ CI.getCodeGenOpts().ClearASTBeforeBackend = false;
+ Act = std::make_unique<WrappingExtractAPIAction>(std::move(Act));
+ }
+
// If there are any AST files to merge, create a frontend action
// adaptor to perform the merge.
if (!FEOpts.ASTMergeFiles.empty())