[cfe-commits] r46774 - /cfe/trunk/Sema/SemaDecl.cpp

Chris Lattner sabre at nondot.org
Tue Feb 5 14:40:56 PST 2008


Author: lattner
Date: Tue Feb  5 16:40:55 2008
New Revision: 46774

URL: http://llvm.org/viewvc/llvm-project?rev=46774&view=rev
Log:
simplify some code.

Modified:
    cfe/trunk/Sema/SemaDecl.cpp

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=46774&r1=46773&r2=46774&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Tue Feb  5 16:40:55 2008
@@ -1463,14 +1463,11 @@
   if (Record)
     Record->defineBody(&RecFields[0], RecFields.size());
   else {
-    ObjCIvarDecl **ClsFields = 
-                    reinterpret_cast<ObjCIvarDecl**>(&RecFields[0]);
-    if (isa<ObjCInterfaceDecl>(static_cast<Decl*>(RecDecl)))
-      cast<ObjCInterfaceDecl>(static_cast<Decl*>(RecDecl))->
-        addInstanceVariablesToClass(ClsFields, RecFields.size(), RBrac);
-    else if (isa<ObjCImplementationDecl>(static_cast<Decl*>(RecDecl))) {
-      ObjCImplementationDecl* IMPDecl = 
-        cast<ObjCImplementationDecl>(static_cast<Decl*>(RecDecl));
+    ObjCIvarDecl **ClsFields = reinterpret_cast<ObjCIvarDecl**>(&RecFields[0]);
+    if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(EnclosingDecl))
+      ID->addInstanceVariablesToClass(ClsFields, RecFields.size(), RBrac);
+    else if (ObjCImplementationDecl *IMPDecl = 
+               dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) {
       assert(IMPDecl && "ActOnFields - missing ObjCImplementationDecl");
       IMPDecl->ObjCAddInstanceVariablesToClassImpl(ClsFields, RecFields.size());
       CheckImplementationIvars(IMPDecl, ClsFields, RecFields.size(), RBrac);





More information about the cfe-commits mailing list