[llvm] [TableGen][NFC] Remove MultiClass argument and Scoper in QualifyName (PR #69297)
Nicolai Hähnle via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 22 19:46:31 PDT 2023
================
@@ -111,42 +111,43 @@ static void checkConcrete(Record &R) {
/// Return an Init with a qualifier prefix referring
/// to CurRec's name.
-static Init *QualifyName(Record &CurRec, MultiClass *CurMultiClass, Init *Name,
- StringRef Scoper) {
+static Init *QualifyName(Record &CurRec, Init *Name, bool IsMC = false) {
RecordKeeper &RK = CurRec.getRecords();
- Init *NewName = BinOpInit::getStrConcat(CurRec.getNameInit(),
- StringInit::get(RK, Scoper));
+ Init *NewName = BinOpInit::getStrConcat(
+ CurRec.getNameInit(), StringInit::get(RK, IsMC ? "::" : ":"));
NewName = BinOpInit::getStrConcat(NewName, Name);
if (BinOpInit *BinOp = dyn_cast<BinOpInit>(NewName))
NewName = BinOp->Fold(&CurRec);
return NewName;
}
+static Init *QualifyName(MultiClass *MC, Init *Name) {
+ return QualifyName(MC->Rec, Name, /*IsMC=*/true);
+}
+
/// Return the qualified version of the implicit 'NAME' template argument.
-static Init *QualifiedNameOfImplicitName(Record &Rec,
- MultiClass *MC = nullptr) {
- return QualifyName(Rec, MC, StringInit::get(Rec.getRecords(), "NAME"),
- MC ? "::" : ":");
+static Init *QualifiedNameOfImplicitName(Record &Rec, bool IsMC = false) {
+ return QualifyName(Rec, StringInit::get(Rec.getRecords(), "NAME"), IsMC);
}
static Init *QualifiedNameOfImplicitName(MultiClass *MC) {
- return QualifiedNameOfImplicitName(MC->Rec, MC);
+ return QualifiedNameOfImplicitName(MC->Rec, /*IsMC=*/true);
}
-Init *TGVarScope::getVar(RecordKeeper &Records, MultiClass* ParsingMultiClass,
+Init *TGVarScope::getVar(RecordKeeper &Records, MultiClass *ParsingMultiClass,
StringInit *Name, SMRange NameLoc,
bool TrackReferenceLocs) const {
// First, we search in local variables.
auto It = Vars.find(Name->getValue());
if (It != Vars.end())
return It->second;
- std::function<Init *(Record *, StringInit *, StringRef)> FindValueInArgs =
- [&](Record *Rec, StringInit *Name, StringRef Scoper) -> Init * {
+ std::function<Init *(Record *, StringInit *, bool)> FindValueInArgs =
----------------
nhaehnle wrote:
While you're at it, make this an `auto` declaration so that we don't unnecessarily create a `std::function` object?
https://github.com/llvm/llvm-project/pull/69297
More information about the llvm-commits
mailing list