aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp42
1 files changed, 18 insertions, 24 deletions
diff --git a/contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
index b95851e380d2..b280a1359d2f 100644
--- a/contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
+++ b/contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
@@ -15,6 +15,7 @@
#include "clang/CodeGen/CodeGenAction.h"
#include "clang/Config/config.h"
#include "clang/Driver/Options.h"
+#include "clang/ExtractAPI/FrontendActions.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Frontend/FrontendActions.h"
@@ -57,13 +58,15 @@ CreateFrontendBaseAction(CompilerInstance &CI) {
case EmitLLVMOnly: return std::make_unique<EmitLLVMOnlyAction>();
case EmitCodeGenOnly: return std::make_unique<EmitCodeGenOnlyAction>();
case EmitObj: return std::make_unique<EmitObjAction>();
+ case ExtractAPI:
+ return std::make_unique<ExtractAPIAction>();
case FixIt: return std::make_unique<FixItAction>();
case GenerateModule:
return std::make_unique<GenerateModuleFromModuleMapAction>();
case GenerateModuleInterface:
return std::make_unique<GenerateModuleInterfaceAction>();
- case GenerateHeaderModule:
- return std::make_unique<GenerateHeaderModuleAction>();
+ case GenerateHeaderUnit:
+ return std::make_unique<GenerateHeaderUnitAction>();
case GeneratePCH: return std::make_unique<GeneratePCHAction>();
case GenerateInterfaceStubs:
return std::make_unique<GenerateInterfaceStubsAction>();
@@ -79,7 +82,7 @@ CreateFrontendBaseAction(CompilerInstance &CI) {
if (Plugin.getName() == CI.getFrontendOpts().ActionName) {
std::unique_ptr<PluginASTAction> P(Plugin.instantiate());
if ((P->getActionType() != PluginASTAction::ReplaceAction &&
- P->getActionType() != PluginASTAction::Cmdline) ||
+ P->getActionType() != PluginASTAction::CmdlineAfterMainAction) ||
!P->ParseArgs(
CI,
CI.getFrontendOpts().PluginArgs[std::string(Plugin.getName())]))
@@ -175,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())
@@ -190,8 +201,8 @@ bool ExecuteCompilerInvocation(CompilerInstance *Clang) {
driver::getDriverOptTable().printHelp(
llvm::outs(), "clang -cc1 [options] file...",
"LLVM 'Clang' Compiler: http://clang.llvm.org",
- /*Include=*/driver::options::CC1Option,
- /*Exclude=*/0, /*ShowAllAliases=*/false);
+ /*ShowHidden=*/false, /*ShowAllAliases=*/false,
+ llvm::opt::Visibility(driver::options::CC1Option));
return true;
}
@@ -203,24 +214,7 @@ bool ExecuteCompilerInvocation(CompilerInstance *Clang) {
return true;
}
- // Load any requested plugins.
- for (const std::string &Path : Clang->getFrontendOpts().Plugins) {
- std::string Error;
- if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Path.c_str(), &Error))
- Clang->getDiagnostics().Report(diag::err_fe_unable_to_load_plugin)
- << Path << Error;
- }
-
- // Check if any of the loaded plugins replaces the main AST action
- for (const FrontendPluginRegistry::entry &Plugin :
- FrontendPluginRegistry::entries()) {
- std::unique_ptr<PluginASTAction> P(Plugin.instantiate());
- if (P->getActionType() == PluginASTAction::ReplaceAction) {
- Clang->getFrontendOpts().ProgramAction = clang::frontend::PluginAction;
- Clang->getFrontendOpts().ActionName = Plugin.getName().str();
- break;
- }
- }
+ Clang->LoadRequestedPlugins();
// Honor -mllvm.
//
@@ -239,7 +233,7 @@ bool ExecuteCompilerInvocation(CompilerInstance *Clang) {
#if CLANG_ENABLE_STATIC_ANALYZER
// These should happen AFTER plugins have been loaded!
- AnalyzerOptions &AnOpts = *Clang->getAnalyzerOpts();
+ AnalyzerOptions &AnOpts = Clang->getAnalyzerOpts();
// Honor -analyzer-checker-help and -analyzer-checker-help-hidden.
if (AnOpts.ShowCheckerHelp || AnOpts.ShowCheckerHelpAlpha ||