diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-02 21:56:05 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-02 21:56:05 +0000 |
commit | 6236a29f5082d4736c4593ca1a04595037db1685 (patch) | |
tree | 3805b63ef0fe94b9fa29151a22419b33c7404faf /lib/Serialization/ASTReader.cpp | |
parent | 377cc6e3e8a6d9d0c90a315d29ce84836383d059 (diff) |
Only perform checking of the predefines buffer when loading a
precompiled header. Previously, we were trying to gather predefines
buffers from all kinds of AST files (which doesn't make sense) and
were performing some validation when AST files were loaded as main
files.
With these tweaks, using PCH files that import modules no longer fails
immediately (due to mismatched predefines buffers). However, module
visibility is lost, so this feature does not yet work.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145709 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTReader.cpp')
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 76bc0b8400..22e34d62af 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -1210,7 +1210,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(int ID) { FileID BufferID = SourceMgr.createFileIDForMemBuffer(Buffer, ID, BaseOffset + Offset); - if (strcmp(Name, "<built-in>") == 0) { + if (strcmp(Name, "<built-in>") == 0 && F->Kind == MK_PCH) { PCHPredefinesBlock Block = { BufferID, StringRef(BlobStart, BlobLen - 1) @@ -2530,7 +2530,7 @@ ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName, // Here comes stuff that we only do once the entire chain is loaded. // Check the predefines buffers. - if (!DisableValidation && Type != MK_Module && Type != MK_Preamble && + if (!DisableValidation && Type == MK_PCH && // FIXME: CheckPredefinesBuffers also sets the SuggestedPredefines; // if DisableValidation is true, defines that were set on command-line // but not in the PCH file will not be added to SuggestedPredefines. |