diff options
author | Craig Topper <craig.topper@gmail.com> | 2015-04-30 05:12:52 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2015-04-30 05:12:52 +0000 |
commit | 9ef76499b2973dfc27136910b72d0c2e07800e99 (patch) | |
tree | 182c490d8511a530f0c7d9e1fa7093cb74cdb122 /llvm/lib/TableGen/Record.cpp | |
parent | 08e95b47032d100f9d40dbf09fb7c8559d1ca505 (diff) | |
download | bcm5719-llvm-9ef76499b2973dfc27136910b72d0c2e07800e99.tar.gz bcm5719-llvm-9ef76499b2973dfc27136910b72d0c2e07800e99.zip |
[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
llvm-svn: 236204
Diffstat (limited to 'llvm/lib/TableGen/Record.cpp')
-rw-r--r-- | llvm/lib/TableGen/Record.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp index a72dcf1d129..c248370de17 100644 --- a/llvm/lib/TableGen/Record.cpp +++ b/llvm/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<TypedInit>(Arg)) { - if (TArg->getType()->getAsString() == "dag") { - Init *Result = ForeachHelper(LHS, Arg, RHSo, Type, - CurRec, CurMultiClass); - return Result; - } - } + if (auto *TArg = dyn_cast<TypedInit>(Arg)) + if (TArg->getType()->getAsString() == "dag") + return ForeachHelper(LHS, Arg, RHSo, Type, CurRec, CurMultiClass); std::vector<Init *> NewOperands; for (int i = 0; i < RHSo->getNumOperands(); ++i) { - if (OpInit *RHSoo = dyn_cast<OpInit>(RHSo->getOperand(i))) { - Init *Result = EvaluateOperation(RHSoo, LHS, Arg, - Type, CurRec, CurMultiClass); - if (Result) { + if (auto *RHSoo = dyn_cast<OpInit>(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 { |