Commit Graph

7 Commits

Author SHA1 Message Date
Richard Smith 1c34fb78e7 Fix implementation of C11 6.2.7/4 and C++11 [dcl.array]p3:
When a local extern declaration redeclares some other entity, the type of that
entity is merged with the prior type if the prior declaration is visible (in C)
or is declared in the same scope (in C++).

 - Make LookupRedeclarationWithLinkage actually work in C++, use it in the right
   set of cases, and make it track whether it found a shadowed declaration.
 - Track whether we found a declaration in the same scope (for C++) including
   across serialization and template instantiation.

llvm-svn: 188307
2013-08-13 18:18:50 +00:00
John McCall ad327cd214 Handle incompatible redeclarations of library builtins better.
Invalid redeclarations of valid explicit declarations shouldn't
take the same path as redeclarations of implicit declarations,
and invalid local extern declarations shouldn't foul things up
for everybody else.

llvm-svn: 179482
2013-04-14 08:50:55 +00:00
John McCall a4da323ee0 Don't replace an existing decl in the scope chains with its
local-extern redeclaration;  type refinements, default arguments,
etc. must all be locally scoped.

rdar://13535367

llvm-svn: 179430
2013-04-13 00:20:21 +00:00
John McCall b65e8fe143 Only merge down a variable type if the previous declaration was
visible.  There's a lot of potential badness in how we're modelling
these things, but getting this much correct is reasonably easy.

rdar://13535367

llvm-svn: 178488
2013-04-01 18:34:28 +00:00
Rafael Espindola 7581f3269a Fix isThisDeclarationADefinition for extern following tentative.
An extern declaration following a tentative definition should not itself be
considered a tentative definition.
Fixes pr14614.

llvm-svn: 170377
2012-12-17 22:23:47 +00:00
Douglas Gregor 825faf7a4f When redeclaring a local extern in the same scope, make sure that we
replace the existing declaration appropriately. Patch by Jordy Rose,
fixes PR10013 / <rdar://problem/9584157>.

llvm-svn: 134097
2011-06-29 21:22:02 +00:00
Fariborz Jahanian 4f9c9d6591 Fixes a regression when redeclaration of a global satic
is an extern local to a function. Radar 8125274.

llvm-svn: 106773
2010-06-24 18:50:41 +00:00