[llvm] r327119 - TableGen: Remove unused ParseForeachMode

Nicolai Haehnle via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 04:24:20 PST 2018


Author: nha
Date: Fri Mar  9 04:24:20 2018
New Revision: 327119

URL: http://llvm.org/viewvc/llvm-project?rev=327119&view=rev
Log:
TableGen: Remove unused ParseForeachMode

Use the default ParseValueMode instead of ParseForeachMode when
parsing the rule

  ForeachDeclaration ::= ID '=' '[' ValueList ']'

because the only difference between the two is how an open brace '{'
is handled at the end. In the context of foreach, the 'in' keyword
will appear after the ForeachDeclaration, so this special handling
of '{' is not required.

Change-Id: I4d86bb73bab9ec26752e1273e5213df77cf28d1d

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

Modified: llvm/trunk/lib/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.cpp?rev=327119&r1=327118&r2=327119&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp (original)
+++ llvm/trunk/lib/TableGen/TGParser.cpp Fri Mar  9 04:24:20 2018
@@ -1761,7 +1761,7 @@ Init *TGParser::ParseValue(Record *CurRe
     switch (Lex.getCode()) {
     default: return Result;
     case tgtok::l_brace: {
-      if (Mode == ParseNameMode || Mode == ParseForeachMode)
+      if (Mode == ParseNameMode)
         // This is the beginning of the object body.
         return Result;
 
@@ -2064,7 +2064,7 @@ VarInit *TGParser::ParseForeachDeclarati
   switch (Lex.getCode()) {
   default: TokError("Unknown token when expecting a range list"); return nullptr;
   case tgtok::l_square: { // '[' ValueList ']'
-    Init *List = ParseSimpleValue(nullptr, nullptr, ParseForeachMode);
+    Init *List = ParseSimpleValue(nullptr);
     ForeachListValue = dyn_cast<ListInit>(List);
     if (!ForeachListValue) {
       TokError("Expected a Value list");

Modified: llvm/trunk/lib/TableGen/TGParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.h?rev=327119&r1=327118&r2=327119&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGParser.h (original)
+++ llvm/trunk/lib/TableGen/TGParser.h Fri Mar  9 04:24:20 2018
@@ -77,7 +77,6 @@ class TGParser {
     ParseValueMode,   // We are parsing a value we expect to look up.
     ParseNameMode,    // We are parsing a name of an object that does not yet
                       // exist.
-    ParseForeachMode  // We are parsing a foreach init.
   };
 
 public:




More information about the llvm-commits mailing list