]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Frontend/FrontendAction.cpp
Update clang to trunk r290819 and resolve conflicts.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / Frontend / FrontendAction.cpp
1 //===--- FrontendAction.cpp -----------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "clang/Frontend/FrontendAction.h"
11 #include "clang/AST/ASTConsumer.h"
12 #include "clang/AST/ASTContext.h"
13 #include "clang/AST/DeclGroup.h"
14 #include "clang/Frontend/ASTUnit.h"
15 #include "clang/Frontend/CompilerInstance.h"
16 #include "clang/Frontend/FrontendDiagnostic.h"
17 #include "clang/Frontend/FrontendPluginRegistry.h"
18 #include "clang/Frontend/LayoutOverrideSource.h"
19 #include "clang/Frontend/MultiplexConsumer.h"
20 #include "clang/Frontend/Utils.h"
21 #include "clang/Lex/HeaderSearch.h"
22 #include "clang/Lex/Preprocessor.h"
23 #include "clang/Lex/PreprocessorOptions.h"
24 #include "clang/Parse/ParseAST.h"
25 #include "clang/Serialization/ASTDeserializationListener.h"
26 #include "clang/Serialization/ASTReader.h"
27 #include "clang/Serialization/GlobalModuleIndex.h"
28 #include "llvm/Support/ErrorHandling.h"
29 #include "llvm/Support/FileSystem.h"
30 #include "llvm/Support/Path.h"
31 #include "llvm/Support/Timer.h"
32 #include "llvm/Support/raw_ostream.h"
33 #include <system_error>
34 using namespace clang;
35
36 LLVM_INSTANTIATE_REGISTRY(FrontendPluginRegistry)
37
38 namespace {
39
40 class DelegatingDeserializationListener : public ASTDeserializationListener {
41   ASTDeserializationListener *Previous;
42   bool DeletePrevious;
43
44 public:
45   explicit DelegatingDeserializationListener(
46       ASTDeserializationListener *Previous, bool DeletePrevious)
47       : Previous(Previous), DeletePrevious(DeletePrevious) {}
48   ~DelegatingDeserializationListener() override {
49     if (DeletePrevious)
50       delete Previous;
51   }
52
53   void ReaderInitialized(ASTReader *Reader) override {
54     if (Previous)
55       Previous->ReaderInitialized(Reader);
56   }
57   void IdentifierRead(serialization::IdentID ID,
58                       IdentifierInfo *II) override {
59     if (Previous)
60       Previous->IdentifierRead(ID, II);
61   }
62   void TypeRead(serialization::TypeIdx Idx, QualType T) override {
63     if (Previous)
64       Previous->TypeRead(Idx, T);
65   }
66   void DeclRead(serialization::DeclID ID, const Decl *D) override {
67     if (Previous)
68       Previous->DeclRead(ID, D);
69   }
70   void SelectorRead(serialization::SelectorID ID, Selector Sel) override {
71     if (Previous)
72       Previous->SelectorRead(ID, Sel);
73   }
74   void MacroDefinitionRead(serialization::PreprocessedEntityID PPID,
75                            MacroDefinitionRecord *MD) override {
76     if (Previous)
77       Previous->MacroDefinitionRead(PPID, MD);
78   }
79 };
80
81 /// \brief Dumps deserialized declarations.
82 class DeserializedDeclsDumper : public DelegatingDeserializationListener {
83 public:
84   explicit DeserializedDeclsDumper(ASTDeserializationListener *Previous,
85                                    bool DeletePrevious)
86       : DelegatingDeserializationListener(Previous, DeletePrevious) {}
87
88   void DeclRead(serialization::DeclID ID, const Decl *D) override {
89     llvm::outs() << "PCH DECL: " << D->getDeclKindName();
90     if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
91       llvm::outs() << " - " << *ND;
92     llvm::outs() << "\n";
93
94     DelegatingDeserializationListener::DeclRead(ID, D);
95   }
96 };
97
98 /// \brief Checks deserialized declarations and emits error if a name
99 /// matches one given in command-line using -error-on-deserialized-decl.
100 class DeserializedDeclsChecker : public DelegatingDeserializationListener {
101   ASTContext &Ctx;
102   std::set<std::string> NamesToCheck;
103
104 public:
105   DeserializedDeclsChecker(ASTContext &Ctx,
106                            const std::set<std::string> &NamesToCheck,
107                            ASTDeserializationListener *Previous,
108                            bool DeletePrevious)
109       : DelegatingDeserializationListener(Previous, DeletePrevious), Ctx(Ctx),
110         NamesToCheck(NamesToCheck) {}
111
112   void DeclRead(serialization::DeclID ID, const Decl *D) override {
113     if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
114       if (NamesToCheck.find(ND->getNameAsString()) != NamesToCheck.end()) {
115         unsigned DiagID
116           = Ctx.getDiagnostics().getCustomDiagID(DiagnosticsEngine::Error,
117                                                  "%0 was deserialized");
118         Ctx.getDiagnostics().Report(Ctx.getFullLoc(D->getLocation()), DiagID)
119             << ND->getNameAsString();
120       }
121
122     DelegatingDeserializationListener::DeclRead(ID, D);
123   }
124 };
125
126 } // end anonymous namespace
127
128 FrontendAction::FrontendAction() : Instance(nullptr) {}
129
130 FrontendAction::~FrontendAction() {}
131
132 void FrontendAction::setCurrentInput(const FrontendInputFile &CurrentInput,
133                                      std::unique_ptr<ASTUnit> AST) {
134   this->CurrentInput = CurrentInput;
135   CurrentASTUnit = std::move(AST);
136 }
137
138 std::unique_ptr<ASTConsumer>
139 FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
140                                          StringRef InFile) {
141   std::unique_ptr<ASTConsumer> Consumer = CreateASTConsumer(CI, InFile);
142   if (!Consumer)
143     return nullptr;
144
145   // If there are no registered plugins we don't need to wrap the consumer
146   if (FrontendPluginRegistry::begin() == FrontendPluginRegistry::end())
147     return Consumer;
148
149   // Collect the list of plugins that go before the main action (in Consumers)
150   // or after it (in AfterConsumers)
151   std::vector<std::unique_ptr<ASTConsumer>> Consumers;
152   std::vector<std::unique_ptr<ASTConsumer>> AfterConsumers;
153   for (FrontendPluginRegistry::iterator it = FrontendPluginRegistry::begin(),
154                                         ie = FrontendPluginRegistry::end();
155        it != ie; ++it) {
156     std::unique_ptr<PluginASTAction> P = it->instantiate();
157     PluginASTAction::ActionType ActionType = P->getActionType();
158     if (ActionType == PluginASTAction::Cmdline) {
159       // This is O(|plugins| * |add_plugins|), but since both numbers are
160       // way below 50 in practice, that's ok.
161       for (size_t i = 0, e = CI.getFrontendOpts().AddPluginActions.size();
162            i != e; ++i) {
163         if (it->getName() == CI.getFrontendOpts().AddPluginActions[i]) {
164           ActionType = PluginASTAction::AddAfterMainAction;
165           break;
166         }
167       }
168     }
169     if ((ActionType == PluginASTAction::AddBeforeMainAction ||
170          ActionType == PluginASTAction::AddAfterMainAction) &&
171         P->ParseArgs(CI, CI.getFrontendOpts().PluginArgs[it->getName()])) {
172       std::unique_ptr<ASTConsumer> PluginConsumer = P->CreateASTConsumer(CI, InFile);
173       if (ActionType == PluginASTAction::AddBeforeMainAction) {
174         Consumers.push_back(std::move(PluginConsumer));
175       } else {
176         AfterConsumers.push_back(std::move(PluginConsumer));
177       }
178     }
179   }
180
181   // Add to Consumers the main consumer, then all the plugins that go after it
182   Consumers.push_back(std::move(Consumer));
183   for (auto &C : AfterConsumers) {
184     Consumers.push_back(std::move(C));
185   }
186
187   return llvm::make_unique<MultiplexConsumer>(std::move(Consumers));
188 }
189
190 bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
191                                      const FrontendInputFile &Input) {
192   assert(!Instance && "Already processing a source file!");
193   assert(!Input.isEmpty() && "Unexpected empty filename!");
194   setCurrentInput(Input);
195   setCompilerInstance(&CI);
196
197   StringRef InputFile = Input.getFile();
198   bool HasBegunSourceFile = false;
199   if (!BeginInvocation(CI))
200     goto failure;
201
202   // AST files follow a very different path, since they share objects via the
203   // AST unit.
204   if (Input.getKind() == IK_AST) {
205     assert(!usesPreprocessorOnly() &&
206            "Attempt to pass AST file to preprocessor only action!");
207     assert(hasASTFileSupport() &&
208            "This action does not have AST file support!");
209
210     IntrusiveRefCntPtr<DiagnosticsEngine> Diags(&CI.getDiagnostics());
211
212     std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromASTFile(
213         InputFile, CI.getPCHContainerReader(), Diags, CI.getFileSystemOpts(),
214         CI.getCodeGenOpts().DebugTypeExtRefs);
215
216     if (!AST)
217       goto failure;
218
219     // Inform the diagnostic client we are processing a source file.
220     CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(), nullptr);
221     HasBegunSourceFile = true;
222
223     // Set the shared objects, these are reset when we finish processing the
224     // file, otherwise the CompilerInstance will happily destroy them.
225     CI.setFileManager(&AST->getFileManager());
226     CI.setSourceManager(&AST->getSourceManager());
227     CI.setPreprocessor(&AST->getPreprocessor());
228     CI.setASTContext(&AST->getASTContext());
229
230     setCurrentInput(Input, std::move(AST));
231
232     // Initialize the action.
233     if (!BeginSourceFileAction(CI, InputFile))
234       goto failure;
235
236     // Create the AST consumer.
237     CI.setASTConsumer(CreateWrappedASTConsumer(CI, InputFile));
238     if (!CI.hasASTConsumer())
239       goto failure;
240
241     return true;
242   }
243
244   if (!CI.hasVirtualFileSystem()) {
245     if (IntrusiveRefCntPtr<vfs::FileSystem> VFS =
246           createVFSFromCompilerInvocation(CI.getInvocation(),
247                                           CI.getDiagnostics()))
248       CI.setVirtualFileSystem(VFS);
249     else
250       goto failure;
251   }
252
253   // Set up the file and source managers, if needed.
254   if (!CI.hasFileManager())
255     CI.createFileManager();
256   if (!CI.hasSourceManager())
257     CI.createSourceManager(CI.getFileManager());
258
259   // IR files bypass the rest of initialization.
260   if (Input.getKind() == IK_LLVM_IR) {
261     assert(hasIRSupport() &&
262            "This action does not have IR file support!");
263
264     // Inform the diagnostic client we are processing a source file.
265     CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(), nullptr);
266     HasBegunSourceFile = true;
267
268     // Initialize the action.
269     if (!BeginSourceFileAction(CI, InputFile))
270       goto failure;
271
272     // Initialize the main file entry.
273     if (!CI.InitializeSourceManager(CurrentInput))
274       goto failure;
275
276     return true;
277   }
278
279   // If the implicit PCH include is actually a directory, rather than
280   // a single file, search for a suitable PCH file in that directory.
281   if (!CI.getPreprocessorOpts().ImplicitPCHInclude.empty()) {
282     FileManager &FileMgr = CI.getFileManager();
283     PreprocessorOptions &PPOpts = CI.getPreprocessorOpts();
284     StringRef PCHInclude = PPOpts.ImplicitPCHInclude;
285     std::string SpecificModuleCachePath = CI.getSpecificModuleCachePath();
286     if (const DirectoryEntry *PCHDir = FileMgr.getDirectory(PCHInclude)) {
287       std::error_code EC;
288       SmallString<128> DirNative;
289       llvm::sys::path::native(PCHDir->getName(), DirNative);
290       bool Found = false;
291       vfs::FileSystem &FS = *FileMgr.getVirtualFileSystem();
292       for (vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC), DirEnd;
293            Dir != DirEnd && !EC; Dir.increment(EC)) {
294         // Check whether this is an acceptable AST file.
295         if (ASTReader::isAcceptableASTFile(
296                 Dir->getName(), FileMgr, CI.getPCHContainerReader(),
297                 CI.getLangOpts(), CI.getTargetOpts(), CI.getPreprocessorOpts(),
298                 SpecificModuleCachePath)) {
299           PPOpts.ImplicitPCHInclude = Dir->getName();
300           Found = true;
301           break;
302         }
303       }
304
305       if (!Found) {
306         CI.getDiagnostics().Report(diag::err_fe_no_pch_in_dir) << PCHInclude;
307         goto failure;
308       }
309     }
310   }
311
312   // Set up the preprocessor if needed. When parsing model files the
313   // preprocessor of the original source is reused.
314   if (!isModelParsingAction())
315     CI.createPreprocessor(getTranslationUnitKind());
316
317   // Inform the diagnostic client we are processing a source file.
318   CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(),
319                                            &CI.getPreprocessor());
320   HasBegunSourceFile = true;
321
322   // Initialize the action.
323   if (!BeginSourceFileAction(CI, InputFile))
324     goto failure;
325
326   // Initialize the main file entry. It is important that this occurs after
327   // BeginSourceFileAction, which may change CurrentInput during module builds.
328   if (!CI.InitializeSourceManager(CurrentInput))
329     goto failure;
330
331   // Create the AST context and consumer unless this is a preprocessor only
332   // action.
333   if (!usesPreprocessorOnly()) {
334     // Parsing a model file should reuse the existing ASTContext.
335     if (!isModelParsingAction())
336       CI.createASTContext();
337
338     std::unique_ptr<ASTConsumer> Consumer =
339         CreateWrappedASTConsumer(CI, InputFile);
340     if (!Consumer)
341       goto failure;
342
343     // FIXME: should not overwrite ASTMutationListener when parsing model files?
344     if (!isModelParsingAction())
345       CI.getASTContext().setASTMutationListener(Consumer->GetASTMutationListener());
346
347     if (!CI.getPreprocessorOpts().ChainedIncludes.empty()) {
348       // Convert headers to PCH and chain them.
349       IntrusiveRefCntPtr<ExternalSemaSource> source, FinalReader;
350       source = createChainedIncludesSource(CI, FinalReader);
351       if (!source)
352         goto failure;
353       CI.setModuleManager(static_cast<ASTReader *>(FinalReader.get()));
354       CI.getASTContext().setExternalSource(source);
355     } else if (!CI.getPreprocessorOpts().ImplicitPCHInclude.empty()) {
356       // Use PCH.
357       assert(hasPCHSupport() && "This action does not have PCH support!");
358       ASTDeserializationListener *DeserialListener =
359           Consumer->GetASTDeserializationListener();
360       bool DeleteDeserialListener = false;
361       if (CI.getPreprocessorOpts().DumpDeserializedPCHDecls) {
362         DeserialListener = new DeserializedDeclsDumper(DeserialListener,
363                                                        DeleteDeserialListener);
364         DeleteDeserialListener = true;
365       }
366       if (!CI.getPreprocessorOpts().DeserializedPCHDeclsToErrorOn.empty()) {
367         DeserialListener = new DeserializedDeclsChecker(
368             CI.getASTContext(),
369             CI.getPreprocessorOpts().DeserializedPCHDeclsToErrorOn,
370             DeserialListener, DeleteDeserialListener);
371         DeleteDeserialListener = true;
372       }
373       CI.createPCHExternalASTSource(
374           CI.getPreprocessorOpts().ImplicitPCHInclude,
375           CI.getPreprocessorOpts().DisablePCHValidation,
376           CI.getPreprocessorOpts().AllowPCHWithCompilerErrors, DeserialListener,
377           DeleteDeserialListener);
378       if (!CI.getASTContext().getExternalSource())
379         goto failure;
380     }
381
382     CI.setASTConsumer(std::move(Consumer));
383     if (!CI.hasASTConsumer())
384       goto failure;
385   }
386
387   // Initialize built-in info as long as we aren't using an external AST
388   // source.
389   if (!CI.hasASTContext() || !CI.getASTContext().getExternalSource()) {
390     Preprocessor &PP = CI.getPreprocessor();
391
392     // If modules are enabled, create the module manager before creating
393     // any builtins, so that all declarations know that they might be
394     // extended by an external source.
395     if (CI.getLangOpts().Modules)
396       CI.createModuleManager();
397
398     PP.getBuiltinInfo().initializeBuiltins(PP.getIdentifierTable(),
399                                            PP.getLangOpts());
400   } else {
401     // FIXME: If this is a problem, recover from it by creating a multiplex
402     // source.
403     assert((!CI.getLangOpts().Modules || CI.getModuleManager()) &&
404            "modules enabled but created an external source that "
405            "doesn't support modules");
406   }
407
408   // If we were asked to load any module map files, do so now.
409   for (const auto &Filename : CI.getFrontendOpts().ModuleMapFiles) {
410     if (auto *File = CI.getFileManager().getFile(Filename))
411       CI.getPreprocessor().getHeaderSearchInfo().loadModuleMapFile(
412           File, /*IsSystem*/false);
413     else
414       CI.getDiagnostics().Report(diag::err_module_map_not_found) << Filename;
415   }
416
417   // If we were asked to load any module files, do so now.
418   for (const auto &ModuleFile : CI.getFrontendOpts().ModuleFiles)
419     if (!CI.loadModuleFile(ModuleFile))
420       goto failure;
421
422   // If there is a layout overrides file, attach an external AST source that
423   // provides the layouts from that file.
424   if (!CI.getFrontendOpts().OverrideRecordLayoutsFile.empty() && 
425       CI.hasASTContext() && !CI.getASTContext().getExternalSource()) {
426     IntrusiveRefCntPtr<ExternalASTSource> 
427       Override(new LayoutOverrideSource(
428                      CI.getFrontendOpts().OverrideRecordLayoutsFile));
429     CI.getASTContext().setExternalSource(Override);
430   }
431
432   return true;
433
434   // If we failed, reset state since the client will not end up calling the
435   // matching EndSourceFile().
436   failure:
437   if (isCurrentFileAST()) {
438     CI.setASTContext(nullptr);
439     CI.setPreprocessor(nullptr);
440     CI.setSourceManager(nullptr);
441     CI.setFileManager(nullptr);
442   }
443
444   if (HasBegunSourceFile)
445     CI.getDiagnosticClient().EndSourceFile();
446   CI.clearOutputFiles(/*EraseFiles=*/true);
447   setCurrentInput(FrontendInputFile());
448   setCompilerInstance(nullptr);
449   return false;
450 }
451
452 bool FrontendAction::Execute() {
453   CompilerInstance &CI = getCompilerInstance();
454
455   if (CI.hasFrontendTimer()) {
456     llvm::TimeRegion Timer(CI.getFrontendTimer());
457     ExecuteAction();
458   }
459   else ExecuteAction();
460
461   // If we are supposed to rebuild the global module index, do so now unless
462   // there were any module-build failures.
463   if (CI.shouldBuildGlobalModuleIndex() && CI.hasFileManager() &&
464       CI.hasPreprocessor()) {
465     StringRef Cache =
466         CI.getPreprocessor().getHeaderSearchInfo().getModuleCachePath();
467     if (!Cache.empty())
468       GlobalModuleIndex::writeIndex(CI.getFileManager(),
469                                     CI.getPCHContainerReader(), Cache);
470   }
471
472   return true;
473 }
474
475 void FrontendAction::EndSourceFile() {
476   CompilerInstance &CI = getCompilerInstance();
477
478   // Inform the diagnostic client we are done with this source file.
479   CI.getDiagnosticClient().EndSourceFile();
480
481   // Inform the preprocessor we are done.
482   if (CI.hasPreprocessor())
483     CI.getPreprocessor().EndSourceFile();
484
485   // Finalize the action.
486   EndSourceFileAction();
487
488   // Sema references the ast consumer, so reset sema first.
489   //
490   // FIXME: There is more per-file stuff we could just drop here?
491   bool DisableFree = CI.getFrontendOpts().DisableFree;
492   if (DisableFree) {
493     CI.resetAndLeakSema();
494     CI.resetAndLeakASTContext();
495     BuryPointer(CI.takeASTConsumer().get());
496   } else {
497     CI.setSema(nullptr);
498     CI.setASTContext(nullptr);
499     CI.setASTConsumer(nullptr);
500   }
501
502   if (CI.getFrontendOpts().ShowStats) {
503     llvm::errs() << "\nSTATISTICS FOR '" << getCurrentFile() << "':\n";
504     CI.getPreprocessor().PrintStats();
505     CI.getPreprocessor().getIdentifierTable().PrintStats();
506     CI.getPreprocessor().getHeaderSearchInfo().PrintStats();
507     CI.getSourceManager().PrintStats();
508     llvm::errs() << "\n";
509   }
510
511   // Cleanup the output streams, and erase the output files if instructed by the
512   // FrontendAction.
513   CI.clearOutputFiles(/*EraseFiles=*/shouldEraseOutputFiles());
514
515   if (isCurrentFileAST()) {
516     if (DisableFree) {
517       CI.resetAndLeakPreprocessor();
518       CI.resetAndLeakSourceManager();
519       CI.resetAndLeakFileManager();
520     } else {
521       CI.setPreprocessor(nullptr);
522       CI.setSourceManager(nullptr);
523       CI.setFileManager(nullptr);
524     }
525   }
526
527   setCompilerInstance(nullptr);
528   setCurrentInput(FrontendInputFile());
529 }
530
531 bool FrontendAction::shouldEraseOutputFiles() {
532   return getCompilerInstance().getDiagnostics().hasErrorOccurred();
533 }
534
535 //===----------------------------------------------------------------------===//
536 // Utility Actions
537 //===----------------------------------------------------------------------===//
538
539 void ASTFrontendAction::ExecuteAction() {
540   CompilerInstance &CI = getCompilerInstance();
541   if (!CI.hasPreprocessor())
542     return;
543
544   // FIXME: Move the truncation aspect of this into Sema, we delayed this till
545   // here so the source manager would be initialized.
546   if (hasCodeCompletionSupport() &&
547       !CI.getFrontendOpts().CodeCompletionAt.FileName.empty())
548     CI.createCodeCompletionConsumer();
549
550   // Use a code completion consumer?
551   CodeCompleteConsumer *CompletionConsumer = nullptr;
552   if (CI.hasCodeCompletionConsumer())
553     CompletionConsumer = &CI.getCodeCompletionConsumer();
554
555   if (!CI.hasSema())
556     CI.createSema(getTranslationUnitKind(), CompletionConsumer);
557
558   ParseAST(CI.getSema(), CI.getFrontendOpts().ShowStats,
559            CI.getFrontendOpts().SkipFunctionBodies);
560 }
561
562 void PluginASTAction::anchor() { }
563
564 std::unique_ptr<ASTConsumer>
565 PreprocessorFrontendAction::CreateASTConsumer(CompilerInstance &CI,
566                                               StringRef InFile) {
567   llvm_unreachable("Invalid CreateASTConsumer on preprocessor action!");
568 }
569
570 std::unique_ptr<ASTConsumer>
571 WrapperFrontendAction::CreateASTConsumer(CompilerInstance &CI,
572                                          StringRef InFile) {
573   return WrappedAction->CreateASTConsumer(CI, InFile);
574 }
575 bool WrapperFrontendAction::BeginInvocation(CompilerInstance &CI) {
576   return WrappedAction->BeginInvocation(CI);
577 }
578 bool WrapperFrontendAction::BeginSourceFileAction(CompilerInstance &CI,
579                                                   StringRef Filename) {
580   WrappedAction->setCurrentInput(getCurrentInput());
581   WrappedAction->setCompilerInstance(&CI);
582   auto Ret = WrappedAction->BeginSourceFileAction(CI, Filename);
583   // BeginSourceFileAction may change CurrentInput, e.g. during module builds.
584   setCurrentInput(WrappedAction->getCurrentInput());
585   return Ret;
586 }
587 void WrapperFrontendAction::ExecuteAction() {
588   WrappedAction->ExecuteAction();
589 }
590 void WrapperFrontendAction::EndSourceFileAction() {
591   WrappedAction->EndSourceFileAction();
592 }
593
594 bool WrapperFrontendAction::usesPreprocessorOnly() const {
595   return WrappedAction->usesPreprocessorOnly();
596 }
597 TranslationUnitKind WrapperFrontendAction::getTranslationUnitKind() {
598   return WrappedAction->getTranslationUnitKind();
599 }
600 bool WrapperFrontendAction::hasPCHSupport() const {
601   return WrappedAction->hasPCHSupport();
602 }
603 bool WrapperFrontendAction::hasASTFileSupport() const {
604   return WrappedAction->hasASTFileSupport();
605 }
606 bool WrapperFrontendAction::hasIRSupport() const {
607   return WrappedAction->hasIRSupport();
608 }
609 bool WrapperFrontendAction::hasCodeCompletionSupport() const {
610   return WrappedAction->hasCodeCompletionSupport();
611 }
612
613 WrapperFrontendAction::WrapperFrontendAction(
614     std::unique_ptr<FrontendAction> WrappedAction)
615   : WrappedAction(std::move(WrappedAction)) {}
616