Improve LinkModules warnings

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203009 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
JF Bastien
2014-03-05 21:26:42 +00:00
parent 9d84b4d70c
commit 9bf239e76f
+9 -5
View File
@@ -1210,16 +1210,20 @@ bool ModuleLinker::run() {
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";
}
}