diff options
author | John McCall <rjmccall@apple.com> | 2010-07-08 06:48:12 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-07-08 06:48:12 +0000 |
commit | be349def4b71ae15be9877f1ae366ce41f5780e3 (patch) | |
tree | 665a5b22615c278fdef2efbf9cfc4cb6b98262b5 /clang/lib/CodeGen/CGCall.cpp | |
parent | 747eb7840abcb638d6bc9590b3345608286f58f0 (diff) | |
download | bcm5719-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.cpp | 6 |
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>()) |