[llvm-commits] [124287] Fix PR1221, which is subtle fallout from the symtab change.

clattner at apple.com clattner at apple.com
Sat Feb 24 17:23:23 PST 2007


Revision: 124287
Author:   clattner
Date:     2007-02-24 17:23:21 -0800 (Sat, 24 Feb 2007)

Log Message:
-----------
Fix PR1221, which is subtle fallout from the symtab change.
"getName().c_str()" now cannot be used, because the string
returned by getName() is temporary and is destroyed when the
expression is fully evaluated.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/llvm-backend.cpp

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-backend.cpp	2007-02-24 22:46:38 UTC (rev 124286)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp	2007-02-25 01:23:21 UTC (rev 124287)
@@ -45,6 +45,7 @@
 #include "llvm/Analysis/LoadValueNumbering.h"
 #include "llvm/Transforms/IPO.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/Support/ManagedStatic.h"
 #include <cassert>
@@ -860,7 +861,7 @@
 /// llvm_get_decl_name - Used by varasm.c, returns the specified declaration's
 /// name.
 const char *llvm_get_decl_name(void *LLVM) {
-  return ((Value*)LLVM)->getName().c_str();
+  return ((Value*)LLVM)->getValueName()->getKeyData();
 }
 
 // llvm_mark_decl_weak - Used by varasm.c, called when a decl is found to be





More information about the llvm-commits mailing list