forked from OSchip/llvm-project
llvm-link: Improve diagnostic for module-level metadata mismatch
This might produce hard to read/illegible diagnostics for especially weird/non-trivial module metadata but integers are about all we are using these days, so seems more useful than not. Patch based on work by Kristina Brooks - thanks! Differential Revision: https://reviews.llvm.org/D52952 llvm-svn: 344011
This commit is contained in:
parent
63a8b6c304
commit
40a64c4c08
|
@ -1230,8 +1230,14 @@ Error IRLinker::linkModuleFlagsMetadata() {
|
|||
case Module::Warning: {
|
||||
// Emit a warning if the values differ.
|
||||
if (SrcOp->getOperand(2) != DstOp->getOperand(2)) {
|
||||
emitWarning("linking module flags '" + ID->getString() +
|
||||
"': IDs have conflicting values");
|
||||
std::string str;
|
||||
raw_string_ostream(str)
|
||||
<< "linking module flags '" << ID->getString()
|
||||
<< "': IDs have conflicting values ('" << *SrcOp->getOperand(2)
|
||||
<< "' from " << SrcM->getModuleIdentifier() << " with '"
|
||||
<< *DstOp->getOperand(2) << "' from " << DstM.getModuleIdentifier()
|
||||
<< ')';
|
||||
emitWarning(str);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
!llvm.module.flags = !{!1}
|
||||
!1 = !{i32 2, !"Dwarf Version", i32 4}
|
|
@ -0,0 +1,2 @@
|
|||
!llvm.module.flags = !{!1}
|
||||
!1 = !{i32 2, !"Dwarf Version", i32 5}
|
|
@ -0,0 +1,3 @@
|
|||
; RUN: llvm-link %p/Inputs/metadata-mismatch-a.ll %p/Inputs/metadata-mismatch-b.ll -S 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: warning: linking module flags 'Dwarf Version': IDs have conflicting values ('i32 5' from {{.*}}/metadata-mismatch-b.ll with 'i32 4' from llvm-link)
|
Loading…
Reference in New Issue