[TableGen] Fix error message that called Record::getName on a possibly anonymous...
authorCraig Topper <craig.topper@sifive.com>
Tue, 7 Mar 2023 03:56:43 +0000 (19:56 -0800)
committerCraig Topper <craig.topper@sifive.com>
Tue, 7 Mar 2023 03:58:47 +0000 (19:58 -0800)
Record::getName only works for named records. Use getNameInitAsString
to handle anonymous records without crashing.

llvm/lib/TableGen/Record.cpp

index 654857f..363bf7b 100644 (file)
@@ -2259,7 +2259,7 @@ Init *CondOpInit::Fold(Record *CurRec) const {
   }
 
   PrintFatalError(CurRec->getLoc(),
-                  CurRec->getName() +
+                  CurRec->getNameInitAsString() +
                   " does not have any true condition in:" +
                   this->getAsString());
   return nullptr;