summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-08-16 04:54:18 +0000
committerBen Langmuir <blangmuir@apple.com>2014-08-16 04:54:18 +0000
commitfe971d9894c7998595016da323665eab04471608 (patch)
tree298c8d0b1dfe63c93ef4102e6a56aab414294902 /clang/lib/Serialization/ASTWriter.cpp
parent5ccd9e029f2b57028913cf087c49fd529f8e8e52 (diff)
downloadbcm5719-llvm-fe971d9894c7998595016da323665eab04471608.tar.gz
bcm5719-llvm-fe971d9894c7998595016da323665eab04471608.zip
When loading a module with no local entities, still bump the size of the
tables that correspond to ContinuousRangeMaps, since the keys to those maps need to be unique, or we may map to the wrong offset. This fixes a crash + malformed AST file seen when loading some modules that import Cocoa on Darwin, which is a module with no contents except imports of other modules. Unfortunately I have not been able to find a reduced test case that reproduces this problem. Also add an assert that we aren't mapping one key to multiple values in CRM. We ought to be able to say there are no duplicate keys at all, but there are a bunch of 0 -> 0 mappings that are showing up, probably coming from the source location table. llvm-svn: 215810
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 55b557c0471..d5824354154 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -4458,6 +4458,9 @@ void ASTWriter::WriteASTCore(Sema &SemaRef,
StringRef FileName = (*M)->FileName;
LE.write<uint16_t>(FileName.size());
Out.write(FileName.data(), FileName.size());
+
+ // These values should be unique within a chain, since they will be read
+ // as keys into ContinuousRangeMaps.
LE.write<uint32_t>((*M)->SLocEntryBaseOffset);
LE.write<uint32_t>((*M)->BaseIdentifierID);
LE.write<uint32_t>((*M)->BaseMacroID);
OpenPOWER on IntegriCloud