[llvm] r236204 - [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

Craig Topper craig.topper at gmail.com
Wed Apr 29 22:12:52 PDT 2015


Author: ctopper
Date: Thu Apr 30 00:12:52 2015
New Revision: 236204

URL: http://llvm.org/viewvc/llvm-project?rev=236204&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/TableGen/Record.cpp

Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=236204&r1=236203&r2=236204&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Thu Apr 30 00:12:52 2015
@@ -1002,24 +1002,18 @@ static Init *EvaluateOperation(OpInit *R
                                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 {





More information about the llvm-commits mailing list