diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-10-24 12:46:45 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-10-24 12:46:45 +0000 |
commit | 55cb91eee98145e004374801c5aab583a2b1442b (patch) | |
tree | 46dfc36169a13ebc483d7318783be83d3abad0f2 /lib/TableGen | |
parent | d2c7e761d2699f8bd564744dee47ee3b8904bda7 (diff) | |
download | llvm-55cb91eee98145e004374801c5aab583a2b1442b.tar.gz |
[TblGen] ArrayRefize TGParser. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251186 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/TableGen')
-rw-r--r-- | lib/TableGen/Record.cpp | 2 | ||||
-rw-r--r-- | lib/TableGen/TGParser.cpp | 30 | ||||
-rw-r--r-- | lib/TableGen/TGParser.h | 16 |
3 files changed, 20 insertions, 28 deletions
diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp index 271e52567a2f..87a3422b32ab 100644 --- a/lib/TableGen/Record.cpp +++ b/lib/TableGen/Record.cpp @@ -1641,7 +1641,7 @@ void Record::dump() const { errs() << *this; } raw_ostream &llvm::operator<<(raw_ostream &OS, const Record &R) { OS << R.getNameInitAsString(); - const std::vector<Init *> &TArgs = R.getTemplateArgs(); + ArrayRef<Init *> TArgs = R.getTemplateArgs(); if (!TArgs.empty()) { OS << "<"; bool NeedComma = false; diff --git a/lib/TableGen/TGParser.cpp b/lib/TableGen/TGParser.cpp index 5c36fda2e1ca..e5f6f165d13f 100644 --- a/lib/TableGen/TGParser.cpp +++ b/lib/TableGen/TGParser.cpp @@ -152,7 +152,7 @@ bool TGParser::AddSubClass(Record *CurRec, SubClassReference &SubClass) { if (AddValue(CurRec, SubClass.RefRange.Start, Val)) return true; - const std::vector<Init *> &TArgs = SC->getTemplateArgs(); + ArrayRef<Init *> TArgs = SC->getTemplateArgs(); // Ensure that an appropriate number of template arguments are specified. if (TArgs.size() < SubClass.TemplateArgs.size()) @@ -228,7 +228,7 @@ bool TGParser::AddSubMultiClass(MultiClass *CurMC, CurMC->DefPrototypes.push_back(std::move(NewDef)); } - const std::vector<Init *> &SMCTArgs = SMC->Rec.getTemplateArgs(); + ArrayRef<Init *> SMCTArgs = SMC->Rec.getTemplateArgs(); // Ensure that an appropriate number of template arguments are // specified. @@ -1641,7 +1641,7 @@ std::vector<Init*> TGParser::ParseValueList(Record *CurRec, Record *ArgsRec, RecTy *ItemType = EltTy; unsigned int ArgN = 0; if (ArgsRec && !EltTy) { - const std::vector<Init *> &TArgs = ArgsRec->getTemplateArgs(); + ArrayRef<Init *> TArgs = ArgsRec->getTemplateArgs(); if (TArgs.empty()) { TokError("template argument provided to non-template class"); return std::vector<Init*>(); @@ -1662,7 +1662,7 @@ std::vector<Init*> TGParser::ParseValueList(Record *CurRec, Record *ArgsRec, Lex.Lex(); // Eat the comma if (ArgsRec && !EltTy) { - const std::vector<Init *> &TArgs = ArgsRec->getTemplateArgs(); + ArrayRef<Init *> TArgs = ArgsRec->getTemplateArgs(); if (ArgN >= TArgs.size()) { TokError("too many template arguments"); return std::vector<Init*>(); @@ -2313,13 +2313,11 @@ bool TGParser::ParseMultiClass() { return false; } -Record *TGParser:: -InstantiateMulticlassDef(MultiClass &MC, - Record *DefProto, - Init *&DefmPrefix, - SMRange DefmPrefixRange, - const std::vector<Init *> &TArgs, - std::vector<Init *> &TemplateVals) { +Record *TGParser::InstantiateMulticlassDef(MultiClass &MC, Record *DefProto, + Init *&DefmPrefix, + SMRange DefmPrefixRange, + ArrayRef<Init *> TArgs, + std::vector<Init *> &TemplateVals) { // We need to preserve DefProto so it can be reused for later // instantiations, so create a new Record to inherit from it. @@ -2437,11 +2435,9 @@ InstantiateMulticlassDef(MultiClass &MC, return CurRec.release(); } -bool TGParser::ResolveMulticlassDefArgs(MultiClass &MC, - Record *CurRec, - SMLoc DefmPrefixLoc, - SMLoc SubClassLoc, - const std::vector<Init *> &TArgs, +bool TGParser::ResolveMulticlassDefArgs(MultiClass &MC, Record *CurRec, + SMLoc DefmPrefixLoc, SMLoc SubClassLoc, + ArrayRef<Init *> TArgs, std::vector<Init *> &TemplateVals, bool DeleteArgs) { // Loop over all of the template arguments, setting them to the specified @@ -2540,7 +2536,7 @@ bool TGParser::ParseDefm(MultiClass *CurMultiClass) { std::vector<Init*> &TemplateVals = Ref.TemplateArgs; // Verify that the correct number of template arguments were specified. - const std::vector<Init *> &TArgs = MC->Rec.getTemplateArgs(); + ArrayRef<Init *> TArgs = MC->Rec.getTemplateArgs(); if (TArgs.size() < TemplateVals.size()) return Error(SubClassLoc, "more template args specified than multiclass expects"); diff --git a/lib/TableGen/TGParser.h b/lib/TableGen/TGParser.h index d69d1f4572f9..8b41134d4ff1 100644 --- a/lib/TableGen/TGParser.h +++ b/lib/TableGen/TGParser.h @@ -135,17 +135,13 @@ private: // Parser methods. bool ParseObject(MultiClass *MC); bool ParseClass(); bool ParseMultiClass(); - Record *InstantiateMulticlassDef(MultiClass &MC, - Record *DefProto, - Init *&DefmPrefix, - SMRange DefmPrefixRange, - const std::vector<Init *> &TArgs, + Record *InstantiateMulticlassDef(MultiClass &MC, Record *DefProto, + Init *&DefmPrefix, SMRange DefmPrefixRange, + ArrayRef<Init *> TArgs, std::vector<Init *> &TemplateVals); - bool ResolveMulticlassDefArgs(MultiClass &MC, - Record *DefProto, - SMLoc DefmPrefixLoc, - SMLoc SubClassLoc, - const std::vector<Init *> &TArgs, + bool ResolveMulticlassDefArgs(MultiClass &MC, Record *DefProto, + SMLoc DefmPrefixLoc, SMLoc SubClassLoc, + ArrayRef<Init *> TArgs, std::vector<Init *> &TemplateVals, bool DeleteArgs); bool ResolveMulticlassDef(MultiClass &MC, |