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 | 041087caec03e8855770695d3eabc0feb031f6ed (patch) | |
tree | 40df708abc50c383e26d554a861ba44dbc707412 /lib/CodeGen/CGCall.cpp | |
parent | b917e6490e7aa0b255111cd762a277de18cfa641 (diff) |
'pure' and 'const' functions should also be marked nounwind. Migrate
test over from llvm/test/FrontendC++ and update others to account for
the change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137669 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 023dd2267c..dc3e702d6a 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/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; } |