[llvm-commits] [llvm] r139279 - /llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp

Andrew Trick atrick at apple.com
Wed Sep 7 22:25:49 PDT 2011


Author: atrick
Date: Thu Sep  8 00:25:49 2011
New Revision: 139279

URL: http://llvm.org/viewvc/llvm-project?rev=139279&view=rev
Log:
Fix a use of freed string contents.

Speculatively try to fix our windows testers with a patch I found on the internet.

Modified:
    llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp

Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp?rev=139279&r1=139278&r2=139279&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Thu Sep  8 00:25:49 2011
@@ -764,11 +764,11 @@
 
 static void emitSinglePredicateMatch(raw_ostream &o, StringRef str,
                                      std::string PredicateNamespace) {
-  const char *X = str.str().c_str();
-  if (X[0] == '!')
-    o << "!(Bits & " << PredicateNamespace << "::" << &X[1] << ")";
+  if (str[0] == '!')
+    o << "!(Bits & " << PredicateNamespace << "::"
+      << str.slice(1,str.size()) << ")";
   else
-    o << "(Bits & " << PredicateNamespace << "::" << X << ")";
+    o << "(Bits & " << PredicateNamespace << "::" << str << ")";
 }
 
 bool FilterChooser::emitPredicateMatch(raw_ostream &o, unsigned &Indentation,





More information about the llvm-commits mailing list