[llvm-commits] [llvm] r134064 - /llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp

Francois Pichet pichet2000 at gmail.com
Wed Jun 29 04:25:34 PDT 2011


Author: fpichet
Date: Wed Jun 29 06:25:34 2011
New Revision: 134064

URL: http://llvm.org/viewvc/llvm-project?rev=134064&view=rev
Log:
Change AsmName's type from StringRef to std::string. AsmName was pointing to a temporary string object that was destroyed. This is undefined behavior and MSVC didn't like it.

This fixes over 300+ failing tests on MSVC.
Credit for this fix goes to chapuni.

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

Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=134064&r1=134063&r2=134064&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Wed Jun 29 06:25:34 2011
@@ -467,7 +467,7 @@
   for (unsigned i = 0, e = Registers.size(); i != e; ++i) {
     const CodeGenRegister &Reg = *Registers[i];
 
-    StringRef AsmName;
+    std::string AsmName;
     // "NoRegAltName" is special. We don't need to do a lookup for that,
     // as it's just a reference to the default register name.
     if (AltName == "" || AltName == "NoRegAltName") {





More information about the llvm-commits mailing list