aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-09-20 00:40:19 +0000
committerBill Wendling <isanbard@gmail.com>2011-09-20 00:40:19 +0000
commiteecb6a1e8b95fcdb7d1a0d92b0a0311c041440cd (patch)
tree24e4804f6667f8100c5e66eb6e7c66d0d6ffce1c
parent4522e2a9e7fa0313e8e5a388d8f0ab66feccc6af (diff)
Don't assume that the clause is a GlobalVariable. It could be a constant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140123 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGException.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index a8d7c5a78d..bd5ae7582e 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -249,24 +249,22 @@ static bool PersonalityHasOnlyCXXUses(llvm::Constant *Fn) {
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;
}
}
}