[llvm] r251186 - [TblGen] ArrayRefize TGParser. No functional change intended.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 24 05:46:46 PDT 2015
Author: d0k
Date: Sat Oct 24 07:46:45 2015
New Revision: 251186
URL: http://llvm.org/viewvc/llvm-project?rev=251186&view=rev
Log:
[TblGen] ArrayRefize TGParser. No functional change intended.
Modified:
llvm/trunk/lib/TableGen/Record.cpp
llvm/trunk/lib/TableGen/TGParser.cpp
llvm/trunk/lib/TableGen/TGParser.h
Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=251186&r1=251185&r2=251186&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Sat Oct 24 07:46:45 2015
@@ -1641,7 +1641,7 @@ void Record::dump() const { errs() << *t
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;
Modified: llvm/trunk/lib/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.cpp?rev=251186&r1=251185&r2=251186&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp (original)
+++ llvm/trunk/lib/TableGen/TGParser.cpp Sat Oct 24 07:46:45 2015
@@ -152,7 +152,7 @@ bool TGParser::AddSubClass(Record *CurRe
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(MultiCla
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::ParseValueL
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::ParseValueL
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 *Cur
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");
Modified: llvm/trunk/lib/TableGen/TGParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.h?rev=251186&r1=251185&r2=251186&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGParser.h (original)
+++ llvm/trunk/lib/TableGen/TGParser.h Sat Oct 24 07:46:45 2015
@@ -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,
More information about the llvm-commits
mailing list