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.

llvm-svn: 138189
This commit is contained in:
Douglas Gregor 2011-08-20 05:09:43 +00:00
parent 18221d8eae
commit b36fc536d2
4 changed files with 14 additions and 1 deletions

View File

@ -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;

View File

@ -2,3 +2,6 @@ float left(float *);
int top_left(char *c);
int left_and_right(int*);

View File

@ -1 +1,5 @@
double right(double *);
struct left_and_right {
int left, right;
};

View File

@ -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