[cfe-commits] r148159 - in /cfe/trunk: lib/Serialization/ASTReaderDecl.cpp test/Modules/Inputs/redecl-merge-left.h test/Modules/redecl-merge.m
Douglas Gregor
dgregor at apple.com
Fri Jan 13 15:49:35 PST 2012
Author: dgregor
Date: Fri Jan 13 17:49:34 2012
New Revision: 148159
URL: http://llvm.org/viewvc/llvm-project?rev=148159&view=rev
Log:
(Implicit) parameters deserialized as part of a function type must not
get added to the identifier chains as part of deserialization, because
they should not be visible to name lookup.
Modified:
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/test/Modules/Inputs/redecl-merge-left.h
cfe/trunk/test/Modules/redecl-merge.m
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=148159&r1=148158&r2=148159&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Fri Jan 13 17:49:34 2012
@@ -879,8 +879,10 @@
VD->VarDeclBits.NRVOVariable = Record[Idx++];
VD->VarDeclBits.CXXForRangeDecl = Record[Idx++];
VD->VarDeclBits.ARCPseudoStrong = Record[Idx++];
-
- mergeRedeclarable(VD, Redecl);
+
+ // Only true variables (not parameters or implicit parameters) can be merged.
+ if (VD->getKind() == Decl::Var)
+ mergeRedeclarable(VD, Redecl);
if (uint64_t Val = Record[Idx++]) {
VD->setInit(Reader.ReadExpr(F));
Modified: cfe/trunk/test/Modules/Inputs/redecl-merge-left.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/redecl-merge-left.h?rev=148159&r1=148158&r2=148159&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/redecl-merge-left.h (original)
+++ cfe/trunk/test/Modules/Inputs/redecl-merge-left.h Fri Jan 13 17:49:34 2012
@@ -83,3 +83,8 @@
template<typename T> class Vector;
#endif
+
+// Make sure this doesn't introduce an ambiguity-creating 'id' at the
+// top level.
+typedef void funcptr_with_id(int id);
+
Modified: cfe/trunk/test/Modules/redecl-merge.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/redecl-merge.m?rev=148159&r1=148158&r2=148159&view=diff
==============================================================================
--- cfe/trunk/test/Modules/redecl-merge.m (original)
+++ cfe/trunk/test/Modules/redecl-merge.m Fri Jan 13 17:49:34 2012
@@ -146,3 +146,6 @@
}
#endif
+// Make sure we don't get conflicts with 'id'.
+funcptr_with_id fid;
+id id_global;
More information about the cfe-commits
mailing list