From 50b73317314e889cf39c7b1d6cbf419fa7502f22 Mon Sep 17 00:00:00 2001 From: dim Date: Sat, 14 Apr 2012 14:01:31 +0000 Subject: Vendor import of clang trunk r154661: http://llvm.org/svn/llvm-project/cfe/trunk@r154661 --- include/clang/Frontend/CompilerInstance.h | 78 +++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 24 deletions(-) (limited to 'include/clang/Frontend/CompilerInstance.h') 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 #include #include +#include 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 Invocation; + IntrusiveRefCntPtr Invocation; /// The diagnostics engine instance. - llvm::IntrusiveRefCntPtr Diagnostics; + IntrusiveRefCntPtr Diagnostics; /// The target being compiled for. - llvm::IntrusiveRefCntPtr Target; + IntrusiveRefCntPtr Target; /// The file manager. - llvm::IntrusiveRefCntPtr FileMgr; + IntrusiveRefCntPtr FileMgr; /// The source manager. - llvm::IntrusiveRefCntPtr SourceMgr; + IntrusiveRefCntPtr SourceMgr; /// The preprocessor. - llvm::IntrusiveRefCntPtr PP; + IntrusiveRefCntPtr PP; /// The AST context. - llvm::IntrusiveRefCntPtr Context; + IntrusiveRefCntPtr Context; /// The AST consumer. - llvm::OwningPtr Consumer; + OwningPtr Consumer; /// The code completion consumer. - llvm::OwningPtr CompletionConsumer; + OwningPtr CompletionConsumer; /// \brief The semantic analysis object. - llvm::OwningPtr TheSema; + OwningPtr TheSema; /// \brief The frontend timer - llvm::OwningPtr FrontendTimer; + OwningPtr 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 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 + static IntrusiveRefCntPtr 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 -- cgit v1.1