[PATCH] D90340: [NFC] Add more tests for DISubprogram verifier

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 15:29:53 PDT 2020


vsk accepted this revision.
vsk added a comment.
This revision is now accepted and ready to land.

Thanks, lgtm.

It looks like verifyFunction asserts that the DISubprogram attached any function, declaration or definition, is distinct:

    } else if (F.isDeclaration()) {
      for (const auto &I : MDs) {
        // This is used for call site debug information.
        AssertDI(I.first != LLVMContext::MD_dbg ||
                     !cast<DISubprogram>(I.second)->isDistinct(),
                 "function declaration may only have a unique !dbg attachment",
  ...
          AssertDI(cast<DISubprogram>(I.second)->isDistinct(),
                   "function definition may only have a distinct !dbg attachment",
                   &F);

It should be possible to simplify that. I don't think checking `isDistinct()` in verifyDISubprogram is redundant though. You might have DISubprogram metadata that's not attached to a function.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90340/new/

https://reviews.llvm.org/D90340



More information about the llvm-commits mailing list