[cfe-commits] r173095 - /cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Bill Wendling isanbard at gmail.com
Mon Jan 21 13:57:41 PST 2013


Author: void
Date: Mon Jan 21 15:57:40 2013
New Revision: 173095

URL: http://llvm.org/viewvc/llvm-project?rev=173095&view=rev
Log:
Make AttributeSet::getFnAttributes() return an AttributeSet instead of an Attribute.

This is more code to isolate the use of the Attribute class to that of just
holding one attribute instead of a collection of attributes.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=173095&r1=173094&r2=173095&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Jan 21 15:57:40 2013
@@ -1938,10 +1938,10 @@
     llvm::AttributeSet oldAttrs = callSite.getAttributes();
 
     // Collect any return attributes from the call.
-    llvm::Attribute returnAttrs = oldAttrs.getRetAttributes();
-    if (returnAttrs.hasAttributes())
+    if (oldAttrs.hasAttributes(llvm::AttributeSet::ReturnIndex))
       newAttrs.push_back(llvm::AttributeWithIndex::get(
-                                llvm::AttributeSet::ReturnIndex, returnAttrs));
+                                llvm::AttributeSet::ReturnIndex,
+                                oldAttrs.getRetAttributes()));
 
     // If the function was passed too few arguments, don't transform.
     unsigned newNumArgs = newFn->arg_size();
@@ -1966,11 +1966,11 @@
     if (dontTransform)
       continue;
 
-    llvm::Attribute fnAttrs = oldAttrs.getFnAttributes();
     if (oldAttrs.hasAttributes(llvm::AttributeSet::FunctionIndex))
       newAttrs.push_back(llvm::
-                       AttributeWithIndex::get(llvm::AttributeSet::FunctionIndex,
-                                               fnAttrs));
+                      AttributeWithIndex::get(newFn->getContext(),
+                                              llvm::AttributeSet::FunctionIndex,
+                                              oldAttrs.getFnAttributes()));
 
     // Okay, we can transform this.  Create the new call instruction and copy
     // over the required information.





More information about the cfe-commits mailing list