[cfe-commits] r138189 - in /cfe/trunk: lib/Serialization/ASTReader.cpp test/Modules/Inputs/diamond_left.h test/Modules/Inputs/diamond_right.h test/Modules/diamond.c
Douglas Gregor
dgregor at apple.com
Fri Aug 19 22:09:43 PDT 2011
Author: dgregor
Date: Sat Aug 20 00:09:43 2011
New Revision: 138189
URL: http://llvm.org/viewvc/llvm-project?rev=138189&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Modules/Inputs/diamond_left.h
cfe/trunk/test/Modules/Inputs/diamond_right.h
cfe/trunk/test/Modules/diamond.c
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=138189&r1=138188&r2=138189&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Sat Aug 20 00:09:43 2011
@@ -698,7 +698,8 @@
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 @@
// 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;
Modified: cfe/trunk/test/Modules/Inputs/diamond_left.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/diamond_left.h?rev=138189&r1=138188&r2=138189&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/diamond_left.h (original)
+++ cfe/trunk/test/Modules/Inputs/diamond_left.h Sat Aug 20 00:09:43 2011
@@ -2,3 +2,6 @@
int top_left(char *c);
+int left_and_right(int*);
+
+
Modified: cfe/trunk/test/Modules/Inputs/diamond_right.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/diamond_right.h?rev=138189&r1=138188&r2=138189&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/diamond_right.h (original)
+++ cfe/trunk/test/Modules/Inputs/diamond_right.h Sat Aug 20 00:09:43 2011
@@ -1 +1,5 @@
double right(double *);
+
+struct left_and_right {
+ int left, right;
+};
Modified: cfe/trunk/test/Modules/diamond.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/diamond.c?rev=138189&r1=138188&r2=138189&view=diff
==============================================================================
--- cfe/trunk/test/Modules/diamond.c (original)
+++ cfe/trunk/test/Modules/diamond.c Sat Aug 20 00:09:43 2011
@@ -8,6 +8,10 @@
// 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
More information about the cfe-commits
mailing list