[PATCH] D14473: [Verifier] Improve error for cross-module references

Keno Fischer via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 18:23:23 PST 2015


loladiro created this revision.
loladiro added a subscriber: llvm-commits.
loladiro set the repository for this revision to rL LLVM.

By including the module name in the error message. This makes the error message much more useful and saves a trip to the debugger.

Repository:
  rL LLVM

http://reviews.llvm.org/D14473

Files:
  lib/IR/Verifier.cpp

Index: lib/IR/Verifier.cpp
===================================================================
--- lib/IR/Verifier.cpp
+++ lib/IR/Verifier.cpp
@@ -3153,8 +3153,14 @@
           "Cannot invoke an intrinsinc other than"
           " donothing or patchpoint",
           &I);
-      Assert(F->getParent() == M, "Referencing function in another module!",
-             &I);
+      Module *ParentM = F->getParent();
+      Assert(ParentM == M,
+             "Referencing function in module `" +
+                 (ParentM ? std::string(ParentM->getName())
+                          : std::string("null")) +
+                 "` from another module (`" +
+                 (M ? std::string(M->getName()) : std::string("null")) + "`)!",
+             &I, F, BB->getParent());
     } else if (BasicBlock *OpBB = dyn_cast<BasicBlock>(I.getOperand(i))) {
       Assert(OpBB->getParent() == BB->getParent(),
              "Referring to a basic block in another function!", &I);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14473.39617.patch
Type: text/x-patch
Size: 968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151107/abedc67f/attachment.bin>


More information about the llvm-commits mailing list