diff options
Diffstat (limited to 'include/clang/Frontend/CompilerInstance.h')
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 78 |
1 files changed, 54 insertions, 24 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 8817740..1bb7695 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -11,13 +11,17 @@ #define LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_ #include "clang/Frontend/CompilerInvocation.h" +#include "clang/Basic/SourceManager.h" #include "clang/Lex/ModuleLoader.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/OwningPtr.h" #include <cassert> #include <list> #include <string> +#include <utility> namespace llvm { class raw_fd_ostream; @@ -32,8 +36,10 @@ class CodeCompleteConsumer; class DiagnosticsEngine; class DiagnosticConsumer; class ExternalASTSource; +class FileEntry; class FileManager; class FrontendAction; +class Module; class Preprocessor; class Sema; class SourceManager; @@ -59,41 +65,53 @@ class TargetInfo; /// and a long form that takes explicit instances of any required objects. class CompilerInstance : public ModuleLoader { /// The options used in this compiler instance. - llvm::IntrusiveRefCntPtr<CompilerInvocation> Invocation; + IntrusiveRefCntPtr<CompilerInvocation> Invocation; /// The diagnostics engine instance. - llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics; + IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics; /// The target being compiled for. - llvm::IntrusiveRefCntPtr<TargetInfo> Target; + IntrusiveRefCntPtr<TargetInfo> Target; /// The file manager. - llvm::IntrusiveRefCntPtr<FileManager> FileMgr; + IntrusiveRefCntPtr<FileManager> FileMgr; /// The source manager. - llvm::IntrusiveRefCntPtr<SourceManager> SourceMgr; + IntrusiveRefCntPtr<SourceManager> SourceMgr; /// The preprocessor. - llvm::IntrusiveRefCntPtr<Preprocessor> PP; + IntrusiveRefCntPtr<Preprocessor> PP; /// The AST context. - llvm::IntrusiveRefCntPtr<ASTContext> Context; + IntrusiveRefCntPtr<ASTContext> Context; /// The AST consumer. - llvm::OwningPtr<ASTConsumer> Consumer; + OwningPtr<ASTConsumer> Consumer; /// The code completion consumer. - llvm::OwningPtr<CodeCompleteConsumer> CompletionConsumer; + OwningPtr<CodeCompleteConsumer> CompletionConsumer; /// \brief The semantic analysis object. - llvm::OwningPtr<Sema> TheSema; + OwningPtr<Sema> TheSema; /// \brief The frontend timer - llvm::OwningPtr<llvm::Timer> FrontendTimer; + OwningPtr<llvm::Timer> FrontendTimer; /// \brief Non-owning reference to the ASTReader, if one exists. ASTReader *ModuleManager; + /// \brief The set of top-level modules that has already been loaded, + /// along with the module map + llvm::DenseMap<const IdentifierInfo *, Module *> KnownModules; + + /// \brief The location of the module-import keyword for the last module + /// import. + SourceLocation LastModuleImportLoc; + + /// \brief The result of the last module import. + /// + Module *LastModuleImportResult; + /// \brief Holds information about the output file. /// /// If TempFilename is not empty we must rename it to Filename at the end. @@ -218,10 +236,10 @@ public: } LangOptions &getLangOpts() { - return Invocation->getLangOpts(); + return *Invocation->getLangOpts(); } const LangOptions &getLangOpts() const { - return Invocation->getLangOpts(); + return *Invocation->getLangOpts(); } PreprocessorOptions &getPreprocessorOpts() { @@ -491,7 +509,7 @@ public: /// used by some diagnostics printers (for logging purposes only). /// /// \return The new object on success, or null on failure. - static llvm::IntrusiveRefCntPtr<DiagnosticsEngine> + static IntrusiveRefCntPtr<DiagnosticsEngine> createDiagnostics(const DiagnosticOptions &Opts, int Argc, const char* const *Argv, DiagnosticConsumer *Client = 0, @@ -517,6 +535,7 @@ public: void createPCHExternalASTSource(StringRef Path, bool DisablePCHValidation, bool DisableStatCache, + bool AllowPCHWithCompilerErrors, void *DeserializationListener); /// Create an external AST source to read a PCH file. @@ -526,6 +545,7 @@ public: createPCHExternalASTSource(StringRef Path, const std::string &Sysroot, bool DisablePCHValidation, bool DisableStatCache, + bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context, void *DeserializationListener, bool Preamble); @@ -554,6 +574,10 @@ public: /// Create the default output file (from the invocation's options) and add it /// to the list of tracked output files. /// + /// The files created by this function always use temporary files to write to + /// their result (that is, the data is written to a temporary file which will + /// atomically replace the target output on success). + /// /// \return - Null on error. llvm::raw_fd_ostream * createDefaultOutputFile(bool Binary = true, StringRef BaseInput = "", @@ -568,7 +592,8 @@ public: bool Binary = true, bool RemoveFileOnSignal = true, StringRef BaseInput = "", StringRef Extension = "", - bool UseTemporary = false); + bool UseTemporary = false, + bool CreateMissingDirectories = false); /// Create a new output file, optionally deriving the output path name. /// @@ -588,7 +613,9 @@ public: /// llvm::sys::RemoveFileOnSignal. Note that this is not safe for /// multithreaded use, as the underlying signal mechanism is not reentrant /// \param UseTemporary - Create a new temporary file that must be renamed to - /// OutputPath in the end + /// OutputPath in the end. + /// \param CreateMissingDirectories - When \arg UseTemporary is true, create + /// missing directories in the output path. /// \param ResultPathName [out] - If given, the result path name will be /// stored here on success. /// \param TempPathName [out] - If given, the temporary file path name @@ -599,6 +626,7 @@ public: StringRef BaseInput = "", StringRef Extension = "", bool UseTemporary = false, + bool CreateMissingDirectories = false, std::string *ResultPathName = 0, std::string *TempPathName = 0); @@ -610,23 +638,25 @@ public: /// as the main file. /// /// \return True on success. - bool InitializeSourceManager(StringRef InputFile); + bool InitializeSourceManager(StringRef InputFile, + SrcMgr::CharacteristicKind Kind = SrcMgr::C_User); /// InitializeSourceManager - Initialize the source manager to set InputFile /// as the main file. /// /// \return True on success. static bool InitializeSourceManager(StringRef InputFile, - DiagnosticsEngine &Diags, - FileManager &FileMgr, - SourceManager &SourceMgr, - const FrontendOptions &Opts); + SrcMgr::CharacteristicKind Kind, + DiagnosticsEngine &Diags, + FileManager &FileMgr, + SourceManager &SourceMgr, + const FrontendOptions &Opts); /// } - virtual ModuleKey loadModule(SourceLocation ImportLoc, - IdentifierInfo &ModuleName, - SourceLocation ModuleNameLoc); + virtual Module *loadModule(SourceLocation ImportLoc, ModuleIdPath Path, + Module::NameVisibilityKind Visibility, + bool IsInclusionDirective); }; } // end namespace clang |