[OperandBundles] Tighten OperandBundleDef's interface; NFC
[oota-llvm.git] / lib / AsmParser / LLParser.cpp
index 2c6e8081c13646d412e981b333f1025c16ee9de0..2d09b18a9019305fa9d08890522d8b287e377483 100644 (file)
@@ -1972,17 +1972,13 @@ bool LLParser::ParseOptionalOperandBundles(
     if (ParseStringConstant(Tag))
       return true;
 
-    BundleList.emplace_back();
-    auto &OBI = BundleList.back();
-
-    OBI.Tag = std::move(Tag);
-
     if (ParseToken(lltok::lparen, "expected '(' in operand bundle"))
       return true;
 
+    std::vector<Value *> Inputs;
     while (Lex.getKind() != lltok::rparen) {
       // If this isn't the first input, we need a comma.
-      if (!OBI.Inputs.empty() &&
+      if (!Inputs.empty() &&
           ParseToken(lltok::comma, "expected ',' in input list"))
         return true;
 
@@ -1990,9 +1986,11 @@ bool LLParser::ParseOptionalOperandBundles(
       Value *Input = nullptr;
       if (ParseType(Ty) || ParseValue(Ty, Input, PFS))
         return true;
-      OBI.Inputs.push_back(Input);
+      Inputs.push_back(Input);
     }
 
+    BundleList.emplace_back(std::move(Tag), std::move(Inputs));
+
     Lex.Lex(); // Lex the ')'.
   }