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

llvm-svn: 203009
This commit is contained in:
JF Bastien 2014-03-05 21:26:42 +00:00
parent ab12363c02
commit 026fc5f6ab
1 changed files with 9 additions and 5 deletions

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";
}
}