From 8880d6274d8b12252d0c5a163255c7e722ed3ce3 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 17 Sep 2019 17:32:15 +0000 Subject: [PATCH] [TableGen] CodeGenMapTable - Don't dereference a dyn_cast result. NFCI. The static analyzer is warning about potential null dereferences of dyn_cast<> results - in these cases we can safely use cast<> directly as we know that these cases should all be the correct type, which is why its working atm and anyway cast<> will assert if they aren't. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372146 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/CodeGenMapTable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/TableGen/CodeGenMapTable.cpp b/utils/TableGen/CodeGenMapTable.cpp index 7a5175ac354..793bb61481e 100644 --- a/utils/TableGen/CodeGenMapTable.cpp +++ b/utils/TableGen/CodeGenMapTable.cpp @@ -132,7 +132,7 @@ public: MapRec->getName() + "' has empty " + "`ValueCols' field!"); for (Init *I : ColValList->getValues()) { - ListInit *ColI = dyn_cast(I); + auto *ColI = cast(I); // Make sure that all the sub-lists in 'ValueCols' have same number of // elements as the fields in 'ColFields'. @@ -521,7 +521,7 @@ static void emitEnums(raw_ostream &OS, RecordKeeper &Records) { unsigned ListSize = List->size(); for (unsigned j = 0; j < ListSize; j++) { - ListInit *ListJ = dyn_cast(List->getElement(j)); + auto *ListJ = cast(List->getElement(j)); if (ListJ->size() != ColFields->size()) PrintFatalError("Record `" + CurMap->getName() + "', field " -- 2.40.0