diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-01 03:26:04 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-01 03:26:04 +0000 |
commit | 8504b7b8102a52b2a16231d459fb3cfab4784c38 (patch) | |
tree | 7ab8a5ad872e609b7c4bba1c6dad06f1968e6478 /include/clang/Serialization/Module.h | |
parent | 7db4bb9226f303392934c91869afdeb4d153ca95 (diff) |
[PCH] Enhance InputFile to also include whether the file is out-of-date.
Previously we would return null for an out-of-date file. This inhibited ASTReader::ReadSLocEntry
from creating a FileID to recover gracefully in such a case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176332 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Serialization/Module.h')
-rw-r--r-- | include/clang/Serialization/Module.h | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h index 5b019bd054..abf45995f2 100644 --- a/include/clang/Serialization/Module.h +++ b/include/clang/Serialization/Module.h @@ -55,6 +55,35 @@ struct DeclContextInfo { unsigned NumLexicalDecls; }; +/// \brief The input file that has been loaded from this AST file, along with +/// bools indicating whether this was an overridden buffer or if it was +/// out-of-date. +class InputFile { + enum { + Overridden = 1, + OutOfDate = 2 + }; + llvm::PointerIntPair<const FileEntry *, 2, unsigned> Val; + +public: + InputFile() {} + InputFile(const FileEntry *File, + bool isOverridden = false, bool isOutOfDate = false) { + assert(!(isOverridden && isOutOfDate) && + "an overridden cannot be out-of-date"); + unsigned intVal = 0; + if (isOverridden) + intVal = Overridden; + else if (isOutOfDate) + intVal = OutOfDate; + Val.setPointerAndInt(File, intVal); + } + + const FileEntry *getFile() const { return Val.getPointer(); } + bool isOverridden() const { return Val.getInt() == Overridden; } + bool isOutOfDate() const { return Val.getInt() == OutOfDate; } +}; + /// \brief Information about a module that has been loaded by the ASTReader. /// /// Each instance of the Module class corresponds to a single AST file, which @@ -145,10 +174,8 @@ public: /// \brief Offsets for all of the input file entries in the AST file. const uint32_t *InputFileOffsets; - /// \brief The input files that have been loaded from this AST file, along - /// with a bool indicating whether this was an overridden buffer. - std::vector<llvm::PointerIntPair<const FileEntry *, 1, bool> > - InputFilesLoaded; + /// \brief The input files that have been loaded from this AST file. + std::vector<InputFile> InputFilesLoaded; // === Source Locations === |