annotate clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1f2b6ac9f198
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===--- ExecuteCompilerInvocation.cpp ------------------------------------===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8 //
anatofuz
parents:
diff changeset
9 // This file holds ExecuteCompilerInvocation(). It is split into its own file to
anatofuz
parents:
diff changeset
10 // minimize the impact of pulling in essentially everything else in Clang.
anatofuz
parents:
diff changeset
11 //
anatofuz
parents:
diff changeset
12 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 #include "clang/ARCMigrate/ARCMTActions.h"
anatofuz
parents:
diff changeset
15 #include "clang/CodeGen/CodeGenAction.h"
anatofuz
parents:
diff changeset
16 #include "clang/Config/config.h"
anatofuz
parents:
diff changeset
17 #include "clang/Driver/Options.h"
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
18 #include "clang/ExtractAPI/FrontendActions.h"
150
anatofuz
parents:
diff changeset
19 #include "clang/Frontend/CompilerInstance.h"
anatofuz
parents:
diff changeset
20 #include "clang/Frontend/CompilerInvocation.h"
anatofuz
parents:
diff changeset
21 #include "clang/Frontend/FrontendActions.h"
anatofuz
parents:
diff changeset
22 #include "clang/Frontend/FrontendDiagnostic.h"
anatofuz
parents:
diff changeset
23 #include "clang/Frontend/FrontendPluginRegistry.h"
anatofuz
parents:
diff changeset
24 #include "clang/Frontend/Utils.h"
anatofuz
parents:
diff changeset
25 #include "clang/FrontendTool/Utils.h"
anatofuz
parents:
diff changeset
26 #include "clang/Rewrite/Frontend/FrontendActions.h"
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
27 #include "clang/StaticAnalyzer/Frontend/AnalyzerHelpFlags.h"
150
anatofuz
parents:
diff changeset
28 #include "clang/StaticAnalyzer/Frontend/FrontendActions.h"
anatofuz
parents:
diff changeset
29 #include "llvm/Option/OptTable.h"
anatofuz
parents:
diff changeset
30 #include "llvm/Option/Option.h"
anatofuz
parents:
diff changeset
31 #include "llvm/Support/BuryPointer.h"
anatofuz
parents:
diff changeset
32 #include "llvm/Support/DynamicLibrary.h"
anatofuz
parents:
diff changeset
33 #include "llvm/Support/ErrorHandling.h"
anatofuz
parents:
diff changeset
34 using namespace clang;
anatofuz
parents:
diff changeset
35 using namespace llvm::opt;
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 namespace clang {
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 static std::unique_ptr<FrontendAction>
anatofuz
parents:
diff changeset
40 CreateFrontendBaseAction(CompilerInstance &CI) {
anatofuz
parents:
diff changeset
41 using namespace clang::frontend;
anatofuz
parents:
diff changeset
42 StringRef Action("unknown");
anatofuz
parents:
diff changeset
43 (void)Action;
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 switch (CI.getFrontendOpts().ProgramAction) {
anatofuz
parents:
diff changeset
46 case ASTDeclList: return std::make_unique<ASTDeclListAction>();
anatofuz
parents:
diff changeset
47 case ASTDump: return std::make_unique<ASTDumpAction>();
anatofuz
parents:
diff changeset
48 case ASTPrint: return std::make_unique<ASTPrintAction>();
anatofuz
parents:
diff changeset
49 case ASTView: return std::make_unique<ASTViewAction>();
anatofuz
parents:
diff changeset
50 case DumpCompilerOptions:
anatofuz
parents:
diff changeset
51 return std::make_unique<DumpCompilerOptionsAction>();
anatofuz
parents:
diff changeset
52 case DumpRawTokens: return std::make_unique<DumpRawTokensAction>();
anatofuz
parents:
diff changeset
53 case DumpTokens: return std::make_unique<DumpTokensAction>();
anatofuz
parents:
diff changeset
54 case EmitAssembly: return std::make_unique<EmitAssemblyAction>();
anatofuz
parents:
diff changeset
55 case EmitBC: return std::make_unique<EmitBCAction>();
anatofuz
parents:
diff changeset
56 case EmitHTML: return std::make_unique<HTMLPrintAction>();
anatofuz
parents:
diff changeset
57 case EmitLLVM: return std::make_unique<EmitLLVMAction>();
anatofuz
parents:
diff changeset
58 case EmitLLVMOnly: return std::make_unique<EmitLLVMOnlyAction>();
anatofuz
parents:
diff changeset
59 case EmitCodeGenOnly: return std::make_unique<EmitCodeGenOnlyAction>();
anatofuz
parents:
diff changeset
60 case EmitObj: return std::make_unique<EmitObjAction>();
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
61 case ExtractAPI:
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
62 return std::make_unique<ExtractAPIAction>();
150
anatofuz
parents:
diff changeset
63 case FixIt: return std::make_unique<FixItAction>();
anatofuz
parents:
diff changeset
64 case GenerateModule:
anatofuz
parents:
diff changeset
65 return std::make_unique<GenerateModuleFromModuleMapAction>();
anatofuz
parents:
diff changeset
66 case GenerateModuleInterface:
anatofuz
parents:
diff changeset
67 return std::make_unique<GenerateModuleInterfaceAction>();
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
68 case GenerateHeaderUnit:
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
69 return std::make_unique<GenerateHeaderUnitAction>();
150
anatofuz
parents:
diff changeset
70 case GeneratePCH: return std::make_unique<GeneratePCHAction>();
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
71 case GenerateInterfaceStubs:
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
72 return std::make_unique<GenerateInterfaceStubsAction>();
150
anatofuz
parents:
diff changeset
73 case InitOnly: return std::make_unique<InitOnlyAction>();
anatofuz
parents:
diff changeset
74 case ParseSyntaxOnly: return std::make_unique<SyntaxOnlyAction>();
anatofuz
parents:
diff changeset
75 case ModuleFileInfo: return std::make_unique<DumpModuleInfoAction>();
anatofuz
parents:
diff changeset
76 case VerifyPCH: return std::make_unique<VerifyPCHAction>();
anatofuz
parents:
diff changeset
77 case TemplightDump: return std::make_unique<TemplightDumpAction>();
anatofuz
parents:
diff changeset
78
anatofuz
parents:
diff changeset
79 case PluginAction: {
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
80 for (const FrontendPluginRegistry::entry &Plugin :
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
81 FrontendPluginRegistry::entries()) {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
82 if (Plugin.getName() == CI.getFrontendOpts().ActionName) {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
83 std::unique_ptr<PluginASTAction> P(Plugin.instantiate());
150
anatofuz
parents:
diff changeset
84 if ((P->getActionType() != PluginASTAction::ReplaceAction &&
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
85 P->getActionType() != PluginASTAction::CmdlineAfterMainAction) ||
150
anatofuz
parents:
diff changeset
86 !P->ParseArgs(
anatofuz
parents:
diff changeset
87 CI,
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
88 CI.getFrontendOpts().PluginArgs[std::string(Plugin.getName())]))
150
anatofuz
parents:
diff changeset
89 return nullptr;
anatofuz
parents:
diff changeset
90 return std::move(P);
anatofuz
parents:
diff changeset
91 }
anatofuz
parents:
diff changeset
92 }
anatofuz
parents:
diff changeset
93
anatofuz
parents:
diff changeset
94 CI.getDiagnostics().Report(diag::err_fe_invalid_plugin_name)
anatofuz
parents:
diff changeset
95 << CI.getFrontendOpts().ActionName;
anatofuz
parents:
diff changeset
96 return nullptr;
anatofuz
parents:
diff changeset
97 }
anatofuz
parents:
diff changeset
98
anatofuz
parents:
diff changeset
99 case PrintPreamble: return std::make_unique<PrintPreambleAction>();
anatofuz
parents:
diff changeset
100 case PrintPreprocessedInput: {
anatofuz
parents:
diff changeset
101 if (CI.getPreprocessorOutputOpts().RewriteIncludes ||
anatofuz
parents:
diff changeset
102 CI.getPreprocessorOutputOpts().RewriteImports)
anatofuz
parents:
diff changeset
103 return std::make_unique<RewriteIncludesAction>();
anatofuz
parents:
diff changeset
104 return std::make_unique<PrintPreprocessedAction>();
anatofuz
parents:
diff changeset
105 }
anatofuz
parents:
diff changeset
106
anatofuz
parents:
diff changeset
107 case RewriteMacros: return std::make_unique<RewriteMacrosAction>();
anatofuz
parents:
diff changeset
108 case RewriteTest: return std::make_unique<RewriteTestAction>();
anatofuz
parents:
diff changeset
109 #if CLANG_ENABLE_OBJC_REWRITER
anatofuz
parents:
diff changeset
110 case RewriteObjC: return std::make_unique<RewriteObjCAction>();
anatofuz
parents:
diff changeset
111 #else
anatofuz
parents:
diff changeset
112 case RewriteObjC: Action = "RewriteObjC"; break;
anatofuz
parents:
diff changeset
113 #endif
anatofuz
parents:
diff changeset
114 #if CLANG_ENABLE_ARCMT
anatofuz
parents:
diff changeset
115 case MigrateSource:
anatofuz
parents:
diff changeset
116 return std::make_unique<arcmt::MigrateSourceAction>();
anatofuz
parents:
diff changeset
117 #else
anatofuz
parents:
diff changeset
118 case MigrateSource: Action = "MigrateSource"; break;
anatofuz
parents:
diff changeset
119 #endif
anatofuz
parents:
diff changeset
120 #if CLANG_ENABLE_STATIC_ANALYZER
anatofuz
parents:
diff changeset
121 case RunAnalysis: return std::make_unique<ento::AnalysisAction>();
anatofuz
parents:
diff changeset
122 #else
anatofuz
parents:
diff changeset
123 case RunAnalysis: Action = "RunAnalysis"; break;
anatofuz
parents:
diff changeset
124 #endif
anatofuz
parents:
diff changeset
125 case RunPreprocessorOnly: return std::make_unique<PreprocessOnlyAction>();
anatofuz
parents:
diff changeset
126 case PrintDependencyDirectivesSourceMinimizerOutput:
anatofuz
parents:
diff changeset
127 return std::make_unique<PrintDependencyDirectivesSourceMinimizerAction>();
anatofuz
parents:
diff changeset
128 }
anatofuz
parents:
diff changeset
129
anatofuz
parents:
diff changeset
130 #if !CLANG_ENABLE_ARCMT || !CLANG_ENABLE_STATIC_ANALYZER \
anatofuz
parents:
diff changeset
131 || !CLANG_ENABLE_OBJC_REWRITER
anatofuz
parents:
diff changeset
132 CI.getDiagnostics().Report(diag::err_fe_action_not_available) << Action;
anatofuz
parents:
diff changeset
133 return 0;
anatofuz
parents:
diff changeset
134 #else
anatofuz
parents:
diff changeset
135 llvm_unreachable("Invalid program action!");
anatofuz
parents:
diff changeset
136 #endif
anatofuz
parents:
diff changeset
137 }
anatofuz
parents:
diff changeset
138
anatofuz
parents:
diff changeset
139 std::unique_ptr<FrontendAction>
anatofuz
parents:
diff changeset
140 CreateFrontendAction(CompilerInstance &CI) {
anatofuz
parents:
diff changeset
141 // Create the underlying action.
anatofuz
parents:
diff changeset
142 std::unique_ptr<FrontendAction> Act = CreateFrontendBaseAction(CI);
anatofuz
parents:
diff changeset
143 if (!Act)
anatofuz
parents:
diff changeset
144 return nullptr;
anatofuz
parents:
diff changeset
145
anatofuz
parents:
diff changeset
146 const FrontendOptions &FEOpts = CI.getFrontendOpts();
anatofuz
parents:
diff changeset
147
anatofuz
parents:
diff changeset
148 if (FEOpts.FixAndRecompile) {
anatofuz
parents:
diff changeset
149 Act = std::make_unique<FixItRecompile>(std::move(Act));
anatofuz
parents:
diff changeset
150 }
anatofuz
parents:
diff changeset
151
anatofuz
parents:
diff changeset
152 #if CLANG_ENABLE_ARCMT
anatofuz
parents:
diff changeset
153 if (CI.getFrontendOpts().ProgramAction != frontend::MigrateSource &&
anatofuz
parents:
diff changeset
154 CI.getFrontendOpts().ProgramAction != frontend::GeneratePCH) {
anatofuz
parents:
diff changeset
155 // Potentially wrap the base FE action in an ARC Migrate Tool action.
anatofuz
parents:
diff changeset
156 switch (FEOpts.ARCMTAction) {
anatofuz
parents:
diff changeset
157 case FrontendOptions::ARCMT_None:
anatofuz
parents:
diff changeset
158 break;
anatofuz
parents:
diff changeset
159 case FrontendOptions::ARCMT_Check:
anatofuz
parents:
diff changeset
160 Act = std::make_unique<arcmt::CheckAction>(std::move(Act));
anatofuz
parents:
diff changeset
161 break;
anatofuz
parents:
diff changeset
162 case FrontendOptions::ARCMT_Modify:
anatofuz
parents:
diff changeset
163 Act = std::make_unique<arcmt::ModifyAction>(std::move(Act));
anatofuz
parents:
diff changeset
164 break;
anatofuz
parents:
diff changeset
165 case FrontendOptions::ARCMT_Migrate:
anatofuz
parents:
diff changeset
166 Act = std::make_unique<arcmt::MigrateAction>(std::move(Act),
anatofuz
parents:
diff changeset
167 FEOpts.MTMigrateDir,
anatofuz
parents:
diff changeset
168 FEOpts.ARCMTMigrateReportOut,
anatofuz
parents:
diff changeset
169 FEOpts.ARCMTMigrateEmitARCErrors);
anatofuz
parents:
diff changeset
170 break;
anatofuz
parents:
diff changeset
171 }
anatofuz
parents:
diff changeset
172
anatofuz
parents:
diff changeset
173 if (FEOpts.ObjCMTAction != FrontendOptions::ObjCMT_None) {
anatofuz
parents:
diff changeset
174 Act = std::make_unique<arcmt::ObjCMigrateAction>(std::move(Act),
anatofuz
parents:
diff changeset
175 FEOpts.MTMigrateDir,
anatofuz
parents:
diff changeset
176 FEOpts.ObjCMTAction);
anatofuz
parents:
diff changeset
177 }
anatofuz
parents:
diff changeset
178 }
anatofuz
parents:
diff changeset
179 #endif
anatofuz
parents:
diff changeset
180
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
181 // Wrap the base FE action in an extract api action to generate
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
182 // symbol graph as a biproduct of comilation ( enabled with
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
183 // --emit-symbol-graph option )
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
184 if (!FEOpts.SymbolGraphOutputDir.empty()) {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
185 CI.getCodeGenOpts().ClearASTBeforeBackend = false;
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
186 Act = std::make_unique<WrappingExtractAPIAction>(std::move(Act));
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
187 }
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
188
150
anatofuz
parents:
diff changeset
189 // If there are any AST files to merge, create a frontend action
anatofuz
parents:
diff changeset
190 // adaptor to perform the merge.
anatofuz
parents:
diff changeset
191 if (!FEOpts.ASTMergeFiles.empty())
anatofuz
parents:
diff changeset
192 Act = std::make_unique<ASTMergeAction>(std::move(Act),
anatofuz
parents:
diff changeset
193 FEOpts.ASTMergeFiles);
anatofuz
parents:
diff changeset
194
anatofuz
parents:
diff changeset
195 return Act;
anatofuz
parents:
diff changeset
196 }
anatofuz
parents:
diff changeset
197
anatofuz
parents:
diff changeset
198 bool ExecuteCompilerInvocation(CompilerInstance *Clang) {
anatofuz
parents:
diff changeset
199 // Honor -help.
anatofuz
parents:
diff changeset
200 if (Clang->getFrontendOpts().ShowHelp) {
223
5f17cb93ff66 LLVM13 (2021/7/18)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 221
diff changeset
201 driver::getDriverOptTable().printHelp(
150
anatofuz
parents:
diff changeset
202 llvm::outs(), "clang -cc1 [options] file...",
anatofuz
parents:
diff changeset
203 "LLVM 'Clang' Compiler: http://clang.llvm.org",
anatofuz
parents:
diff changeset
204 /*Include=*/driver::options::CC1Option,
anatofuz
parents:
diff changeset
205 /*Exclude=*/0, /*ShowAllAliases=*/false);
anatofuz
parents:
diff changeset
206 return true;
anatofuz
parents:
diff changeset
207 }
anatofuz
parents:
diff changeset
208
anatofuz
parents:
diff changeset
209 // Honor -version.
anatofuz
parents:
diff changeset
210 //
anatofuz
parents:
diff changeset
211 // FIXME: Use a better -version message?
anatofuz
parents:
diff changeset
212 if (Clang->getFrontendOpts().ShowVersion) {
anatofuz
parents:
diff changeset
213 llvm::cl::PrintVersionMessage();
anatofuz
parents:
diff changeset
214 return true;
anatofuz
parents:
diff changeset
215 }
anatofuz
parents:
diff changeset
216
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
217 Clang->LoadRequestedPlugins();
150
anatofuz
parents:
diff changeset
218
anatofuz
parents:
diff changeset
219 // Honor -mllvm.
anatofuz
parents:
diff changeset
220 //
anatofuz
parents:
diff changeset
221 // FIXME: Remove this, one day.
anatofuz
parents:
diff changeset
222 // This should happen AFTER plugins have been loaded!
anatofuz
parents:
diff changeset
223 if (!Clang->getFrontendOpts().LLVMArgs.empty()) {
anatofuz
parents:
diff changeset
224 unsigned NumArgs = Clang->getFrontendOpts().LLVMArgs.size();
anatofuz
parents:
diff changeset
225 auto Args = std::make_unique<const char*[]>(NumArgs + 2);
anatofuz
parents:
diff changeset
226 Args[0] = "clang (LLVM option parsing)";
anatofuz
parents:
diff changeset
227 for (unsigned i = 0; i != NumArgs; ++i)
anatofuz
parents:
diff changeset
228 Args[i + 1] = Clang->getFrontendOpts().LLVMArgs[i].c_str();
anatofuz
parents:
diff changeset
229 Args[NumArgs + 1] = nullptr;
anatofuz
parents:
diff changeset
230 llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args.get());
anatofuz
parents:
diff changeset
231 }
anatofuz
parents:
diff changeset
232
anatofuz
parents:
diff changeset
233 #if CLANG_ENABLE_STATIC_ANALYZER
anatofuz
parents:
diff changeset
234 // These should happen AFTER plugins have been loaded!
anatofuz
parents:
diff changeset
235
anatofuz
parents:
diff changeset
236 AnalyzerOptions &AnOpts = *Clang->getAnalyzerOpts();
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
237
150
anatofuz
parents:
diff changeset
238 // Honor -analyzer-checker-help and -analyzer-checker-help-hidden.
anatofuz
parents:
diff changeset
239 if (AnOpts.ShowCheckerHelp || AnOpts.ShowCheckerHelpAlpha ||
anatofuz
parents:
diff changeset
240 AnOpts.ShowCheckerHelpDeveloper) {
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
241 ento::printCheckerHelp(llvm::outs(), *Clang);
150
anatofuz
parents:
diff changeset
242 return true;
anatofuz
parents:
diff changeset
243 }
anatofuz
parents:
diff changeset
244
anatofuz
parents:
diff changeset
245 // Honor -analyzer-checker-option-help.
anatofuz
parents:
diff changeset
246 if (AnOpts.ShowCheckerOptionList || AnOpts.ShowCheckerOptionAlphaList ||
anatofuz
parents:
diff changeset
247 AnOpts.ShowCheckerOptionDeveloperList) {
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
248 ento::printCheckerConfigList(llvm::outs(), *Clang);
150
anatofuz
parents:
diff changeset
249 return true;
anatofuz
parents:
diff changeset
250 }
anatofuz
parents:
diff changeset
251
anatofuz
parents:
diff changeset
252 // Honor -analyzer-list-enabled-checkers.
anatofuz
parents:
diff changeset
253 if (AnOpts.ShowEnabledCheckerList) {
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
254 ento::printEnabledCheckerList(llvm::outs(), *Clang);
150
anatofuz
parents:
diff changeset
255 return true;
anatofuz
parents:
diff changeset
256 }
anatofuz
parents:
diff changeset
257
anatofuz
parents:
diff changeset
258 // Honor -analyzer-config-help.
anatofuz
parents:
diff changeset
259 if (AnOpts.ShowConfigOptionsList) {
anatofuz
parents:
diff changeset
260 ento::printAnalyzerConfigList(llvm::outs());
anatofuz
parents:
diff changeset
261 return true;
anatofuz
parents:
diff changeset
262 }
anatofuz
parents:
diff changeset
263 #endif
anatofuz
parents:
diff changeset
264
anatofuz
parents:
diff changeset
265 // If there were errors in processing arguments, don't do anything else.
anatofuz
parents:
diff changeset
266 if (Clang->getDiagnostics().hasErrorOccurred())
anatofuz
parents:
diff changeset
267 return false;
anatofuz
parents:
diff changeset
268 // Create and execute the frontend action.
anatofuz
parents:
diff changeset
269 std::unique_ptr<FrontendAction> Act(CreateFrontendAction(*Clang));
anatofuz
parents:
diff changeset
270 if (!Act)
anatofuz
parents:
diff changeset
271 return false;
anatofuz
parents:
diff changeset
272 bool Success = Clang->ExecuteAction(*Act);
anatofuz
parents:
diff changeset
273 if (Clang->getFrontendOpts().DisableFree)
anatofuz
parents:
diff changeset
274 llvm::BuryPointer(std::move(Act));
anatofuz
parents:
diff changeset
275 return Success;
anatofuz
parents:
diff changeset
276 }
anatofuz
parents:
diff changeset
277
anatofuz
parents:
diff changeset
278 } // namespace clang