diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-10-05 16:15:19 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-10-05 16:15:19 +0000 |
commit | 1d9f1fe7173e3084325f43c78af812a36d8a2a7c (patch) | |
tree | 62cc4283ca4e25e7c0a3c51f88c37d4586e01ffe /include/clang | |
parent | c3632730cc83ed7b51f0ab5c38997ae5a9439b0c (diff) |
Give every file that ASTReader loads a type: module, PCH, precompiled preamble or main file. Base Decls' PCHLevel on this to make it more sane.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 2 | ||||
-rw-r--r-- | include/clang/Serialization/ASTReader.h | 16 |
2 files changed, 14 insertions, 4 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index e1fc924dc7..800d5be068 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -534,7 +534,7 @@ public: createPCHExternalASTSource(llvm::StringRef Path, const std::string &Sysroot, bool DisablePCHValidation, Preprocessor &PP, ASTContext &Context, - void *DeserializationListener); + void *DeserializationListener, bool Preamble); /// Create a code completion consumer using the invocation; note that this /// will cause the source manager to truncate the input source file at the diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 79186c7ad7..c5dd186ceb 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -170,6 +170,13 @@ class ASTReader public ExternalSLocEntrySource { public: enum ASTReadResult { Success, Failure, IgnorePCH }; + /// \brief Types of AST files. + enum ASTFileType { + Module, ///< File is a module proper. + PCH, ///< File is a PCH file treated as such. + Preamble, ///< File is a PCH file treated as the preamble. + MainFile ///< File is a PCH file treated as the actual main file. + }; friend class PCHValidator; friend class ASTDeclReader; friend class ASTStmtReader; @@ -201,11 +208,14 @@ private: /// \brief Information that is needed for every module. struct PerFileData { - PerFileData(); + PerFileData(ASTFileType Ty); ~PerFileData(); // === General information === + /// \brief The type of this AST file. + ASTFileType Type; + /// \brief The file name of the AST file. std::string FileName; @@ -695,7 +705,7 @@ private: void MaybeAddSystemRootToFilename(std::string &Filename); - ASTReadResult ReadASTCore(llvm::StringRef FileName); + ASTReadResult ReadASTCore(llvm::StringRef FileName, ASTFileType Type); ASTReadResult ReadASTBlock(PerFileData &F); bool CheckPredefinesBuffers(); bool ParseLineTable(PerFileData &F, llvm::SmallVectorImpl<uint64_t> &Record); @@ -776,7 +786,7 @@ public: /// \brief Load the precompiled header designated by the given file /// name. - ASTReadResult ReadAST(const std::string &FileName); + ASTReadResult ReadAST(const std::string &FileName, ASTFileType Type); /// \brief Set the AST callbacks listener. void setListener(ASTReaderListener *listener) { |