diff options
author | Eric Christopher <echristo@apple.com> | 2011-08-15 22:38:22 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2011-08-15 22:38:22 +0000 |
commit | bf005ecd9c4d791b8fd2595bd970644dff951a9f (patch) | |
tree | 195607747c734bde956ff66ad15c7e4560c37b5a /clang/lib/CodeGen/CGCall.cpp | |
parent | d2dfc5ec02d90d28147c583decb5417a4c37d07e (diff) | |
download | bcm5719-llvm-bf005ecd9c4d791b8fd2595bd970644dff951a9f.tar.gz bcm5719-llvm-bf005ecd9c4d791b8fd2595bd970644dff951a9f.zip |
'pure' and 'const' functions should also be marked nounwind. Migrate
test over from llvm/test/FrontendC++ and update others to account for
the change.
llvm-svn: 137669
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 023dd2267cc..dc3e702d6a3 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -739,10 +739,15 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, if (TargetDecl->hasAttr<NoReturnAttr>()) FuncAttrs |= llvm::Attribute::NoReturn; - if (TargetDecl->hasAttr<ConstAttr>()) + + // 'const' and 'pure' attribute functions are also nounwind. + if (TargetDecl->hasAttr<ConstAttr>()) { FuncAttrs |= llvm::Attribute::ReadNone; - else if (TargetDecl->hasAttr<PureAttr>()) + FuncAttrs |= llvm::Attribute::NoUnwind; + } else if (TargetDecl->hasAttr<PureAttr>()) { FuncAttrs |= llvm::Attribute::ReadOnly; + FuncAttrs |= llvm::Attribute::NoUnwind; + } if (TargetDecl->hasAttr<MallocAttr>()) RetAttrs |= llvm::Attribute::NoAlias; } |