// 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;
}
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;