[PATCH] Improve LinkModules warnings

JF Bastien jfb at chromium.org
Wed Mar 5 12:34:50 PST 2014


Provide triple and data layout as well as module names (or empty string) when there's a mismatch.

http://llvm-reviews.chandlerc.com/D2971

Files:
  lib/Linker/LinkModules.cpp

Index: lib/Linker/LinkModules.cpp
===================================================================
--- lib/Linker/LinkModules.cpp
+++ lib/Linker/LinkModules.cpp
@@ -1210,16 +1210,20 @@
   if (SrcM->getDataLayout() && DstM->getDataLayout() &&
       *SrcM->getDataLayout() != *DstM->getDataLayout()) {
     if (!SuppressWarnings) {
-      errs() << "WARNING: Linking two modules of different data layouts!\n";
+      errs() << "WARNING: Linking two modules of different data layouts: '"
+             << SrcM->getModuleIdentifier() << "' is '"
+             << SrcM->getDataLayoutStr() << "' whereas '"
+             << DstM->getModuleIdentifier() << "' is '"
+             << DstM->getDataLayoutStr() << "'\n";
     }
   }
   if (!SrcM->getTargetTriple().empty() &&
       DstM->getTargetTriple() != SrcM->getTargetTriple()) {
     if (!SuppressWarnings) {
-      errs() << "WARNING: Linking two modules of different target triples: ";
-      if (!SrcM->getModuleIdentifier().empty())
-        errs() << SrcM->getModuleIdentifier() << ": ";
-      errs() << "'" << SrcM->getTargetTriple() << "' and '"
+      errs() << "WARNING: Linking two modules of different target triples: "
+             << SrcM->getModuleIdentifier() << "' is '"
+             << SrcM->getTargetTriple() << "' whereas '"
+             << DstM->getModuleIdentifier() << "' is '"
              << DstM->getTargetTriple() << "'\n";
     }
   }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2971.1.patch
Type: text/x-patch
Size: 1418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140305/ae57088f/attachment.bin>


More information about the llvm-commits mailing list