]> granicus.if.org Git - clang/commitdiff
Minor tweaks to the transparent declcontext patch
authorDouglas Gregor <dgregor@apple.com>
Tue, 6 Jan 2009 07:17:58 +0000 (07:17 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 6 Jan 2009 07:17:58 +0000 (07:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61798 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclBase.cpp
lib/Sema/SemaDecl.cpp

index 59d8a07bfdd49b1847dbd035507918667559dbb4..a21d5db11a34813a87c3ef4abdd9a8f57f778b5c 100644 (file)
@@ -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);
 
index dce1e129a59750e1c4f4ca3d3952d2a9935f24b8..5a7d07b86f75f482ceb0b92713ef6568d0177ef6 100644 (file)
@@ -3138,12 +3138,10 @@ void Sema::ActOnFields(Scope* S,
 }
 
 void Sema::ActOnEnumStartDefinition(Scope *S, DeclTy *EnumD) {
-  EnumDecl *Enum = cast_or_null<EnumDecl>((Decl *)EnumD);
+  EnumDecl *Enum = cast<EnumDecl>((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,