summaryrefslogtreecommitdiff
path: root/lib/TableGen/TGParser.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
commit01095a5d43bbfde13731688ddcf6048ebb8b7721 (patch)
tree4def12e759965de927d963ac65840d663ef9d1ea /lib/TableGen/TGParser.cpp
parentf0f4822ed4b66e3579e92a89f368f8fb860e218e (diff)
Notes
Diffstat (limited to 'lib/TableGen/TGParser.cpp')
-rw-r--r--lib/TableGen/TGParser.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/TableGen/TGParser.cpp b/lib/TableGen/TGParser.cpp
index 1506a7171ac4..34e90925e929 100644
--- a/lib/TableGen/TGParser.cpp
+++ b/lib/TableGen/TGParser.cpp
@@ -15,10 +15,8 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/CommandLine.h"
#include "llvm/TableGen/Record.h"
#include <algorithm>
-#include <sstream>
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -45,7 +43,7 @@ struct SubMultiClassReference {
void dump() const;
};
-void SubMultiClassReference::dump() const {
+LLVM_DUMP_METHOD void SubMultiClassReference::dump() const {
errs() << "Multiclass:\n";
MC->dump();
@@ -185,13 +183,12 @@ bool TGParser::AddSubClass(Record *CurRec, SubClassReference &SubClass) {
// Since everything went well, we can now set the "superclass" list for the
// current record.
- ArrayRef<Record *> SCs = SC->getSuperClasses();
- ArrayRef<SMRange> SCRanges = SC->getSuperClassRanges();
- for (unsigned i = 0, e = SCs.size(); i != e; ++i) {
- if (CurRec->isSubClassOf(SCs[i]))
+ ArrayRef<std::pair<Record *, SMRange>> SCs = SC->getSuperClasses();
+ for (const auto &SCPair : SCs) {
+ if (CurRec->isSubClassOf(SCPair.first))
return Error(SubClass.RefRange.Start,
- "Already subclass of '" + SCs[i]->getName() + "'!\n");
- CurRec->addSuperClass(SCs[i], SCRanges[i]);
+ "Already subclass of '" + SCPair.first->getName() + "'!\n");
+ CurRec->addSuperClass(SCPair.first, SCPair.second);
}
if (CurRec->isSubClassOf(SC))
@@ -663,7 +660,7 @@ RecTy *TGParser::ParseType() {
switch (Lex.getCode()) {
default: TokError("Unknown token when expecting a type"); return nullptr;
case tgtok::String: Lex.Lex(); return StringRecTy::get();
- case tgtok::Code: Lex.Lex(); return StringRecTy::get();
+ case tgtok::Code: Lex.Lex(); return CodeRecTy::get();
case tgtok::Bit: Lex.Lex(); return BitRecTy::get();
case tgtok::Int: Lex.Lex(); return IntRecTy::get();
case tgtok::Dag: Lex.Lex(); return DagRecTy::get();
@@ -1167,7 +1164,7 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType,
break;
}
case tgtok::CodeFragment:
- R = StringInit::get(Lex.getCurStrVal());
+ R = CodeInit::get(Lex.getCurStrVal());
Lex.Lex();
break;
case tgtok::question:
@@ -2543,7 +2540,7 @@ bool TGParser::ParseDefm(MultiClass *CurMultiClass) {
// The record name construction goes as follow:
// - If the def name is a string, prepend the prefix.
// - If the def name is a more complex pattern, use that pattern.
- // As a result, the record is instanciated before resolving
+ // As a result, the record is instantiated before resolving
// arguments, as it would make its name a string.
Record *CurRec = InstantiateMulticlassDef(*MC, DefProto.get(), DefmPrefix,
SMRange(DefmLoc,
@@ -2552,7 +2549,7 @@ bool TGParser::ParseDefm(MultiClass *CurMultiClass) {
if (!CurRec)
return true;
- // Now that the record is instanciated, we can resolve arguments.
+ // Now that the record is instantiated, we can resolve arguments.
if (ResolveMulticlassDefArgs(*MC, CurRec, DefmLoc, SubClassLoc,
TArgs, TemplateVals, true/*Delete args*/))
return Error(SubClassLoc, "could not instantiate def");