summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReader.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-02 21:56:05 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-02 21:56:05 +0000
commitdac7f9a57e5dfd04fe1cfdce8905f1a272b5b724 (patch)
treed5b02b14e51c198150f1691c625755614dd46745 /clang/lib/Serialization/ASTReader.cpp
parent1196716270c7188f2ddf3d4776f26e79cd430064 (diff)
downloadbcm5719-llvm-dac7f9a57e5dfd04fe1cfdce8905f1a272b5b724.tar.gz
bcm5719-llvm-dac7f9a57e5dfd04fe1cfdce8905f1a272b5b724.zip
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. llvm-svn: 145709
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 76bc0b84000..22e34d62af4 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud