diff options
Diffstat (limited to 'llvm/lib/TableGen/TGParser.cpp')
-rw-r--r-- | llvm/lib/TableGen/TGParser.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp index 937de9e5c52..6a460870aa9 100644 --- a/llvm/lib/TableGen/TGParser.cpp +++ b/llvm/lib/TableGen/TGParser.cpp @@ -2189,14 +2189,15 @@ Init *TGParser::ParseValue(Record *CurRec, RecTy *ItemType, IDParseMode Mode) { // Create a !strconcat() operation, first casting each operand to // a string if necessary. if (LHS->getType() != StringRecTy::get()) { - LHS = dyn_cast<TypedInit>( + auto CastLHS = dyn_cast<TypedInit>( UnOpInit::get(UnOpInit::CAST, LHS, StringRecTy::get()) ->Fold(CurRec)); - if (!LHS) { - Error(PasteLoc, Twine("can't cast '") + LHS->getAsString() + - "' to string"); + if (!CastLHS) { + Error(PasteLoc, + Twine("can't cast '") + LHS->getAsString() + "' to string"); return nullptr; } + LHS = CastLHS; } TypedInit *RHS = nullptr; @@ -2223,14 +2224,15 @@ Init *TGParser::ParseValue(Record *CurRec, RecTy *ItemType, IDParseMode Mode) { } if (RHS->getType() != StringRecTy::get()) { - RHS = dyn_cast<TypedInit>( + auto CastRHS = dyn_cast<TypedInit>( UnOpInit::get(UnOpInit::CAST, RHS, StringRecTy::get()) ->Fold(CurRec)); - if (!RHS) { - Error(PasteLoc, Twine("can't cast '") + RHS->getAsString() + - "' to string"); + if (!CastRHS) { + Error(PasteLoc, + Twine("can't cast '") + RHS->getAsString() + "' to string"); return nullptr; } + RHS = CastRHS; } break; |