[TableGen] Use ArrayRef instead of SmallVectorImpl for suitable method

PiperOrigin-RevId: 235577399
This commit is contained in:
Lei Zhang
2019-02-25 12:10:40 -08:00
committed by jpienaar
parent 62c54a2ec4
commit 3f644705eb
3 changed files with 6 additions and 6 deletions

View File

@@ -63,7 +63,7 @@ public:
std::string getQualCppClassName() const;
// Returns the TableGen definition name split around '_'.
const SmallVectorImpl<StringRef> &getSplitDefName() const;
ArrayRef<StringRef> getSplitDefName() const;
// Returns the number of results this op produces.
int getNumResults() const;

View File

@@ -39,7 +39,7 @@ tblgen::Operator::Operator(const llvm::Record &def) : def(def) {
populateOpStructure();
}
const SmallVectorImpl<StringRef> &tblgen::Operator::getSplitDefName() const {
ArrayRef<StringRef> tblgen::Operator::getSplitDefName() const {
return splittedDefName;
}

View File

@@ -145,10 +145,10 @@ OpEmitter::OpEmitter(const Record &def, raw_ostream &os)
: def(def), op(def), os(os) {}
void OpEmitter::mapOverClassNamespaces(function_ref<void(StringRef)> fn) {
auto &splittedDefName = op.getSplitDefName();
for (auto it = splittedDefName.begin(), e = std::prev(splittedDefName.end());
it != e; ++it)
fn(*it);
// We only care about namespaces, so drop the class name here
auto splittedDefName = op.getSplitDefName().drop_back();
for (auto ns : splittedDefName)
fn(ns);
}
void OpEmitter::emit(const Record &def, raw_ostream &os) {