Miscellaneous found by inspection with John and Sebastian

llvm-svn: 112315
This commit is contained in:
Douglas Gregor 2010-08-27 22:55:10 +00:00
parent 6c1395f62a
commit fcee9460c6
2 changed files with 21 additions and 24 deletions

View File

@ -701,11 +701,10 @@ public:
bool isFileVarDecl() const { bool isFileVarDecl() const {
if (getKind() != Decl::Var) if (getKind() != Decl::Var)
return false; return false;
if (const DeclContext *Ctx = getDeclContext()) {
Ctx = Ctx->getLookupContext(); if (getDeclContext()->getLookupContext()->isFileContext())
if (isa<TranslationUnitDecl>(Ctx) || isa<NamespaceDecl>(Ctx) )
return true; return true;
}
if (isStaticDataMember()) if (isStaticDataMember())
return true; return true;

View File

@ -2627,12 +2627,12 @@ isOutOfScopePreviousDeclaration(NamedDecl *PrevDecl, DeclContext *DC,
if (!OuterContext->isFunctionOrMethod()) if (!OuterContext->isFunctionOrMethod())
// This rule only applies to block-scope declarations. // This rule only applies to block-scope declarations.
return false; return false;
else {
DeclContext *PrevOuterContext = PrevDecl->getDeclContext(); DeclContext *PrevOuterContext = PrevDecl->getDeclContext();
if (PrevOuterContext->isRecord()) if (PrevOuterContext->isRecord())
// We found a member function: ignore it. // We found a member function: ignore it.
return false; return false;
else {
// Find the innermost enclosing namespace for the new and // Find the innermost enclosing namespace for the new and
// previous declarations. // previous declarations.
while (!OuterContext->isFileContext()) while (!OuterContext->isFileContext())
@ -2642,12 +2642,9 @@ isOutOfScopePreviousDeclaration(NamedDecl *PrevDecl, DeclContext *DC,
// The previous declaration is in a different namespace, so it // The previous declaration is in a different namespace, so it
// isn't the same function. // isn't the same function.
if (OuterContext->getPrimaryContext() != if (!OuterContext->Equals(PrevOuterContext))
PrevOuterContext->getPrimaryContext())
return false; return false;
} }
}
}
return true; return true;
} }
@ -5511,6 +5508,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
PrevDecl = Tag; PrevDecl = Tag;
Previous.clear(); Previous.clear();
Previous.addDecl(Tag); Previous.addDecl(Tag);
Previous.resolveKind();
} }
} }
} }