[llvm-bugs] [Bug 50596] New: TGParser::ParseForeachDeclaration - dead code

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 6 07:17:15 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50596

            Bug ID: 50596
           Summary: TGParser::ParseForeachDeclaration - dead code
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: TableGen
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: llvm-bugs at lists.llvm.org, Matthew.Arsenault at amd.com,
                    paul at windfall-software.com

TGParser::ParseForeachDeclaration breaks early if TI is non-null, but we have
(dead) code later that uses it as part of an error message.

@arsenm - this looks like it was introduced in rGb79a25b12437

  default: {
    SMLoc ValueLoc = Lex.getLoc();
    Init *I = ParseValue(nullptr);
    if (!I)
      return nullptr;

    TypedInit *TI = dyn_cast<TypedInit>(I);
    if (TI && isa<ListRecTy>(TI->getType())) {
      ForeachListValue = I;
      IterType = cast<ListRecTy>(TI->getType())->getElementType();
      break;
    }

    if (TI) {
      if (ParseRangePiece(Ranges, TI))
        return nullptr;
      break;
    }

    std::string Type;
    if (TI)
      Type = (Twine("' of type '") + TI->getType()->getAsString()).str();
    Error(ValueLoc, "expected a list, got '" + I->getAsString() + Type + "'");
    if (CurMultiClass) {
      PrintNote({}, "references to multiclass template arguments cannot be "
                "resolved at this time");
    }
    return nullptr;
  }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210606/d0662477/attachment.html>


More information about the llvm-bugs mailing list