From d05cb418fd61c8fd5bd4ba2fbfefc3dfd06002da Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 6 Jan 2009 07:17:58 +0000 Subject: [PATCH] Minor tweaks to the transparent declcontext patch llvm-svn: 61798 --- clang/lib/AST/DeclBase.cpp | 3 ++- clang/lib/Sema/SemaDecl.cpp | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 59d8a07bfdd4..a21d5db11a34 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -513,7 +513,8 @@ void DeclContext::addDecl(ASTContext &Context, ScopedDecl *D, bool AllowLookup) /// transparent contexts nested within it). void DeclContext::buildLookup(ASTContext &Context, DeclContext *DCtx) { for (; DCtx; DCtx = DCtx->getNextContext()) { - for (decl_iterator D = DCtx->decls_begin(); D != DCtx->decls_end(); ++D) { + for (decl_iterator D = DCtx->decls_begin(), DEnd = DCtx->decls_end(); + D != DEnd; ++D) { // Insert this declaration into the lookup structure insertImpl(*D); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index dce1e129a597..5a7d07b86f75 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3138,12 +3138,10 @@ void Sema::ActOnFields(Scope* S, } void Sema::ActOnEnumStartDefinition(Scope *S, DeclTy *EnumD) { - EnumDecl *Enum = cast_or_null((Decl *)EnumD); + EnumDecl *Enum = cast((Decl *)EnumD); - if (Enum) { - // Enter the enumeration context. - PushDeclContext(S, Enum); - } + // Enter the enumeration context. + PushDeclContext(S, Enum); } Sema::DeclTy *Sema::ActOnEnumConstant(Scope *S, DeclTy *theEnumDecl,