[cfe-commits] r140123 - /cfe/trunk/lib/CodeGen/CGException.cpp

Bill Wendling isanbard at gmail.com
Mon Sep 19 17:40:19 PDT 2011


Author: void
Date: Mon Sep 19 19:40:19 2011
New Revision: 140123

URL: http://llvm.org/viewvc/llvm-project?rev=140123&view=rev
Log:
Don't assume that the clause is a GlobalVariable. It could be a constant.

Modified:
    cfe/trunk/lib/CodeGen/CGException.cpp

Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=140123&r1=140122&r2=140123&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Mon Sep 19 19:40:19 2011
@@ -249,24 +249,22 @@
       llvm::Value *Val = LPI->getClause(I)->stripPointerCasts();
       if (LPI->isCatch(I)) {
         // Check if the catch value has the ObjC prefix.
-        llvm::GlobalVariable *GV = cast<llvm::GlobalVariable>(Val);
-
-        // ObjC EH selector entries are always global variables with
-        // names starting like this.
-        if (GV->getName().startswith("OBJC_EHTYPE"))
-          return false;
+        if (llvm::GlobalVariable *GV = dyn_cast<llvm::GlobalVariable>(Val))
+          // ObjC EH selector entries are always global variables with
+          // names starting like this.
+          if (GV->getName().startswith("OBJC_EHTYPE"))
+            return false;
       } else {
         // Check if any of the filter values have the ObjC prefix.
         llvm::Constant *CVal = cast<llvm::Constant>(Val);
         for (llvm::User::op_iterator
                II = CVal->op_begin(), IE = CVal->op_end(); II != IE; ++II) {
-          llvm::GlobalVariable *GV =
-            cast<llvm::GlobalVariable>((*II)->stripPointerCasts());
-
-          // ObjC EH selector entries are always global variables with
-          // names starting like this.
-          if (GV->getName().startswith("OBJC_EHTYPE"))
-            return false;
+          if (llvm::GlobalVariable *GV =
+              cast<llvm::GlobalVariable>((*II)->stripPointerCasts()))
+            // ObjC EH selector entries are always global variables with
+            // names starting like this.
+            if (GV->getName().startswith("OBJC_EHTYPE"))
+              return false;
         }
       }
     }





More information about the cfe-commits mailing list