summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-12-10 09:41:52 +0000
committerJohn McCall <rjmccall@apple.com>2009-12-10 09:41:52 +0000
commit84d8767c1582d1ee300ecf9899b76d57a34c3597 (patch)
tree1d36caa744cc145503c6493c21da4d1b945b6cea /clang/lib/Sema/SemaDecl.cpp
parente919e382a4fa116b3a15cb8855dd928f0ce674a2 (diff)
downloadbcm5719-llvm-84d8767c1582d1ee300ecf9899b76d57a34c3597.tar.gz
bcm5719-llvm-84d8767c1582d1ee300ecf9899b76d57a34c3597.zip
Implement redeclaration checking and hiding semantics for using declarations. There
are a couple of O(n^2) operations in this, some analogous to the usual O(n^2) redeclaration problem and some not. In particular, retroactively removing shadow declarations when they're hidden by later decls is pretty unfortunate. I'm not yet convinced it's worse than the alternative, though. llvm-svn: 91045
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 55a5e7b0635..3fa7e6558b7 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3015,7 +3015,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
// Perform semantic checking on the function declaration.
bool OverloadableAttrRequired = false; // FIXME: HACK!
- CheckFunctionDeclaration(NewFD, Previous, isExplicitSpecialization,
+ CheckFunctionDeclaration(S, NewFD, Previous, isExplicitSpecialization,
Redeclaration, /*FIXME:*/OverloadableAttrRequired);
assert((NewFD->isInvalidDecl() || !Redeclaration ||
@@ -3137,7 +3137,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
/// an explicit specialization of the previous declaration.
///
/// This sets NewFD->isInvalidDecl() to true if there was an error.
-void Sema::CheckFunctionDeclaration(FunctionDecl *NewFD,
+void Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
LookupResult &Previous,
bool IsExplicitSpecialization,
bool &Redeclaration,
@@ -3202,8 +3202,11 @@ void Sema::CheckFunctionDeclaration(FunctionDecl *NewFD,
switch (CheckOverload(NewFD, Previous, OldDecl)) {
case Ovl_Match:
- // FIXME: hide or conflict with using shadow decls as appropriate
- Redeclaration = !isa<UsingShadowDecl>(OldDecl);
+ Redeclaration = true;
+ if (isa<UsingShadowDecl>(OldDecl) && CurContext->isRecord()) {
+ HideUsingShadowDecl(S, cast<UsingShadowDecl>(OldDecl));
+ Redeclaration = false;
+ }
break;
case Ovl_NonFunction:
OpenPOWER on IntegriCloud