summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-07-08 06:48:12 +0000
committerJohn McCall <rjmccall@apple.com>2010-07-08 06:48:12 +0000
commitbe349def4b71ae15be9877f1ae366ce41f5780e3 (patch)
tree665a5b22615c278fdef2efbf9cfc4cb6b98262b5 /clang/lib/CodeGen/CGCall.cpp
parent747eb7840abcb638d6bc9590b3345608286f58f0 (diff)
downloadbcm5719-llvm-be349def4b71ae15be9877f1ae366ce41f5780e3.tar.gz
bcm5719-llvm-be349def4b71ae15be9877f1ae366ce41f5780e3.zip
Mark calls to 'throw()' functions as nounwind, and mark the functions nounwind
as well. llvm-svn: 107858
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 0a17e56d727..1632cb3c22b 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -684,6 +684,12 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
if (TargetDecl) {
if (TargetDecl->hasAttr<NoThrowAttr>())
FuncAttrs |= llvm::Attribute::NoUnwind;
+ else if (const FunctionDecl *Fn = dyn_cast<FunctionDecl>(TargetDecl)) {
+ const FunctionProtoType *FPT = Fn->getType()->getAs<FunctionProtoType>();
+ if (FPT && FPT->hasEmptyExceptionSpec())
+ FuncAttrs |= llvm::Attribute::NoUnwind;
+ }
+
if (TargetDecl->hasAttr<NoReturnAttr>())
FuncAttrs |= llvm::Attribute::NoReturn;
if (TargetDecl->hasAttr<ConstAttr>())
OpenPOWER on IntegriCloud