[cfe-commits] r100197 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Daniel Dunbar daniel at zuster.org
Fri Apr 2 11:29:09 PDT 2010


Author: ddunbar
Date: Fri Apr  2 13:29:09 2010
New Revision: 100197

URL: http://llvm.org/viewvc/llvm-project?rev=100197&view=rev
Log:
Sema/Obj-C: Simplify -- eliminate dead casts & provable asserts, and narrow type.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=100197&r1=100196&r2=100197&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Apr  2 13:29:09 2010
@@ -5740,17 +5740,15 @@
     Visibility != tok::objc_not_keyword ? TranslateIvarVisibility(Visibility)
                                         : ObjCIvarDecl::None;
   // Must set ivar's DeclContext to its enclosing interface.
-  Decl *EnclosingDecl = IntfDecl.getAs<Decl>();
-  DeclContext *EnclosingContext;
+  ObjCContainerDecl *EnclosingDecl = IntfDecl.getAs<ObjCContainerDecl>();
+  ObjCContainerDecl *EnclosingContext;
   if (ObjCImplementationDecl *IMPDecl =
       dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) {
     // Case of ivar declared in an implementation. Context is that of its class.
-    ObjCInterfaceDecl* IDecl = IMPDecl->getClassInterface();
-    assert(IDecl && "No class- ActOnIvar");
-    EnclosingContext = cast_or_null<DeclContext>(IDecl);
+    EnclosingContext = IMPDecl->getClassInterface();
+    assert(EnclosingContext && "Implementation has no class interface!");
   } else
-    EnclosingContext = dyn_cast<DeclContext>(EnclosingDecl);
-  assert(EnclosingContext && "null DeclContext for ivar - ActOnIvar");
+    EnclosingContext = EnclosingDecl;
 
   // Construct the decl.
   ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context,





More information about the cfe-commits mailing list