[cfe-commits] r112315 - in /cfe/trunk: include/clang/AST/Decl.h lib/Sema/SemaDecl.cpp
Douglas Gregor
dgregor at apple.com
Fri Aug 27 15:55:10 PDT 2010
Author: dgregor
Date: Fri Aug 27 17:55:10 2010
New Revision: 112315
URL: http://llvm.org/viewvc/llvm-project?rev=112315&view=rev
Log:
Miscellaneous found by inspection with John and Sebastian
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=112315&r1=112314&r2=112315&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Fri Aug 27 17:55:10 2010
@@ -701,11 +701,10 @@
bool isFileVarDecl() const {
if (getKind() != Decl::Var)
return false;
- if (const DeclContext *Ctx = getDeclContext()) {
- Ctx = Ctx->getLookupContext();
- if (isa<TranslationUnitDecl>(Ctx) || isa<NamespaceDecl>(Ctx) )
- return true;
- }
+
+ if (getDeclContext()->getLookupContext()->isFileContext())
+ return true;
+
if (isStaticDataMember())
return true;
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=112315&r1=112314&r2=112315&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Aug 27 17:55:10 2010
@@ -2627,26 +2627,23 @@
if (!OuterContext->isFunctionOrMethod())
// This rule only applies to block-scope declarations.
return false;
- else {
- DeclContext *PrevOuterContext = PrevDecl->getDeclContext();
- if (PrevOuterContext->isRecord())
- // We found a member function: ignore it.
- return false;
- else {
- // Find the innermost enclosing namespace for the new and
- // previous declarations.
- while (!OuterContext->isFileContext())
- OuterContext = OuterContext->getParent();
- while (!PrevOuterContext->isFileContext())
- PrevOuterContext = PrevOuterContext->getParent();
-
- // The previous declaration is in a different namespace, so it
- // isn't the same function.
- if (OuterContext->getPrimaryContext() !=
- PrevOuterContext->getPrimaryContext())
- return false;
- }
- }
+
+ DeclContext *PrevOuterContext = PrevDecl->getDeclContext();
+ if (PrevOuterContext->isRecord())
+ // We found a member function: ignore it.
+ return false;
+
+ // Find the innermost enclosing namespace for the new and
+ // previous declarations.
+ while (!OuterContext->isFileContext())
+ OuterContext = OuterContext->getParent();
+ while (!PrevOuterContext->isFileContext())
+ PrevOuterContext = PrevOuterContext->getParent();
+
+ // The previous declaration is in a different namespace, so it
+ // isn't the same function.
+ if (!OuterContext->Equals(PrevOuterContext))
+ return false;
}
return true;
@@ -5511,6 +5508,7 @@
PrevDecl = Tag;
Previous.clear();
Previous.addDecl(Tag);
+ Previous.resolveKind();
}
}
}
More information about the cfe-commits
mailing list