Index: llvm/include/llvm/TableGen/Record.h =================================================================== --- llvm/include/llvm/TableGen/Record.h +++ llvm/include/llvm/TableGen/Record.h @@ -1471,7 +1471,14 @@ class Record { public: - using AssertionTuple = std::tuple; + struct AssertionInfo { + SMLoc Loc; + Init *Condition; + Init *Message; + + AssertionInfo(SMLoc Loc, Init *Condition, Init *Message) : + Loc(Loc), Condition(Condition), Message(Message) {} + }; private: static unsigned LastID; @@ -1482,8 +1489,7 @@ SmallVector Locs; SmallVector TemplateArgs; SmallVector Values; - // Vector of [source location, condition Init, message Init]. - SmallVector Assertions; + SmallVector Assertions; // All superclasses in the inheritance forest in post-order (yes, it // must be a forest; diamond-shaped inheritance is not allowed). @@ -1558,7 +1564,7 @@ ArrayRef getValues() const { return Values; } - ArrayRef getAssertions() const { return Assertions; } + ArrayRef getAssertions() const { return Assertions; } ArrayRef> getSuperClasses() const { return SuperClasses; @@ -1616,7 +1622,7 @@ } void addAssertion(SMLoc Loc, Init *Condition, Init *Message) { - Assertions.push_back(std::make_tuple(Loc, Condition, Message)); + Assertions.push_back(AssertionInfo(Loc, Condition, Message)); } void appendAssertions(const Record *Rec) { Index: llvm/lib/TableGen/Record.cpp =================================================================== --- llvm/lib/TableGen/Record.cpp +++ llvm/lib/TableGen/Record.cpp @@ -2379,10 +2379,10 @@ // Resolve the assertion expressions. for (auto &Assertion : Assertions) { - Init *Value = std::get<1>(Assertion)->resolveReferences(R); - std::get<1>(Assertion) = Value; - Value = std::get<2>(Assertion)->resolveReferences(R); - std::get<2>(Assertion) = Value; + Init *Value = Assertion.Condition->resolveReferences(R); + Assertion.Condition = Value; + Value = Assertion.Message->resolveReferences(R); + Assertion.Message = Value; } } @@ -2634,9 +2634,9 @@ R.setFinal(true); for (auto Assertion : getAssertions()) { - Init *Condition = std::get<1>(Assertion)->resolveReferences(R); - Init *Message = std::get<2>(Assertion)->resolveReferences(R); - CheckAssert(std::get<0>(Assertion), Condition, Message); + Init *Condition = Assertion.Condition->resolveReferences(R); + Init *Message = Assertion.Message->resolveReferences(R); + CheckAssert(Assertion.Loc, Condition, Message); } } Index: llvm/lib/TableGen/TGParser.h =================================================================== --- llvm/lib/TableGen/TGParser.h +++ llvm/lib/TableGen/TGParser.h @@ -37,11 +37,11 @@ }; /// RecordsEntry - Holds exactly one of a Record, ForeachLoop, or - /// assertion tuple. + /// AssertionInfo. struct RecordsEntry { std::unique_ptr Rec; std::unique_ptr Loop; - std::unique_ptr Assertion; + std::unique_ptr Assertion; void dump() const; @@ -49,7 +49,7 @@ RecordsEntry(std::unique_ptr Rec) : Rec(std::move(Rec)) {} RecordsEntry(std::unique_ptr Loop) : Loop(std::move(Loop)) {} - RecordsEntry(std::unique_ptr Assertion) + RecordsEntry(std::unique_ptr Assertion) : Assertion(std::move(Assertion)) {} }; Index: llvm/lib/TableGen/TGParser.cpp =================================================================== --- llvm/lib/TableGen/TGParser.cpp +++ llvm/lib/TableGen/TGParser.cpp @@ -365,8 +365,9 @@ // If it is an assertion, then it's a top-level one, so check it. if (E.Assertion) { - CheckAssert(std::get<0>(*E.Assertion), std::get<1>(*E.Assertion), - std::get<2>(*E.Assertion)); + CheckAssert((*E.Assertion).AssertionInfo::Loc, + (*E.Assertion).AssertionInfo::Condition, + (*E.Assertion).AssertionInfo::Message); return false; } @@ -430,17 +431,19 @@ MapResolver R; for (const auto &S : Substs) R.set(S.first, S.second); - Init *Condition = std::get<1>(*E.Assertion)->resolveReferences(R); - Init *Message = std::get<2>(*E.Assertion)->resolveReferences(R); + Init *Condition = (*E.Assertion).AssertionInfo::Condition-> + resolveReferences(R); + Init *Message = (*E.Assertion).AssertionInfo::Message-> + resolveReferences(R); if (Dest) { - std::unique_ptr Tuple = - std::make_unique(std::get<0>(*E.Assertion), - std::move(Condition), - std::move(Message)); - Dest->push_back(std::move(Tuple)); + std::unique_ptr Info = + std::make_unique( + (*E.Assertion).AssertionInfo::Loc, std::move(Condition), + std::move(Message)); + Dest->push_back(std::move(Info)); } else { - CheckAssert(std::get<0>(*E.Assertion), Condition, Message); + CheckAssert((*E.Assertion).AssertionInfo::Loc, Condition, Message); } } else { @@ -3221,9 +3224,10 @@ if (CurRec) { CurRec->addAssertion(ConditionLoc, Condition, Message); } else { - std::unique_ptr Tuple = - std::make_unique(ConditionLoc, Condition, Message); - addEntry(std::move(Tuple)); + std::unique_ptr Info = + std::make_unique(ConditionLoc, Condition, + Message); + addEntry(std::move(Info)); } return false;