[PATCH] D44115: TableGen: Explicitly forbid some nestings of class, multiclass, and foreach

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 14 04:03:39 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL327497: TableGen: Explicitly forbid some nestings of class, multiclass, and foreach (authored by nha, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44115?vs=137063&id=138325#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44115

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


Index: llvm/trunk/lib/TableGen/TGParser.cpp
===================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp
+++ llvm/trunk/lib/TableGen/TGParser.cpp
@@ -3143,8 +3143,16 @@
     if (MC)
       return TokError("defset is not allowed inside multiclass");
     return ParseDefset();
-  case tgtok::Class: return ParseClass();
-  case tgtok::MultiClass: return ParseMultiClass();
+  case tgtok::Class:
+    if (MC)
+      return TokError("class is not allowed inside multiclass");
+    if (!Loops.empty())
+      return TokError("class is not allowed inside foreach loop");
+    return ParseClass();
+  case tgtok::MultiClass:
+    if (!Loops.empty())
+      return TokError("multiclass is not allowed inside foreach loop");
+    return ParseMultiClass();
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44115.138325.patch
Type: text/x-patch
Size: 806 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180314/77713b6d/attachment.bin>


More information about the llvm-commits mailing list