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

Fariborz Jahanian fjahanian at apple.com
Tue Oct 9 11:22:59 PDT 2007


Author: fjahanian
Date: Tue Oct  9 13:22:59 2007
New Revision: 42803

URL: http://llvm.org/viewvc/llvm-project?rev=42803&view=rev
Log:
Minor code clean up to make it more readable.

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=42803&r1=42802&r2=42803&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Tue Oct  9 13:22:59 2007
@@ -1031,31 +1031,28 @@
                       IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
                       IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs) {
   ObjcInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName);
-  ObjcCategoryDecl *CDecl;
   
   /// Check that class of this category is already completely declared.
   if (!IDecl || IDecl->isForwardDecl()) {
     Diag(ClassLoc, diag::err_undef_interface, ClassName->getName());
     return 0;
   }
-  else {
-    CDecl = new ObjcCategoryDecl(AtInterfaceLoc, NumProtoRefs,
-                                 CategoryName);
-    CDecl->setClassInterface(IDecl);
-    /// Check for duplicate interface declaration for this category
-    ObjcCategoryDecl *CDeclChain;
-    for (CDeclChain = IDecl->getListCategories(); CDeclChain;
-         CDeclChain = CDeclChain->getNextClassCategory()) {
-      if (CDeclChain->getIdentifier() == CategoryName) {
-        Diag(CategoryLoc, diag::err_dup_category_def, ClassName->getName(),
-             CategoryName->getName());
-        break;
-      }
+  ObjcCategoryDecl *CDecl = new ObjcCategoryDecl(AtInterfaceLoc, NumProtoRefs,
+                                                 CategoryName);
+  CDecl->setClassInterface(IDecl);
+  /// Check for duplicate interface declaration for this category
+  ObjcCategoryDecl *CDeclChain;
+  for (CDeclChain = IDecl->getListCategories(); CDeclChain;
+       CDeclChain = CDeclChain->getNextClassCategory()) {
+    if (CDeclChain->getIdentifier() == CategoryName) {
+      Diag(CategoryLoc, diag::err_dup_category_def, ClassName->getName(),
+           CategoryName->getName());
+      break;
     }
-    if (!CDeclChain)
-      CDecl->insertNextClassCategory();
   }
-  
+  if (!CDeclChain)
+    CDecl->insertNextClassCategory();
+
   /// Check then save referenced protocols
   for (unsigned int i = 0; i != NumProtoRefs; i++) {
     ObjcProtocolDecl* RefPDecl = ObjcProtocols[ProtoRefNames[i]];





More information about the cfe-commits mailing list