From be349def4b71ae15be9877f1ae366ce41f5780e3 Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 8 Jul 2010 06:48:12 +0000 Subject: Mark calls to 'throw()' functions as nounwind, and mark the functions nounwind as well. llvm-svn: 107858 --- clang/lib/CodeGen/CGCall.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/CodeGen') 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()) FuncAttrs |= llvm::Attribute::NoUnwind; + else if (const FunctionDecl *Fn = dyn_cast(TargetDecl)) { + const FunctionProtoType *FPT = Fn->getType()->getAs(); + if (FPT && FPT->hasEmptyExceptionSpec()) + FuncAttrs |= llvm::Attribute::NoUnwind; + } + if (TargetDecl->hasAttr()) FuncAttrs |= llvm::Attribute::NoReturn; if (TargetDecl->hasAttr()) -- cgit v1.2.3