Convert to using the Attributes::Builder class to create attributes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165468 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2012-10-09 00:47:36 +00:00
parent 341873ae02
commit c40abb0b68
2 changed files with 29 additions and 14 deletions

View File

@ -137,16 +137,16 @@ bool PruneEH::runOnSCC(CallGraphSCC &SCC) {
// If the SCC doesn't unwind or doesn't throw, note this fact.
if (!SCCMightUnwind || !SCCMightReturn)
for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
Attributes NewAttributes = Attribute::None;
Attributes::Builder NewAttributes;
if (!SCCMightUnwind)
NewAttributes |= Attribute::NoUnwind;
NewAttributes.addNoUnwindAttr();
if (!SCCMightReturn)
NewAttributes |= Attribute::NoReturn;
NewAttributes.addNoReturnAttr();
Function *F = (*I)->getFunction();
const AttrListPtr &PAL = F->getAttributes();
const AttrListPtr &NPAL = PAL.addAttr(~0, NewAttributes);
const AttrListPtr &NPAL = PAL.addAttr(~0, Attributes::get(NewAttributes));
if (PAL != NPAL) {
MadeChange = true;
F->setAttributes(NPAL);