Fix a use of freed string contents.
authorAndrew Trick <atrick@apple.com>
Thu, 8 Sep 2011 05:25:49 +0000 (05:25 +0000)
committerAndrew Trick <atrick@apple.com>
Thu, 8 Sep 2011 05:25:49 +0000 (05:25 +0000)
Speculatively try to fix our windows testers with a patch I found on the internet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139279 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/FixedLenDecoderEmitter.cpp

index c0b51385b1a68cc50ce5795d71989e428aea4d67..85f3dbfa5f606efb1b2682aa3e5d299bcc7e4dd5 100644 (file)
@@ -764,11 +764,11 @@ void FilterChooser::emitBinaryParser(raw_ostream &o, unsigned &Indentation,
 
 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,