[llvm] r214375 - Don't fail tablegen immediately after failing to set a value.

Pete Cooper peter_cooper at apple.com
Wed Jul 30 18:44:00 PDT 2014


Author: pete
Date: Wed Jul 30 20:44:00 2014
New Revision: 214375

URL: http://llvm.org/viewvc/llvm-project?rev=214375&view=rev
Log:
Don't fail tablegen immediately after failing to set a value.

Instead allow the variable to be declared, but don't attach an initializer. This allows more than a single error to be emitted before we exit.

Test case to follow soon in another patch.

Modified:
    llvm/trunk/lib/TableGen/TGParser.cpp

Modified: llvm/trunk/lib/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.cpp?rev=214375&r1=214374&r2=214375&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp (original)
+++ llvm/trunk/lib/TableGen/TGParser.cpp Wed Jul 30 20:44:00 2014
@@ -1734,7 +1734,10 @@ Init *TGParser::ParseDeclaration(Record
     Init *Val = ParseValue(CurRec, Type);
     if (!Val ||
         SetValue(CurRec, ValLoc, DeclName, std::vector<unsigned>(), Val))
-      return nullptr;
+      // Return the name, even if an error is thrown.  This is so that we can
+      // continue to make some progress, even without the value having been
+      // initialized.
+      return DeclName;
   }
 
   return DeclName;





More information about the llvm-commits mailing list