From: Douglas Gregor Date: Sat, 20 Aug 2011 05:09:43 +0000 (+0000) Subject: Make the loading of multiple records for the same identifier (from X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c02adaa4da1d87495ca6a6d394f78740fa475c4;p=clang Make the loading of multiple records for the same identifier (from different modules) more robust. It already handled (simple) merges of the set of declarations attached to that identifier, so add a test case that shows us getting two different declarations for the same identifier (one struct, one function) from different modules, and are able to use both of them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138189 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 0b13d47970..768d5db7e3 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -698,7 +698,8 @@ public: assert(II->isExtensionToken() == ExtensionToken && "Incorrect extension token flag"); (void)ExtensionToken; - II->setIsPoisoned(Poisoned); + if (Poisoned) + II->setIsPoisoned(true); assert(II->isCPlusPlusOperatorKeyword() == CPlusPlusOperatorKeyword && "Incorrect C++ operator keyword flag"); (void)CPlusPlusOperatorKeyword; @@ -706,6 +707,7 @@ public: // If this identifier is a macro, deserialize the macro // definition. if (hasMacroDefinition) { + // FIXME: Check for conflicts? uint32_t Offset = ReadUnalignedLE32(d); Reader.SetIdentifierIsMacro(II, F, Offset); DataLen -= 4; diff --git a/test/Modules/Inputs/diamond_left.h b/test/Modules/Inputs/diamond_left.h index 3a97094c08..9758b85d97 100644 --- a/test/Modules/Inputs/diamond_left.h +++ b/test/Modules/Inputs/diamond_left.h @@ -2,3 +2,6 @@ float left(float *); int top_left(char *c); +int left_and_right(int*); + + diff --git a/test/Modules/Inputs/diamond_right.h b/test/Modules/Inputs/diamond_right.h index bbed7ec805..9adeb6a9a8 100644 --- a/test/Modules/Inputs/diamond_right.h +++ b/test/Modules/Inputs/diamond_right.h @@ -1 +1,5 @@ double right(double *); + +struct left_and_right { + int left, right; +}; diff --git a/test/Modules/diamond.c b/test/Modules/diamond.c index 220a279038..f9b283a9d2 100644 --- a/test/Modules/diamond.c +++ b/test/Modules/diamond.c @@ -8,6 +8,10 @@ void test_diamond(int i, float f, double d, char c) { // Names in multiple places in the diamond. top_left(&c); + + left_and_right(&i); + struct left_and_right lr; + lr.left = 17; } // RUN: %clang_cc1 -emit-pch -o %t_top.h.pch %S/Inputs/diamond_top.h