Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 55cb91e

Browse files
committed
[TblGen] ArrayRefize TGParser. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251186 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent d2c7e76 commit 55cb91e

File tree

3 files changed

+20
-28
lines changed

3 files changed

+20
-28
lines changed

lib/TableGen/Record.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ void Record::dump() const { errs() << *this; }
16411641
raw_ostream &llvm::operator<<(raw_ostream &OS, const Record &R) {
16421642
OS << R.getNameInitAsString();
16431643

1644-
const std::vector<Init *> &TArgs = R.getTemplateArgs();
1644+
ArrayRef<Init *> TArgs = R.getTemplateArgs();
16451645
if (!TArgs.empty()) {
16461646
OS << "<";
16471647
bool NeedComma = false;

lib/TableGen/TGParser.cpp

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ bool TGParser::AddSubClass(Record *CurRec, SubClassReference &SubClass) {
152152
if (AddValue(CurRec, SubClass.RefRange.Start, Val))
153153
return true;
154154

155-
const std::vector<Init *> &TArgs = SC->getTemplateArgs();
155+
ArrayRef<Init *> TArgs = SC->getTemplateArgs();
156156

157157
// Ensure that an appropriate number of template arguments are specified.
158158
if (TArgs.size() < SubClass.TemplateArgs.size())
@@ -228,7 +228,7 @@ bool TGParser::AddSubMultiClass(MultiClass *CurMC,
228228
CurMC->DefPrototypes.push_back(std::move(NewDef));
229229
}
230230

231-
const std::vector<Init *> &SMCTArgs = SMC->Rec.getTemplateArgs();
231+
ArrayRef<Init *> SMCTArgs = SMC->Rec.getTemplateArgs();
232232

233233
// Ensure that an appropriate number of template arguments are
234234
// specified.
@@ -1641,7 +1641,7 @@ std::vector<Init*> TGParser::ParseValueList(Record *CurRec, Record *ArgsRec,
16411641
RecTy *ItemType = EltTy;
16421642
unsigned int ArgN = 0;
16431643
if (ArgsRec && !EltTy) {
1644-
const std::vector<Init *> &TArgs = ArgsRec->getTemplateArgs();
1644+
ArrayRef<Init *> TArgs = ArgsRec->getTemplateArgs();
16451645
if (TArgs.empty()) {
16461646
TokError("template argument provided to non-template class");
16471647
return std::vector<Init*>();
@@ -1662,7 +1662,7 @@ std::vector<Init*> TGParser::ParseValueList(Record *CurRec, Record *ArgsRec,
16621662
Lex.Lex(); // Eat the comma
16631663

16641664
if (ArgsRec && !EltTy) {
1665-
const std::vector<Init *> &TArgs = ArgsRec->getTemplateArgs();
1665+
ArrayRef<Init *> TArgs = ArgsRec->getTemplateArgs();
16661666
if (ArgN >= TArgs.size()) {
16671667
TokError("too many template arguments");
16681668
return std::vector<Init*>();
@@ -2313,13 +2313,11 @@ bool TGParser::ParseMultiClass() {
23132313
return false;
23142314
}
23152315

2316-
Record *TGParser::
2317-
InstantiateMulticlassDef(MultiClass &MC,
2318-
Record *DefProto,
2319-
Init *&DefmPrefix,
2320-
SMRange DefmPrefixRange,
2321-
const std::vector<Init *> &TArgs,
2322-
std::vector<Init *> &TemplateVals) {
2316+
Record *TGParser::InstantiateMulticlassDef(MultiClass &MC, Record *DefProto,
2317+
Init *&DefmPrefix,
2318+
SMRange DefmPrefixRange,
2319+
ArrayRef<Init *> TArgs,
2320+
std::vector<Init *> &TemplateVals) {
23232321
// We need to preserve DefProto so it can be reused for later
23242322
// instantiations, so create a new Record to inherit from it.
23252323

@@ -2437,11 +2435,9 @@ InstantiateMulticlassDef(MultiClass &MC,
24372435
return CurRec.release();
24382436
}
24392437

2440-
bool TGParser::ResolveMulticlassDefArgs(MultiClass &MC,
2441-
Record *CurRec,
2442-
SMLoc DefmPrefixLoc,
2443-
SMLoc SubClassLoc,
2444-
const std::vector<Init *> &TArgs,
2438+
bool TGParser::ResolveMulticlassDefArgs(MultiClass &MC, Record *CurRec,
2439+
SMLoc DefmPrefixLoc, SMLoc SubClassLoc,
2440+
ArrayRef<Init *> TArgs,
24452441
std::vector<Init *> &TemplateVals,
24462442
bool DeleteArgs) {
24472443
// Loop over all of the template arguments, setting them to the specified
@@ -2540,7 +2536,7 @@ bool TGParser::ParseDefm(MultiClass *CurMultiClass) {
25402536
std::vector<Init*> &TemplateVals = Ref.TemplateArgs;
25412537

25422538
// Verify that the correct number of template arguments were specified.
2543-
const std::vector<Init *> &TArgs = MC->Rec.getTemplateArgs();
2539+
ArrayRef<Init *> TArgs = MC->Rec.getTemplateArgs();
25442540
if (TArgs.size() < TemplateVals.size())
25452541
return Error(SubClassLoc,
25462542
"more template args specified than multiclass expects");

lib/TableGen/TGParser.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,13 @@ class TGParser {
135135
bool ParseObject(MultiClass *MC);
136136
bool ParseClass();
137137
bool ParseMultiClass();
138-
Record *InstantiateMulticlassDef(MultiClass &MC,
139-
Record *DefProto,
140-
Init *&DefmPrefix,
141-
SMRange DefmPrefixRange,
142-
const std::vector<Init *> &TArgs,
138+
Record *InstantiateMulticlassDef(MultiClass &MC, Record *DefProto,
139+
Init *&DefmPrefix, SMRange DefmPrefixRange,
140+
ArrayRef<Init *> TArgs,
143141
std::vector<Init *> &TemplateVals);
144-
bool ResolveMulticlassDefArgs(MultiClass &MC,
145-
Record *DefProto,
146-
SMLoc DefmPrefixLoc,
147-
SMLoc SubClassLoc,
148-
const std::vector<Init *> &TArgs,
142+
bool ResolveMulticlassDefArgs(MultiClass &MC, Record *DefProto,
143+
SMLoc DefmPrefixLoc, SMLoc SubClassLoc,
144+
ArrayRef<Init *> TArgs,
149145
std::vector<Init *> &TemplateVals,
150146
bool DeleteArgs);
151147
bool ResolveMulticlassDef(MultiClass &MC,

0 commit comments

Comments
 (0)