diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-09-20 00:40:19 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-09-20 00:40:19 +0000 |
commit | 5d7469e3e4d745bf955c6f6a387e853d54b8583f (patch) | |
tree | 03c2eb7cfdbda24fe20a96b8a1281f289d06b471 /clang/lib/CodeGen | |
parent | 36d8c92105728cebcc69305549da8f486b9e6154 (diff) | |
download | bcm5719-llvm-5d7469e3e4d745bf955c6f6a387e853d54b8583f.tar.gz bcm5719-llvm-5d7469e3e4d745bf955c6f6a387e853d54b8583f.zip |
Don't assume that the clause is a GlobalVariable. It could be a constant.
llvm-svn: 140123
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index a8d7c5a78d2..bd5ae7582e0 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/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; } } } |