annotate clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @ 173:0572611fdcc8 llvm10 llvm12

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