clang  14.0.0git
CompilerInstance.h
Go to the documentation of this file.
1 //===-- CompilerInstance.h - Clang Compiler Instance ------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_
10 #define LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_
11 
12 #include "clang/AST/ASTConsumer.h"
13 #include "clang/Basic/Diagnostic.h"
17 #include "clang/Frontend/Utils.h"
19 #include "clang/Lex/ModuleLoader.h"
20 #include "llvm/ADT/ArrayRef.h"
21 #include "llvm/ADT/DenseMap.h"
22 #include "llvm/ADT/IntrusiveRefCntPtr.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/Support/BuryPointer.h"
25 #include "llvm/Support/FileSystem.h"
26 #include <cassert>
27 #include <list>
28 #include <memory>
29 #include <string>
30 #include <utility>
31 
32 namespace llvm {
33 class raw_fd_ostream;
34 class Timer;
35 class TimerGroup;
36 }
37 
38 namespace clang {
39 class ASTContext;
40 class ASTReader;
41 class CodeCompleteConsumer;
42 class DiagnosticsEngine;
43 class DiagnosticConsumer;
44 class FileManager;
45 class FrontendAction;
46 class InMemoryModuleCache;
47 class Module;
48 class Preprocessor;
49 class Sema;
50 class SourceManager;
51 class TargetInfo;
53 
54 /// CompilerInstance - Helper class for managing a single instance of the Clang
55 /// compiler.
56 ///
57 /// The CompilerInstance serves two purposes:
58 /// (1) It manages the various objects which are necessary to run the compiler,
59 /// for example the preprocessor, the target information, and the AST
60 /// context.
61 /// (2) It provides utility routines for constructing and manipulating the
62 /// common Clang objects.
63 ///
64 /// The compiler instance generally owns the instance of all the objects that it
65 /// manages. However, clients can still share objects by manually setting the
66 /// object and retaking ownership prior to destroying the CompilerInstance.
67 ///
68 /// The compiler instance is intended to simplify clients, but not to lock them
69 /// in to the compiler instance for everything. When possible, utility functions
70 /// come in two forms; a short form that reuses the CompilerInstance objects,
71 /// and a long form that takes explicit instances of any required objects.
73  /// The options used in this compiler instance.
74  std::shared_ptr<CompilerInvocation> Invocation;
75 
76  /// The diagnostics engine instance.
78 
79  /// The target being compiled for.
81 
82  /// Auxiliary Target info.
84 
85  /// The file manager.
87 
88  /// The source manager.
90 
91  /// The cache of PCM files.
93 
94  /// The preprocessor.
95  std::shared_ptr<Preprocessor> PP;
96 
97  /// The AST context.
99 
100  /// An optional sema source that will be attached to sema.
102 
103  /// The AST consumer.
104  std::unique_ptr<ASTConsumer> Consumer;
105 
106  /// The code completion consumer.
107  std::unique_ptr<CodeCompleteConsumer> CompletionConsumer;
108 
109  /// The semantic analysis object.
110  std::unique_ptr<Sema> TheSema;
111 
112  /// The frontend timer group.
113  std::unique_ptr<llvm::TimerGroup> FrontendTimerGroup;
114 
115  /// The frontend timer.
116  std::unique_ptr<llvm::Timer> FrontendTimer;
117 
118  /// The ASTReader, if one exists.
119  IntrusiveRefCntPtr<ASTReader> TheASTReader;
120 
121  /// The module dependency collector for crashdumps
122  std::shared_ptr<ModuleDependencyCollector> ModuleDepCollector;
123 
124  /// The module provider.
125  std::shared_ptr<PCHContainerOperations> ThePCHContainerOperations;
126 
127  std::vector<std::shared_ptr<DependencyCollector>> DependencyCollectors;
128 
129  /// The set of top-level modules that has already been built on the
130  /// fly as part of this overall compilation action.
131  std::map<std::string, std::string, std::less<>> BuiltModules;
132 
133  /// Should we delete the BuiltModules when we're done?
134  bool DeleteBuiltModules = true;
135 
136  /// The location of the module-import keyword for the last module
137  /// import.
138  SourceLocation LastModuleImportLoc;
139 
140  /// The result of the last module import.
141  ///
142  ModuleLoadResult LastModuleImportResult;
143 
144  /// Whether we should (re)build the global module index once we
145  /// have finished with this translation unit.
146  bool BuildGlobalModuleIndex = false;
147 
148  /// We have a full global module index, with all modules.
149  bool HaveFullGlobalModuleIndex = false;
150 
151  /// One or more modules failed to build.
152  bool DisableGeneratingGlobalModuleIndex = false;
153 
154  /// The stream for verbose output if owned, otherwise nullptr.
155  std::unique_ptr<raw_ostream> OwnedVerboseOutputStream;
156 
157  /// The stream for verbose output.
158  raw_ostream *VerboseOutputStream = &llvm::errs();
159 
160  /// Holds information about the output file.
161  ///
162  /// If TempFilename is not empty we must rename it to Filename at the end.
163  /// TempFilename may be empty and Filename non-empty if creating the temporary
164  /// failed.
165  struct OutputFile {
168 
169  OutputFile(std::string filename, Optional<llvm::sys::fs::TempFile> file)
170  : Filename(std::move(filename)), File(std::move(file)) {}
171  };
172 
173  /// The list of active output files.
174  std::list<OutputFile> OutputFiles;
175 
176  /// Force an output buffer.
177  std::unique_ptr<llvm::raw_pwrite_stream> OutputStream;
178 
179  CompilerInstance(const CompilerInstance &) = delete;
180  void operator=(const CompilerInstance &) = delete;
181 public:
182  explicit CompilerInstance(
183  std::shared_ptr<PCHContainerOperations> PCHContainerOps =
184  std::make_shared<PCHContainerOperations>(),
185  InMemoryModuleCache *SharedModuleCache = nullptr);
186  ~CompilerInstance() override;
187 
188  /// @name High-Level Operations
189  /// {
190 
191  /// ExecuteAction - Execute the provided action against the compiler's
192  /// CompilerInvocation object.
193  ///
194  /// This function makes the following assumptions:
195  ///
196  /// - The invocation options should be initialized. This function does not
197  /// handle the '-help' or '-version' options, clients should handle those
198  /// directly.
199  ///
200  /// - The diagnostics engine should have already been created by the client.
201  ///
202  /// - No other CompilerInstance state should have been initialized (this is
203  /// an unchecked error).
204  ///
205  /// - Clients should have initialized any LLVM target features that may be
206  /// required.
207  ///
208  /// - Clients should eventually call llvm_shutdown() upon the completion of
209  /// this routine to ensure that any managed objects are properly destroyed.
210  ///
211  /// Note that this routine may write output to 'stderr'.
212  ///
213  /// \param Act - The action to execute.
214  /// \return - True on success.
215  //
216  // FIXME: Eliminate the llvm_shutdown requirement, that should either be part
217  // of the context or else not CompilerInstance specific.
218  bool ExecuteAction(FrontendAction &Act);
219 
220  /// Load the list of plugins requested in the \c FrontendOptions.
221  void LoadRequestedPlugins();
222 
223  /// }
224  /// @name Compiler Invocation and Options
225  /// {
226 
227  bool hasInvocation() const { return Invocation != nullptr; }
228 
230  assert(Invocation && "Compiler instance has no invocation!");
231  return *Invocation;
232  }
233 
234  /// setInvocation - Replace the current invocation.
235  void setInvocation(std::shared_ptr<CompilerInvocation> Value);
236 
237  /// Indicates whether we should (re)build the global module index.
238  bool shouldBuildGlobalModuleIndex() const;
239 
240  /// Set the flag indicating whether we should (re)build the global
241  /// module index.
242  void setBuildGlobalModuleIndex(bool Build) {
243  BuildGlobalModuleIndex = Build;
244  }
245 
246  /// }
247  /// @name Forwarding Methods
248  /// {
249 
251  return Invocation->getAnalyzerOpts();
252  }
253 
255  return Invocation->getCodeGenOpts();
256  }
258  return Invocation->getCodeGenOpts();
259  }
260 
262  return Invocation->getDependencyOutputOpts();
263  }
265  return Invocation->getDependencyOutputOpts();
266  }
267 
269  return Invocation->getDiagnosticOpts();
270  }
272  return Invocation->getDiagnosticOpts();
273  }
274 
276  return Invocation->getFileSystemOpts();
277  }
279  return Invocation->getFileSystemOpts();
280  }
281 
283  return Invocation->getFrontendOpts();
284  }
286  return Invocation->getFrontendOpts();
287  }
288 
290  return Invocation->getHeaderSearchOpts();
291  }
293  return Invocation->getHeaderSearchOpts();
294  }
295  std::shared_ptr<HeaderSearchOptions> getHeaderSearchOptsPtr() const {
296  return Invocation->getHeaderSearchOptsPtr();
297  }
298 
300  return *Invocation->getLangOpts();
301  }
302  const LangOptions &getLangOpts() const {
303  return *Invocation->getLangOpts();
304  }
305 
307  return Invocation->getPreprocessorOpts();
308  }
310  return Invocation->getPreprocessorOpts();
311  }
312 
314  return Invocation->getPreprocessorOutputOpts();
315  }
317  return Invocation->getPreprocessorOutputOpts();
318  }
319 
321  return Invocation->getTargetOpts();
322  }
323  const TargetOptions &getTargetOpts() const {
324  return Invocation->getTargetOpts();
325  }
326 
327  /// }
328  /// @name Diagnostics Engine
329  /// {
330 
331  bool hasDiagnostics() const { return Diagnostics != nullptr; }
332 
333  /// Get the current diagnostics engine.
335  assert(Diagnostics && "Compiler instance has no diagnostics!");
336  return *Diagnostics;
337  }
338 
339  /// setDiagnostics - Replace the current diagnostics engine.
341 
343  assert(Diagnostics && Diagnostics->getClient() &&
344  "Compiler instance has no diagnostic client!");
345  return *Diagnostics->getClient();
346  }
347 
348  /// }
349  /// @name VerboseOutputStream
350  /// }
351 
352  /// Replace the current stream for verbose output.
353  void setVerboseOutputStream(raw_ostream &Value);
354 
355  /// Replace the current stream for verbose output.
356  void setVerboseOutputStream(std::unique_ptr<raw_ostream> Value);
357 
358  /// Get the current stream for verbose output.
359  raw_ostream &getVerboseOutputStream() {
360  return *VerboseOutputStream;
361  }
362 
363  /// }
364  /// @name Target Info
365  /// {
366 
367  bool hasTarget() const { return Target != nullptr; }
368 
370  assert(Target && "Compiler instance has no target!");
371  return *Target;
372  }
373 
374  /// Replace the current Target.
375  void setTarget(TargetInfo *Value);
376 
377  /// }
378  /// @name AuxTarget Info
379  /// {
380 
381  TargetInfo *getAuxTarget() const { return AuxTarget.get(); }
382 
383  /// Replace the current AuxTarget.
385 
386  // Create Target and AuxTarget based on current options
387  bool createTarget();
388 
389  /// }
390  /// @name Virtual File System
391  /// {
392 
393  llvm::vfs::FileSystem &getVirtualFileSystem() const;
394 
395  /// }
396  /// @name File Manager
397  /// {
398 
399  bool hasFileManager() const { return FileMgr != nullptr; }
400 
401  /// Return the current file manager to the caller.
403  assert(FileMgr && "Compiler instance has no file manager!");
404  return *FileMgr;
405  }
406 
408  llvm::BuryPointer(FileMgr.get());
409  FileMgr.resetWithoutRelease();
410  }
411 
412  /// Replace the current file manager and virtual file system.
414 
415  /// }
416  /// @name Source Manager
417  /// {
418 
419  bool hasSourceManager() const { return SourceMgr != nullptr; }
420 
421  /// Return the current source manager.
423  assert(SourceMgr && "Compiler instance has no source manager!");
424  return *SourceMgr;
425  }
426 
428  llvm::BuryPointer(SourceMgr.get());
429  SourceMgr.resetWithoutRelease();
430  }
431 
432  /// setSourceManager - Replace the current source manager.
434 
435  /// }
436  /// @name Preprocessor
437  /// {
438 
439  bool hasPreprocessor() const { return PP != nullptr; }
440 
441  /// Return the current preprocessor.
443  assert(PP && "Compiler instance has no preprocessor!");
444  return *PP;
445  }
446 
447  std::shared_ptr<Preprocessor> getPreprocessorPtr() { return PP; }
448 
450  llvm::BuryPointer(new std::shared_ptr<Preprocessor>(PP));
451  }
452 
453  /// Replace the current preprocessor.
454  void setPreprocessor(std::shared_ptr<Preprocessor> Value);
455 
456  /// }
457  /// @name ASTContext
458  /// {
459 
460  bool hasASTContext() const { return Context != nullptr; }
461 
463  assert(Context && "Compiler instance has no AST context!");
464  return *Context;
465  }
466 
468  llvm::BuryPointer(Context.get());
469  Context.resetWithoutRelease();
470  }
471 
472  /// setASTContext - Replace the current AST context.
474 
475  /// Replace the current Sema; the compiler instance takes ownership
476  /// of S.
477  void setSema(Sema *S);
478 
479  /// }
480  /// @name ASTConsumer
481  /// {
482 
483  bool hasASTConsumer() const { return (bool)Consumer; }
484 
486  assert(Consumer && "Compiler instance has no AST consumer!");
487  return *Consumer;
488  }
489 
490  /// takeASTConsumer - Remove the current AST consumer and give ownership to
491  /// the caller.
492  std::unique_ptr<ASTConsumer> takeASTConsumer() { return std::move(Consumer); }
493 
494  /// setASTConsumer - Replace the current AST consumer; the compiler instance
495  /// takes ownership of \p Value.
496  void setASTConsumer(std::unique_ptr<ASTConsumer> Value);
497 
498  /// }
499  /// @name Semantic analysis
500  /// {
501  bool hasSema() const { return (bool)TheSema; }
502 
503  Sema &getSema() const {
504  assert(TheSema && "Compiler instance has no Sema object!");
505  return *TheSema;
506  }
507 
508  std::unique_ptr<Sema> takeSema();
509  void resetAndLeakSema();
510 
511  /// }
512  /// @name Module Management
513  /// {
514 
517 
518  std::shared_ptr<ModuleDependencyCollector> getModuleDepCollector() const;
520  std::shared_ptr<ModuleDependencyCollector> Collector);
521 
522  std::shared_ptr<PCHContainerOperations> getPCHContainerOperations() const {
523  return ThePCHContainerOperations;
524  }
525 
526  /// Return the appropriate PCHContainerWriter depending on the
527  /// current CodeGenOptions.
529  assert(Invocation && "cannot determine module format without invocation");
530  StringRef Format = getHeaderSearchOpts().ModuleFormat;
531  auto *Writer = ThePCHContainerOperations->getWriterOrNull(Format);
532  if (!Writer) {
533  if (Diagnostics)
534  Diagnostics->Report(diag::err_module_format_unhandled) << Format;
535  llvm::report_fatal_error("unknown module format");
536  }
537  return *Writer;
538  }
539 
540  /// Return the appropriate PCHContainerReader depending on the
541  /// current CodeGenOptions.
543  assert(Invocation && "cannot determine module format without invocation");
544  StringRef Format = getHeaderSearchOpts().ModuleFormat;
545  auto *Reader = ThePCHContainerOperations->getReaderOrNull(Format);
546  if (!Reader) {
547  if (Diagnostics)
548  Diagnostics->Report(diag::err_module_format_unhandled) << Format;
549  llvm::report_fatal_error("unknown module format");
550  }
551  return *Reader;
552  }
553 
554  /// }
555  /// @name Code Completion
556  /// {
557 
558  bool hasCodeCompletionConsumer() const { return (bool)CompletionConsumer; }
559 
561  assert(CompletionConsumer &&
562  "Compiler instance has no code completion consumer!");
563  return *CompletionConsumer;
564  }
565 
566  /// setCodeCompletionConsumer - Replace the current code completion consumer;
567  /// the compiler instance takes ownership of \p Value.
569 
570  /// }
571  /// @name Frontend timer
572  /// {
573 
574  bool hasFrontendTimer() const { return (bool)FrontendTimer; }
575 
576  llvm::Timer &getFrontendTimer() const {
577  assert(FrontendTimer && "Compiler instance has no frontend timer!");
578  return *FrontendTimer;
579  }
580 
581  /// }
582  /// @name Output Files
583  /// {
584 
585  /// clearOutputFiles - Clear the output file list. The underlying output
586  /// streams must have been closed beforehand.
587  ///
588  /// \param EraseFiles - If true, attempt to erase the files from disk.
589  void clearOutputFiles(bool EraseFiles);
590 
591  /// }
592  /// @name Construction Utility Methods
593  /// {
594 
595  /// Create the diagnostics engine using the invocation's diagnostic options
596  /// and replace any existing one with it.
597  ///
598  /// Note that this routine also replaces the diagnostic client,
599  /// allocating one if one is not provided.
600  ///
601  /// \param Client If non-NULL, a diagnostic client that will be
602  /// attached to (and, then, owned by) the DiagnosticsEngine inside this AST
603  /// unit.
604  ///
605  /// \param ShouldOwnClient If Client is non-NULL, specifies whether
606  /// the diagnostic object should take ownership of the client.
607  void createDiagnostics(DiagnosticConsumer *Client = nullptr,
608  bool ShouldOwnClient = true);
609 
610  /// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
611  ///
612  /// If no diagnostic client is provided, this creates a
613  /// DiagnosticConsumer that is owned by the returned diagnostic
614  /// object, if using directly the caller is responsible for
615  /// releasing the returned DiagnosticsEngine's client eventually.
616  ///
617  /// \param Opts - The diagnostic options; note that the created text
618  /// diagnostic object contains a reference to these options.
619  ///
620  /// \param Client If non-NULL, a diagnostic client that will be
621  /// attached to (and, then, owned by) the returned DiagnosticsEngine
622  /// object.
623  ///
624  /// \param CodeGenOpts If non-NULL, the code gen options in use, which may be
625  /// used by some diagnostics printers (for logging purposes only).
626  ///
627  /// \return The new object on success, or null on failure.
630  DiagnosticConsumer *Client = nullptr,
631  bool ShouldOwnClient = true,
632  const CodeGenOptions *CodeGenOpts = nullptr);
633 
634  /// Create the file manager and replace any existing one with it.
635  ///
636  /// \return The new file manager on success, or null on failure.
637  FileManager *
639 
640  /// Create the source manager and replace any existing one with it.
641  void createSourceManager(FileManager &FileMgr);
642 
643  /// Create the preprocessor, using the invocation, file, and source managers,
644  /// and replace any existing one with it.
646 
647  std::string getSpecificModuleCachePath(StringRef ModuleHash);
649  return getSpecificModuleCachePath(getInvocation().getModuleHash());
650  }
651 
652  /// Create the AST context.
653  void createASTContext();
654 
655  /// Create an external AST source to read a PCH file and attach it to the AST
656  /// context.
658  StringRef Path, DisableValidationForModuleKind DisableValidation,
659  bool AllowPCHWithCompilerErrors, void *DeserializationListener,
660  bool OwnDeserializationListener);
661 
662  /// Create an external AST source to read a PCH file.
663  ///
664  /// \return - The new object on success, or null on failure.
666  StringRef Path, StringRef Sysroot,
667  DisableValidationForModuleKind DisableValidation,
668  bool AllowPCHWithCompilerErrors, Preprocessor &PP,
669  InMemoryModuleCache &ModuleCache, ASTContext &Context,
670  const PCHContainerReader &PCHContainerRdr,
671  ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
672  ArrayRef<std::shared_ptr<DependencyCollector>> DependencyCollectors,
673  void *DeserializationListener, bool OwnDeserializationListener,
674  bool Preamble, bool UseGlobalModuleIndex);
675 
676  /// Create a code completion consumer using the invocation; note that this
677  /// will cause the source manager to truncate the input source file at the
678  /// completion point.
680 
681  /// Create a code completion consumer to print code completion results, at
682  /// \p Filename, \p Line, and \p Column, to the given output stream \p OS.
684  Preprocessor &PP, StringRef Filename, unsigned Line, unsigned Column,
685  const CodeCompleteOptions &Opts, raw_ostream &OS);
686 
687  /// Create the Sema object to be used for parsing.
688  void createSema(TranslationUnitKind TUKind,
689  CodeCompleteConsumer *CompletionConsumer);
690 
691  /// Create the frontend timer and replace any existing one with it.
692  void createFrontendTimer();
693 
694  /// Create the default output file (from the invocation's options) and add it
695  /// to the list of tracked output files.
696  ///
697  /// The files created by this are usually removed on signal, and, depending
698  /// on FrontendOptions, may also use a temporary file (that is, the data is
699  /// written to a temporary file which will atomically replace the target
700  /// output on success).
701  ///
702  /// \return - Null on error.
703  std::unique_ptr<raw_pwrite_stream> createDefaultOutputFile(
704  bool Binary = true, StringRef BaseInput = "", StringRef Extension = "",
705  bool RemoveFileOnSignal = true, bool CreateMissingDirectories = false,
706  bool ForceUseTemporary = false);
707 
708  /// Create a new output file, optionally deriving the output path name, and
709  /// add it to the list of tracked output files.
710  ///
711  /// \return - Null on error.
712  std::unique_ptr<raw_pwrite_stream>
713  createOutputFile(StringRef OutputPath, bool Binary, bool RemoveFileOnSignal,
714  bool UseTemporary, bool CreateMissingDirectories = false);
715 
716 private:
717  /// Create a new output file and add it to the list of tracked output files.
718  ///
719  /// If \p OutputPath is empty, then createOutputFile will derive an output
720  /// path location as \p BaseInput, with any suffix removed, and \p Extension
721  /// appended. If \p OutputPath is not stdout and \p UseTemporary
722  /// is true, createOutputFile will create a new temporary file that must be
723  /// renamed to \p OutputPath in the end.
724  ///
725  /// \param OutputPath - If given, the path to the output file.
726  /// \param Binary - The mode to open the file in.
727  /// \param RemoveFileOnSignal - Whether the file should be registered with
728  /// llvm::sys::RemoveFileOnSignal. Note that this is not safe for
729  /// multithreaded use, as the underlying signal mechanism is not reentrant
730  /// \param UseTemporary - Create a new temporary file that must be renamed to
731  /// OutputPath in the end.
732  /// \param CreateMissingDirectories - When \p UseTemporary is true, create
733  /// missing directories in the output path.
735  createOutputFileImpl(StringRef OutputPath, bool Binary,
736  bool RemoveFileOnSignal, bool UseTemporary,
737  bool CreateMissingDirectories);
738 
739 public:
740  std::unique_ptr<raw_pwrite_stream> createNullOutputFile();
741 
742  /// }
743  /// @name Initialization Utility Methods
744  /// {
745 
746  /// InitializeSourceManager - Initialize the source manager to set InputFile
747  /// as the main file.
748  ///
749  /// \return True on success.
750  bool InitializeSourceManager(const FrontendInputFile &Input);
751 
752  /// InitializeSourceManager - Initialize the source manager to set InputFile
753  /// as the main file.
754  ///
755  /// \return True on success.
756  static bool InitializeSourceManager(const FrontendInputFile &Input,
757  DiagnosticsEngine &Diags,
758  FileManager &FileMgr,
759  SourceManager &SourceMgr);
760 
761  /// }
762 
763  void setOutputStream(std::unique_ptr<llvm::raw_pwrite_stream> OutStream) {
764  OutputStream = std::move(OutStream);
765  }
766 
767  std::unique_ptr<llvm::raw_pwrite_stream> takeOutputStream() {
768  return std::move(OutputStream);
769  }
770 
771  void createASTReader();
772 
773  bool loadModuleFile(StringRef FileName);
774 
775 private:
776  /// Find a module, potentially compiling it, before reading its AST. This is
777  /// the guts of loadModule.
778  ///
779  /// For prebuilt modules, the Module is not expected to exist in
780  /// HeaderSearch's ModuleMap. If a ModuleFile by that name is in the
781  /// ModuleManager, then it will be loaded and looked up.
782  ///
783  /// For implicit modules, the Module is expected to already be in the
784  /// ModuleMap. First attempt to load it from the given path on disk. If that
785  /// fails, defer to compileModuleAndReadAST, which will first build and then
786  /// load it.
787  ModuleLoadResult findOrCompileModuleAndReadAST(StringRef ModuleName,
788  SourceLocation ImportLoc,
789  SourceLocation ModuleNameLoc,
790  bool IsInclusionDirective);
791 
792 public:
795  bool IsInclusionDirective) override;
796 
797  void createModuleFromSource(SourceLocation ImportLoc, StringRef ModuleName,
798  StringRef Source) override;
799 
801  SourceLocation ImportLoc) override;
802 
805  }
806 
808 
809  bool lookupMissingImports(StringRef Name, SourceLocation TriggerLoc) override;
810 
811  void addDependencyCollector(std::shared_ptr<DependencyCollector> Listener) {
812  DependencyCollectors.push_back(std::move(Listener));
813  }
814 
816 
817  InMemoryModuleCache &getModuleCache() const { return *ModuleCache; }
818 };
819 
820 } // end namespace clang
821 
822 #endif
clang::CompilerInstance::setASTConsumer
void setASTConsumer(std::unique_ptr< ASTConsumer > Value)
setASTConsumer - Replace the current AST consumer; the compiler instance takes ownership of Value.
Definition: CompilerInstance.cpp:184
clang::DependencyOutputOptions
DependencyOutputOptions - Options for controlling the compiler dependency file generation.
Definition: DependencyOutputOptions.h:33
clang::CompilerInstance::hasSema
bool hasSema() const
Definition: CompilerInstance.h:501
clang::CompilerInstance::setBuildGlobalModuleIndex
void setBuildGlobalModuleIndex(bool Build)
Set the flag indicating whether we should (re)build the global module index.
Definition: CompilerInstance.h:242
clang::GlobalModuleIndex
A global index for a set of module files, providing information about the identifiers within those mo...
Definition: GlobalModuleIndex.h:54
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::CompilerInstance::getHeaderSearchOpts
const HeaderSearchOptions & getHeaderSearchOpts() const
Definition: CompilerInstance.h:292
clang::ModuleLoadResult
Describes the result of attempting to load a module.
Definition: ModuleLoader.h:35
clang::CompilerInstance::hasASTConsumer
bool hasASTConsumer() const
Definition: CompilerInstance.h:483
clang::CompilerInstance::getPreprocessorOutputOpts
PreprocessorOutputOptions & getPreprocessorOutputOpts()
Definition: CompilerInstance.h:313
clang::CompilerInstance::getPreprocessorOpts
const PreprocessorOptions & getPreprocessorOpts() const
Definition: CompilerInstance.h:309
clang::DeclaratorContext::File
@ File
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::PreprocessorOptions
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
Definition: PreprocessorOptions.h:64
clang::CompilerInstance::getPreprocessorOutputOpts
const PreprocessorOutputOptions & getPreprocessorOutputOpts() const
Definition: CompilerInstance.h:316
clang::CompilerInstance::getPreprocessorPtr
std::shared_ptr< Preprocessor > getPreprocessorPtr()
Definition: CompilerInstance.h:447
clang::CompilerInstance::loadGlobalModuleIndex
GlobalModuleIndex * loadGlobalModuleIndex(SourceLocation TriggerLoc) override
Load, create, or return global module.
Definition: CompilerInstance.cpp:2184
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::CompilerInstance::setSema
void setSema(Sema *S)
Replace the current Sema; the compiler instance takes ownership of S.
Definition: CompilerInstance.cpp:180
clang::MultiVersionKind::Target
@ Target
clang::CompilerInstance::makeModuleVisible
void makeModuleVisible(Module *Mod, Module::NameVisibilityKind Visibility, SourceLocation ImportLoc) override
Make the given module visible.
Definition: CompilerInstance.cpp:2173
clang::DiagnosticConsumer
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed...
Definition: Diagnostic.h:1722
clang::CompilerInstance::setModuleDepCollector
void setModuleDepCollector(std::shared_ptr< ModuleDependencyCollector > Collector)
Definition: CompilerInstance.cpp:213
clang::CompilerInstance::lookupMissingImports
bool lookupMissingImports(StringRef Name, SourceLocation TriggerLoc) override
Check global module index for missing imports.
Definition: CompilerInstance.cpp:2254
clang::CompilerInstance::InitializeSourceManager
bool InitializeSourceManager(const FrontendInputFile &Input)
InitializeSourceManager - Initialize the source manager to set InputFile as the main file.
Definition: CompilerInstance.cpp:940
clang::CompilerInstance::getLangOpts
LangOptions & getLangOpts()
Definition: CompilerInstance.h:299
Filename
StringRef Filename
Definition: Format.cpp:2429
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:191
clang::CompilerInstance::createOutputFile
std::unique_ptr< raw_pwrite_stream > createOutputFile(StringRef OutputPath, bool Binary, bool RemoveFileOnSignal, bool UseTemporary, bool CreateMissingDirectories=false)
Create a new output file, optionally deriving the output path name, and add it to the list of tracked...
Definition: CompilerInstance.cpp:827
clang::CompilerInstance::hasFrontendTimer
bool hasFrontendTimer() const
Definition: CompilerInstance.h:574
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:186
clang::FrontendInputFile
An input file for the front end.
Definition: FrontendOptions.h:185
clang::Module::NameVisibilityKind
NameVisibilityKind
Describes the visibility of the various names within a particular module.
Definition: Module.h:316
llvm::Optional< llvm::sys::fs::TempFile >
clang::ModuleLoader::HadFatalFailure
bool HadFatalFailure
Definition: ModuleLoader.h:157
SourceManager.h
clang::CompilerInstance::getFileSystemOpts
FileSystemOptions & getFileSystemOpts()
Definition: CompilerInstance.h:275
llvm::Expected
Definition: LLVM.h:41
clang::CompilerInstance::getAnalyzerOpts
AnalyzerOptionsRef getAnalyzerOpts()
Definition: CompilerInstance.h:250
clang::CompilerInstance::getCodeGenOpts
CodeGenOptions & getCodeGenOpts()
Definition: CompilerInstance.h:254
clang::CompilerInstance::getPCHContainerReader
const PCHContainerReader & getPCHContainerReader() const
Return the appropriate PCHContainerReader depending on the current CodeGenOptions.
Definition: CompilerInstance.h:542
clang::CompilerInstance::createCodeCompletionConsumer
void createCodeCompletionConsumer()
Create a code completion consumer using the invocation; note that this will cause the source manager ...
Definition: CompilerInstance.cpp:709
clang::CompilerInstance::setAuxTarget
void setAuxTarget(TargetInfo *Value)
Replace the current AuxTarget.
Definition: CompilerInstance.cpp:99
CompilerInvocation.h
clang::PCHContainerReader
This abstract interface provides operations for unwrapping containers for serialized ASTs (precompile...
Definition: PCHContainerOperations.h:55
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:626
clang::CompilerInstance::setExternalSemaSource
void setExternalSemaSource(IntrusiveRefCntPtr< ExternalSemaSource > ESS)
Definition: CompilerInstance.cpp:2279
clang::CompilerInstance::resetAndLeakSourceManager
void resetAndLeakSourceManager()
Definition: CompilerInstance.h:427
clang::FileSystemOptions
Keeps track of options that affect how file operations are performed.
Definition: FileSystemOptions.h:22
clang::CompilerInstance::getFileManager
FileManager & getFileManager() const
Return the current file manager to the caller.
Definition: CompilerInstance.h:402
clang::CompilerInstance::createDiagnostics
void createDiagnostics(DiagnosticConsumer *Client=nullptr, bool ShouldOwnClient=true)
Create the diagnostics engine using the invocation's diagnostic options and replace any existing one ...
Definition: CompilerInstance.cpp:329
clang::Module
Describes a module or submodule.
Definition: Module.h:96
clang::PreprocessorOutputOptions
PreprocessorOutputOptions - Options for controlling the C preprocessor output (e.g....
Definition: PreprocessorOutputOptions.h:16
HeaderSearchOptions.h
clang::CompilerInstance::setOutputStream
void setOutputStream(std::unique_ptr< llvm::raw_pwrite_stream > OutStream)
}
Definition: CompilerInstance.h:763
clang::CompilerInstance::resetAndLeakFileManager
void resetAndLeakFileManager()
Definition: CompilerInstance.h:407
clang::CompilerInstance::createNullOutputFile
std::unique_ptr< raw_pwrite_stream > createNullOutputFile()
Definition: CompilerInstance.cpp:822
clang::CompilerInstance::ExecuteAction
bool ExecuteAction(FrontendAction &Act)
ExecuteAction - Execute the provided action against the compiler's CompilerInvocation object.
Definition: CompilerInstance.cpp:989
clang::CompilerInstance::createASTReader
void createASTReader()
Definition: CompilerInstance.cpp:1632
clang::CompilerInstance::setDiagnostics
void setDiagnostics(DiagnosticsEngine *Value)
setDiagnostics - Replace the current diagnostics engine.
Definition: CompilerInstance.cpp:84
clang::index::SymbolKind::Module
@ Module
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:209
clang::CompilerInstance::getLangOpts
const LangOptions & getLangOpts() const
Definition: CompilerInstance.h:302
Diagnostic.h
clang::CompilerInstance::getSema
Sema & getSema() const
Definition: CompilerInstance.h:503
clang::FrontendOptions
FrontendOptions - Options for controlling the behavior of the frontend.
Definition: FrontendOptions.h:228
clang::PCHContainerWriter
This abstract interface provides operations for creating containers for serialized ASTs (precompiled ...
Definition: PCHContainerOperations.h:36
Utils.h
clang::ASTConsumer
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Definition: ASTConsumer.h:33
ModuleLoader.h
clang::DisableValidationForModuleKind
DisableValidationForModuleKind
Whether to disable the normal validation performed on precompiled headers and module files when they ...
Definition: PreprocessorOptions.h:46
clang::HeaderSearchOptions::ModuleFormat
std::string ModuleFormat
The module/pch container format.
Definition: HeaderSearchOptions.h:125
clang::CompilerInstance::getDependencyOutputOpts
DependencyOutputOptions & getDependencyOutputOpts()
Definition: CompilerInstance.h:261
clang::CompilerInstance::getFrontendOpts
const FrontendOptions & getFrontendOpts() const
Definition: CompilerInstance.h:285
clang::CompilerInstance::resetAndLeakPreprocessor
void resetAndLeakPreprocessor()
Definition: CompilerInstance.h:449
clang::CompilerInstance::addDependencyCollector
void addDependencyCollector(std::shared_ptr< DependencyCollector > Listener)
Definition: CompilerInstance.h:811
clang::CompilerInstance::getSpecificModuleCachePath
std::string getSpecificModuleCachePath()
Definition: CompilerInstance.h:648
clang::CompilerInstance::getPreprocessor
Preprocessor & getPreprocessor() const
Return the current preprocessor.
Definition: CompilerInstance.h:442
clang::CompilerInstance::getASTContext
ASTContext & getASTContext() const
Definition: CompilerInstance.h:462
clang::CompilerInstance::hasFileManager
bool hasFileManager() const
Definition: CompilerInstance.h:399
Line
const AnnotatedLine * Line
Definition: UsingDeclarationsSorter.cpp:68
clang::CompilerInstance
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
Definition: CompilerInstance.h:72
clang::CodeGenOptions
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Definition: CodeGenOptions.h:49
clang::CompilerInstance::getPreprocessorOpts
PreprocessorOptions & getPreprocessorOpts()
Definition: CompilerInstance.h:306
clang::CompilerInstance::setInvocation
void setInvocation(std::shared_ptr< CompilerInvocation > Value)
setInvocation - Replace the current invocation.
Definition: CompilerInstance.cpp:72
clang::CompilerInstance::getPCHContainerOperations
std::shared_ptr< PCHContainerOperations > getPCHContainerOperations() const
Definition: CompilerInstance.h:522
clang::CompilerInstance::hasTarget
bool hasTarget() const
Definition: CompilerInstance.h:367
clang::Visibility
Visibility
Describes the different kinds of visibility that a declaration may have.
Definition: Visibility.h:33
clang::CompilerInstance::takeOutputStream
std::unique_ptr< llvm::raw_pwrite_stream > takeOutputStream()
Definition: CompilerInstance.h:767
clang::CompilerInstance::setPreprocessor
void setPreprocessor(std::shared_ptr< Preprocessor > Value)
Replace the current preprocessor.
Definition: CompilerInstance.cpp:169
clang::CompilerInstance::setASTReader
void setASTReader(IntrusiveRefCntPtr< ASTReader > Reader)
Definition: CompilerInstance.cpp:202
clang::CompilerInstance::getModuleCache
InMemoryModuleCache & getModuleCache() const
Definition: CompilerInstance.h:817
clang::CompilerInstance::getCodeGenOpts
const CodeGenOptions & getCodeGenOpts() const
Definition: CompilerInstance.h:257
clang::CompilerInstance::getTargetOpts
TargetOptions & getTargetOpts()
Definition: CompilerInstance.h:320
clang::CompilerInstance::takeASTConsumer
std::unique_ptr< ASTConsumer > takeASTConsumer()
takeASTConsumer - Remove the current AST consumer and give ownership to the caller.
Definition: CompilerInstance.h:492
clang::CompilerInstance::loadModuleFile
bool loadModuleFile(StringRef FileName)
Definition: CompilerInstance.cpp:1683
clang::CompilerInstance::getDependencyOutputOpts
const DependencyOutputOptions & getDependencyOutputOpts() const
Definition: CompilerInstance.h:264
clang::CompilerInstance::getDiagnosticClient
DiagnosticConsumer & getDiagnosticClient() const
Definition: CompilerInstance.h:342
clang::CompilerInstance::hasPreprocessor
bool hasPreprocessor() const
Definition: CompilerInstance.h:439
clang::CompilerInstance::setCodeCompletionConsumer
void setCodeCompletionConsumer(CodeCompleteConsumer *Value)
setCodeCompletionConsumer - Replace the current code completion consumer; the compiler instance takes...
Definition: CompilerInstance.cpp:191
clang::CompilerInstance::getVirtualFileSystem
llvm::vfs::FileSystem & getVirtualFileSystem() const
Definition: CompilerInstance.cpp:157
clang::CompilerInstance::hasCodeCompletionConsumer
bool hasCodeCompletionConsumer() const
Definition: CompilerInstance.h:558
llvm::ArrayRef
Definition: LLVM.h:34
Value
Value
Definition: UninitializedValues.cpp:102
clang::CompilerInstance::getInvocation
CompilerInvocation & getInvocation()
Definition: CompilerInstance.h:229
clang::CompilerInstance::getFrontendTimer
llvm::Timer & getFrontendTimer() const
Definition: CompilerInstance.h:576
clang::CompilerInstance::hasDiagnostics
bool hasDiagnostics() const
Definition: CompilerInstance.h:331
clang::CompilerInstance::getPCHContainerWriter
const PCHContainerWriter & getPCHContainerWriter() const
Return the appropriate PCHContainerWriter depending on the current CodeGenOptions.
Definition: CompilerInstance.h:528
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:354
clang::CompilerInstance::hadModuleLoaderFatalFailure
bool hadModuleLoaderFatalFailure() const
Definition: CompilerInstance.h:803
clang::CodeCompleteConsumer
Abstract interface for a consumer of code-completion information.
Definition: CodeCompleteConsumer.h:1000
clang::CompilerInstance::getASTConsumer
ASTConsumer & getASTConsumer() const
Definition: CompilerInstance.h:485
ASTConsumer.h
clang::CompilerInstance::createModuleFromSource
void createModuleFromSource(SourceLocation ImportLoc, StringRef ModuleName, StringRef Source) override
Attempt to create the given module from the specified source buffer.
Definition: CompilerInstance.cpp:2121
clang::CompilerInstance::resetAndLeakASTContext
void resetAndLeakASTContext()
Definition: CompilerInstance.h:467
clang::CompilerInstance::getTargetOpts
const TargetOptions & getTargetOpts() const
Definition: CompilerInstance.h:323
clang::CompilerInstance::hasSourceManager
bool hasSourceManager() const
Definition: CompilerInstance.h:419
PCHContainerOperations.h
clang::ModuleLoader
Abstract interface for a module loader.
Definition: ModuleLoader.h:77
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:58
clang::CompilerInstance::getAuxTarget
TargetInfo * getAuxTarget() const
Definition: CompilerInstance.h:381
clang::TranslationUnitKind
TranslationUnitKind
Describes the kind of translation unit being processed.
Definition: LangOptions.h:704
clang::CompilerInstance::getTarget
TargetInfo & getTarget() const
Definition: CompilerInstance.h:369
clang::FrontendAction
Abstract base class for actions which can be performed by the frontend.
Definition: FrontendAction.h:36
clang::CompilerInstance::getDiagnosticOpts
DiagnosticOptions & getDiagnosticOpts()
Definition: CompilerInstance.h:268
clang
Definition: CalledOnceCheck.h:17
clang::FileManager
Implements support for file system lookup, file system caching, and directory search management.
Definition: FileManager.h:53
clang::CompilerInstance::createFrontendTimer
void createFrontendTimer()
Create the frontend timer and replace any existing one with it.
Definition: CompilerInstance.cpp:726
clang::CompilerInstance::resetAndLeakSema
void resetAndLeakSema()
Definition: CompilerInstance.cpp:2277
clang::CompilerInstance::createDefaultOutputFile
std::unique_ptr< raw_pwrite_stream > createDefaultOutputFile(bool Binary=true, StringRef BaseInput="", StringRef Extension="", bool RemoveFileOnSignal=true, bool CreateMissingDirectories=false, bool ForceUseTemporary=false)
Create the default output file (from the invocation's options) and add it to the list of tracked outp...
Definition: CompilerInstance.cpp:802
clang::CompilerInstance::setTarget
void setTarget(TargetInfo *Value)
Replace the current Target.
Definition: CompilerInstance.cpp:98
clang::CompilerInstance::getCodeCompletionConsumer
CodeCompleteConsumer & getCodeCompletionConsumer() const
Definition: CompilerInstance.h:560
clang::CompilerInvocation
Helper class for holding the data necessary to invoke the compiler.
Definition: CompilerInvocation.h:193
clang::CompilerInstance::createASTContext
void createASTContext()
Create the AST context.
Definition: CompilerInstance.cpp:551
clang::InMemoryModuleCache
In-memory cache for modules.
Definition: InMemoryModuleCache.h:30
clang::CompilerInstance::getVerboseOutputStream
raw_ostream & getVerboseOutputStream()
Get the current stream for verbose output.
Definition: CompilerInstance.h:359
clang::CompilerInstance::getFileSystemOpts
const FileSystemOptions & getFileSystemOpts() const
Definition: CompilerInstance.h:278
clang::CompilerInstance::setFileManager
void setFileManager(FileManager *Value)
Replace the current file manager and virtual file system.
Definition: CompilerInstance.cpp:161
clang::CodeCompleteOptions
Options controlling the behavior of code completion.
Definition: CodeCompleteOptions.h:15
clang::CompilerInstance::getFrontendOpts
FrontendOptions & getFrontendOpts()
Definition: CompilerInstance.h:282
clang::CompilerInstance::getASTReader
IntrusiveRefCntPtr< ASTReader > getASTReader() const
Definition: CompilerInstance.cpp:199
clang::CompilerInstance::setASTContext
void setASTContext(ASTContext *Value)
setASTContext - Replace the current AST context.
Definition: CompilerInstance.cpp:173
clang::CompilerInstance::loadModule
ModuleLoadResult loadModule(SourceLocation ImportLoc, ModuleIdPath Path, Module::NameVisibilityKind Visibility, bool IsInclusionDirective) override
Attempt to load the given module.
Definition: CompilerInstance.cpp:1935
clang::TargetOptions
Options for controlling the target.
Definition: TargetOptions.h:26
clang::CompilerInstance::getDiagnostics
DiagnosticsEngine & getDiagnostics() const
Get the current diagnostics engine.
Definition: CompilerInstance.h:334
clang::CompilerInstance::getSourceManager
SourceManager & getSourceManager() const
Return the current source manager.
Definition: CompilerInstance.h:422
clang::CompilerInstance::createFileManager
FileManager * createFileManager(IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS=nullptr)
Create the file manager and replace any existing one with it.
Definition: CompilerInstance.cpp:371
clang::CompilerInstance::getDiagnosticOpts
const DiagnosticOptions & getDiagnosticOpts() const
Definition: CompilerInstance.h:271
clang::CompilerInstance::createSema
void createSema(TranslationUnitKind TUKind, CodeCompleteConsumer *CompletionConsumer)
Create the Sema object to be used for parsing.
Definition: CompilerInstance.cpp:748
clang::Preprocessor
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:130
clang::CompilerInstance::setSourceManager
void setSourceManager(SourceManager *Value)
setSourceManager - Replace the current source manager.
Definition: CompilerInstance.cpp:165
clang::CompilerInstance::createPreprocessor
void createPreprocessor(TranslationUnitKind TUKind)
Create the preprocessor, using the invocation, file, and source managers, and replace any existing on...
Definition: CompilerInstance.cpp:446
clang::CompilerInstance::takeSema
std::unique_ptr< Sema > takeSema()
Definition: CompilerInstance.cpp:195
clang::CompilerInstance::~CompilerInstance
~CompilerInstance() override
Definition: CompilerInstance.cpp:68
clang::CompilerInstance::getModuleDepCollector
std::shared_ptr< ModuleDependencyCollector > getModuleDepCollector() const
Definition: CompilerInstance.cpp:209
clang::CompilerInstance::clearOutputFiles
void clearOutputFiles(bool EraseFiles)
clearOutputFiles - Clear the output file list.
Definition: CompilerInstance.cpp:761
clang::CompilerInstance::shouldBuildGlobalModuleIndex
bool shouldBuildGlobalModuleIndex() const
Indicates whether we should (re)build the global module index.
Definition: CompilerInstance.cpp:77
clang::CompilerInstance::createSourceManager
void createSourceManager(FileManager &FileMgr)
Create the source manager and replace any existing one with it.
Definition: CompilerInstance.cpp:384
clang::CompilerInstance::hasInvocation
bool hasInvocation() const
Definition: CompilerInstance.h:227
clang::CompilerInstance::getHeaderSearchOpts
HeaderSearchOptions & getHeaderSearchOpts()
Definition: CompilerInstance.h:289
clang::CompilerInstance::createPCHExternalASTSource
void createPCHExternalASTSource(StringRef Path, DisableValidationForModuleKind DisableValidation, bool AllowPCHWithCompilerErrors, void *DeserializationListener, bool OwnDeserializationListener)
Create an external AST source to read a PCH file and attach it to the AST context.
Definition: CompilerInstance.cpp:610
llvm::IntrusiveRefCntPtr
Definition: LLVM.h:47
clang::DiagnosticOptions
Options for controlling the compiler diagnostics engine.
Definition: DiagnosticOptions.h:70
clang::CompilerInstance::setVerboseOutputStream
void setVerboseOutputStream(raw_ostream &Value)
Replace the current stream for verbose output.
Definition: CompilerInstance.cpp:88
clang::CompilerInstance::LoadRequestedPlugins
void LoadRequestedPlugins()
Load the list of plugins requested in the FrontendOptions.
Definition: CompilerInstance.cpp:1088
clang::HeaderSearchOptions
HeaderSearchOptions - Helper class for storing options related to the initialization of the HeaderSea...
Definition: HeaderSearchOptions.h:68
clang::CompilerInstance::hasASTContext
bool hasASTContext() const
Definition: CompilerInstance.h:460
clang::CompilerInstance::createTarget
bool createTarget()
Definition: CompilerInstance.cpp:101
clang::CompilerInstance::getHeaderSearchOptsPtr
std::shared_ptr< HeaderSearchOptions > getHeaderSearchOptsPtr() const
Definition: CompilerInstance.h:295