[cfe-commits] r84456 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGExpr.cpp CodeGenFunction.h

Daniel Dunbar daniel at zuster.org
Sun Oct 18 18:21:05 PDT 2009


Author: ddunbar
Date: Sun Oct 18 20:21:05 2009
New Revision: 84456

URL: http://llvm.org/viewvc/llvm-project?rev=84456&view=rev
Log:
Twinify CodeGenFunction::CreateTempAlloca

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=84456&r1=84455&r2=84456&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Sun Oct 18 20:21:05 2009
@@ -639,9 +639,8 @@
       // If this structure was expanded into multiple arguments then
       // we need to create a temporary and reconstruct it from the
       // arguments.
-      std::string Name = Arg->getNameAsString();
       llvm::Value *Temp = CreateTempAlloca(ConvertTypeForMem(Ty),
-                                           (Name + ".addr").c_str());
+                                           Arg->getName() + ".addr");
       // FIXME: What are the right qualifiers here?
       llvm::Function::arg_iterator End =
         ExpandTypeFromArgs(Ty, LValue::MakeAddr(Temp, Qualifiers()), AI);
@@ -650,7 +649,7 @@
       // Name the arguments used in expansion and increment AI.
       unsigned Index = 0;
       for (; AI != End; ++AI, ++Index)
-        AI->setName(Name + "." + llvm::Twine(Index));
+        AI->setName(Arg->getName() + "." + llvm::Twine(Index));
       continue;
     }
 

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=84456&r1=84455&r2=84456&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Sun Oct 18 20:21:05 2009
@@ -28,9 +28,9 @@
 /// CreateTempAlloca - This creates a alloca and inserts it into the entry
 /// block.
 llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(const llvm::Type *Ty,
-                                                    const char *Name) {
+                                                    const llvm::Twine &Name) {
   if (!Builder.isNamePreserving())
-    Name = "";
+    return new llvm::AllocaInst(Ty, 0, "", AllocaInsertPt);
   return new llvm::AllocaInst(Ty, 0, Name, AllocaInsertPt);
 }
 

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=84456&r1=84455&r2=84456&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sun Oct 18 20:21:05 2009
@@ -34,6 +34,7 @@
   class LLVMContext;
   class Module;
   class SwitchInst;
+  class Twine;
   class Value;
 }
 
@@ -508,7 +509,7 @@
   /// CreateTempAlloca - This creates a alloca and inserts it into the entry
   /// block.
   llvm::AllocaInst *CreateTempAlloca(const llvm::Type *Ty,
-                                     const char *Name = "tmp");
+                                     const llvm::Twine &Name = "tmp");
 
   /// EvaluateExprAsBool - Perform the usual unary conversions on the specified
   /// expression and compare the result against zero, returning an Int1Ty value.





More information about the cfe-commits mailing list