From 4fc782c025ce4ac399484b2e5b87a14880c5109a Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 30 Apr 2015 05:12:52 +0000 Subject: [PATCH] [TableGen] Merge a variable assignment and a return to drop curly braces. Fold an assignment into an if. Use auto on the result of a couple dyn_casts. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236204 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/TableGen/Record.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp index a72dcf1d129..c248370de17 100644 --- a/lib/TableGen/Record.cpp +++ b/lib/TableGen/Record.cpp @@ -1002,24 +1002,18 @@ static Init *EvaluateOperation(OpInit *RHSo, Init *LHS, Init *Arg, RecTy *Type, Record *CurRec, MultiClass *CurMultiClass) { // If this is a dag, recurse - if (TypedInit *TArg = dyn_cast(Arg)) { - if (TArg->getType()->getAsString() == "dag") { - Init *Result = ForeachHelper(LHS, Arg, RHSo, Type, - CurRec, CurMultiClass); - return Result; - } - } + if (auto *TArg = dyn_cast(Arg)) + if (TArg->getType()->getAsString() == "dag") + return ForeachHelper(LHS, Arg, RHSo, Type, CurRec, CurMultiClass); std::vector NewOperands; for (int i = 0; i < RHSo->getNumOperands(); ++i) { - if (OpInit *RHSoo = dyn_cast(RHSo->getOperand(i))) { - Init *Result = EvaluateOperation(RHSoo, LHS, Arg, - Type, CurRec, CurMultiClass); - if (Result) { + if (auto *RHSoo = dyn_cast(RHSo->getOperand(i))) { + if (Init *Result = EvaluateOperation(RHSoo, LHS, Arg, + Type, CurRec, CurMultiClass)) NewOperands.push_back(Result); - } else { + else NewOperands.push_back(Arg); - } } else if (LHS->getAsString() == RHSo->getOperand(i)->getAsString()) { NewOperands.push_back(Arg); } else { -- 2.34.1