[llvm] [TableGen] Support type aliases via new keyword deftype (PR #79570)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 21:15:20 PST 2024


================
@@ -3665,6 +3671,42 @@ bool TGParser::ParseDefset() {
   return false;
 }
 
+/// ParseDeftype - Parse a defvar statement.
+///
+///   Deftype ::= DEFTYPE Id '=' Type ';'
+///
+bool TGParser::ParseDeftype() {
+  assert(Lex.getCode() == tgtok::Deftype);
+  Lex.Lex(); // Eat the 'deftype' token
+
+  if (Lex.getCode() != tgtok::Id)
+    return TokError("expected identifier");
+
+  std::string TypeName = Lex.getCurStrVal();
----------------
topperc wrote:

Can this be `const std::string &` which I believe is what getCurStrVal returns.

https://github.com/llvm/llvm-project/pull/79570


More information about the llvm-commits mailing list