[cfe-commits] r90856 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGDebugInfo.h CGDecl.cpp CodeGenFunction.cpp

Benjamin Kramer benny.kra at googlemail.com
Tue Dec 8 06:04:36 PST 2009


Author: d0k
Date: Tue Dec  8 08:04:35 2009
New Revision: 90856

URL: http://llvm.org/viewvc/llvm-project?rev=90856&view=rev
Log:
Use StringRef in CGDebugInfo::EmitFunctionStart.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.h
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Dec  8 08:04:35 2009
@@ -939,16 +939,16 @@
 
 /// EmitFunctionStart - Constructs the debug code for entering a function -
 /// "llvm.dbg.func.start.".
-void CGDebugInfo::EmitFunctionStart(const char *Name, QualType FnType,
+void CGDebugInfo::EmitFunctionStart(llvm::StringRef Name, QualType FnType,
                                     llvm::Function *Fn,
                                     CGBuilderTy &Builder) {
-  const char *LinkageName = Name;
+  llvm::StringRef LinkageName(Name);
 
   // Skip the asm prefix if it exists.
   //
   // FIXME: This should probably be the unmangled name?
   if (Name[0] == '\01')
-    ++Name;
+    Name = Name.substr(1);
 
   // FIXME: Why is this using CurLoc???
   llvm::DICompileUnit Unit = getOrCreateCompileUnit(CurLoc);

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Tue Dec  8 08:04:35 2009
@@ -93,7 +93,7 @@
 
   /// EmitFunctionStart - Emit a call to llvm.dbg.function.start to indicate
   /// start of a new function.
-  void EmitFunctionStart(const char *Name, QualType FnType,
+  void EmitFunctionStart(llvm::StringRef Name, QualType FnType,
                          llvm::Function *Fn, CGBuilderTy &Builder);
 
   /// EmitRegionStart - Emit a call to llvm.dbg.region.start to indicate start

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Tue Dec  8 08:04:35 2009
@@ -361,7 +361,7 @@
       if (isByRef)
         LTy = BuildByRefType(&D);
       llvm::AllocaInst *Alloc = CreateTempAlloca(LTy);
-      Alloc->setName(D.getNameAsString().c_str());
+      Alloc->setName(D.getNameAsString());
 
       Align = getContext().getDeclAlignInBytes(&D);
       if (isByRef)

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Tue Dec  8 08:04:35 2009
@@ -194,10 +194,7 @@
       DI->EmitFunctionStart(CGM.getMangledName(GD), FnType, CurFn, Builder);
     } else {
       // Just use LLVM function name.
-
-      // FIXME: Remove unnecessary conversion to std::string when API settles.
-      DI->EmitFunctionStart(std::string(Fn->getName()).c_str(),
-                            FnType, CurFn, Builder);
+      DI->EmitFunctionStart(Fn->getName(), FnType, CurFn, Builder);
     }
   }
 





More information about the cfe-commits mailing list