diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-02-22 18:35:59 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-02-22 18:35:59 +0000 |
commit | 0b849d34b3a9574615e98e108db4e8099e9032e0 (patch) | |
tree | e533db37ea34e3b7394d3ed1e65ab59fe96316a7 /lib/Serialization | |
parent | f512acee01617c9da8079ed88ded3bb9f2418349 (diff) |
[preprocessing record] Have the MacroDefinitions map point to the MacroDefinition object instead
its index in the preprocessed entities vector.
This is because the order of the entities in the vector can change in some (uncommon) cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175907 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization')
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index da3add3161..4c11f38395 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -1249,8 +1249,12 @@ void ASTReader::ReadMacroRecord(ModuleFile &F, uint64_t Offset, PreprocessedEntityID GlobalID = getGlobalPreprocessedEntityID(F, Record[NextIndex]); PreprocessingRecord &PPRec = *PP.getPreprocessingRecord(); - PPRec.RegisterMacroDefinition(Macro, - PPRec.getPPEntityID(GlobalID-1, /*isLoaded=*/true)); + PreprocessingRecord::PPEntityID + PPID = PPRec.getPPEntityID(GlobalID-1, /*isLoaded=*/true); + MacroDefinition *PPDef = + cast_or_null<MacroDefinition>(PPRec.getPreprocessedEntity(PPID)); + if (PPDef) + PPRec.RegisterMacroDefinition(Macro, PPDef); } ++NumMacrosRead; |