From 44180f8f6d5d55ba69764bb8eb9d89aee0c4d5eb Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 1 Feb 2013 23:45:03 +0000 Subject: Merge "special" types from different modules in the AST reader. Different modules may have different views of the various "special" types in the AST, such as the redefinition type for "id". Merge those types rather than only considering the redefinition types for the first AST file loaded. llvm-svn: 174234 --- clang/lib/Serialization/ASTReader.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'clang/lib/Serialization') diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 604b23143e9..92dcc7d7032 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2053,8 +2053,24 @@ bool ASTReader::ReadASTBlock(ModuleFile &F) { break; case SPECIAL_TYPES: - for (unsigned I = 0, N = Record.size(); I != N; ++I) - SpecialTypes.push_back(getGlobalTypeID(F, Record[I])); + if (SpecialTypes.empty()) { + for (unsigned I = 0, N = Record.size(); I != N; ++I) + SpecialTypes.push_back(getGlobalTypeID(F, Record[I])); + break; + } + + if (SpecialTypes.size() != Record.size()) { + Error("invalid special-types record"); + return true; + } + + for (unsigned I = 0, N = Record.size(); I != N; ++I) { + serialization::TypeID ID = getGlobalTypeID(F, Record[I]); + if (!SpecialTypes[I]) + SpecialTypes[I] = ID; + // FIXME: If ID && SpecialTypes[I] != ID, do we need a separate + // merge step? + } break; case STATISTICS: -- cgit v1.2.3