Don't fail tablegen immediately after failing to set a value.
authorPete Cooper <peter_cooper@apple.com>
Thu, 31 Jul 2014 01:44:00 +0000 (01:44 +0000)
committerPete Cooper <peter_cooper@apple.com>
Thu, 31 Jul 2014 01:44:00 +0000 (01:44 +0000)
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.

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

lib/TableGen/TGParser.cpp

index 54932487e8da9edf1fc4a1814f6db2ca4cdbefbe..a9de4eac9d32073dac4f354349bd98855bf3d5f8 100644 (file)
@@ -1734,7 +1734,10 @@ Init *TGParser::ParseDeclaration(Record *CurRec,
     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;