[llvm-commits] [PATCH] [ARM] simplify memory management for ConstantPoolValue

Eli Friedman eli.friedman at gmail.com
Fri Dec 21 17:54:38 PST 2012



================
Comment at: lib/Target/ARM/ARMConstantPoolValue.cpp:243
@@ -255,3 +242,3 @@
 void ARMConstantPoolSymbol::addSelectionDAGCSEId(FoldingSetNodeID &ID) {
-  ID.AddPointer(S);
+  ID.AddPointer(S.c_str());
   ARMConstantPoolValue::addSelectionDAGCSEId(ID);
----------------
AddString?

================
Comment at: lib/Target/ARM/ARMConstantPoolValue.h:174
@@ -175,3 +173,3 @@
 
-  const char *getSymbol() const { return S; }
+  const char *getSymbol() const { return S.c_str(); }
 
----------------
char*'s make me uncomfortable... particularly given how this function is used.  What are the lifetime rules for this string?


http://llvm-reviews.chandlerc.com/D230



More information about the llvm-commits mailing list