Convert to using the Attributes::Builder class to create attributes.
authorBill Wendling <isanbard@gmail.com>
Tue, 9 Oct 2012 00:47:36 +0000 (00:47 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 9 Oct 2012 00:47:36 +0000 (00:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165468 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/PruneEH.cpp
lib/Transforms/Scalar/ObjCARC.cpp

index c8cc8fd1930beb09cf4688c0d19557058aa5a08c..8ebf6ee1dd0c6186bbc7199ce54b0fe74baa6bee 100644 (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);
index d83b069b1c8ca9b77e11058d6bc7c6a6973f6424..dbcafb0452a3c7861ad9e3584bc27d857bd02a9c 100644 (file)
@@ -1788,7 +1788,9 @@ Constant *ObjCARCOpt::getRetainRVCallee(Module *M) {
     Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
     Type *Params[] = { I8X };
     FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
-    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attribute::NoUnwind);
+    Attributes::Builder B;
+    B.addNoUnwindAttr();
+    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
     RetainRVCallee =
       M->getOrInsertFunction("objc_retainAutoreleasedReturnValue", FTy,
                              Attributes);
@@ -1802,7 +1804,9 @@ Constant *ObjCARCOpt::getAutoreleaseRVCallee(Module *M) {
     Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
     Type *Params[] = { I8X };
     FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
-    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attribute::NoUnwind);
+    Attributes::Builder B;
+    B.addNoUnwindAttr();
+    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
     AutoreleaseRVCallee =
       M->getOrInsertFunction("objc_autoreleaseReturnValue", FTy,
                              Attributes);
@@ -1814,7 +1818,9 @@ Constant *ObjCARCOpt::getReleaseCallee(Module *M) {
   if (!ReleaseCallee) {
     LLVMContext &C = M->getContext();
     Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
-    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attribute::NoUnwind);
+    Attributes::Builder B;
+    B.addNoUnwindAttr();
+    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
     ReleaseCallee =
       M->getOrInsertFunction(
         "objc_release",
@@ -1828,7 +1834,9 @@ Constant *ObjCARCOpt::getRetainCallee(Module *M) {
   if (!RetainCallee) {
     LLVMContext &C = M->getContext();
     Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
-    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attribute::NoUnwind);
+    Attributes::Builder B;
+    B.addNoUnwindAttr();
+    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
     RetainCallee =
       M->getOrInsertFunction(
         "objc_retain",
@@ -1857,7 +1865,9 @@ Constant *ObjCARCOpt::getAutoreleaseCallee(Module *M) {
   if (!AutoreleaseCallee) {
     LLVMContext &C = M->getContext();
     Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
-    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attribute::NoUnwind);
+    Attributes::Builder B;
+    B.addNoUnwindAttr();
+    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
     AutoreleaseCallee =
       M->getOrInsertFunction(
         "objc_autorelease",
@@ -3830,9 +3840,10 @@ Constant *ObjCARCContract::getStoreStrongCallee(Module *M) {
     Type *I8XX = PointerType::getUnqual(I8X);
     Type *Params[] = { I8XX, I8X };
 
-    AttrListPtr Attributes = AttrListPtr()
-      .addAttr(~0u, Attribute::NoUnwind)
-      .addAttr(1, Attribute::NoCapture);
+    Attributes::Builder B;
+    B.addNoUnwindAttr();
+    B.addNoCaptureAttr();
+    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
 
     StoreStrongCallee =
       M->getOrInsertFunction(
@@ -3849,7 +3860,9 @@ Constant *ObjCARCContract::getRetainAutoreleaseCallee(Module *M) {
     Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
     Type *Params[] = { I8X };
     FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
-    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attribute::NoUnwind);
+    Attributes::Builder B;
+    B.addNoUnwindAttr();
+    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
     RetainAutoreleaseCallee =
       M->getOrInsertFunction("objc_retainAutorelease", FTy, Attributes);
   }
@@ -3862,7 +3875,9 @@ Constant *ObjCARCContract::getRetainAutoreleaseRVCallee(Module *M) {
     Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
     Type *Params[] = { I8X };
     FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
-    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attribute::NoUnwind);
+    Attributes::Builder B;
+    B.addNoUnwindAttr();
+    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
     RetainAutoreleaseRVCallee =
       M->getOrInsertFunction("objc_retainAutoreleaseReturnValue", FTy,
                              Attributes);