From: Igor Kudrin Date: Thu, 16 May 2019 05:23:13 +0000 (+0000) Subject: [IRMover] Improve diagnostic messages for conflicting metadata X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ff8b7bdf108c61bbcd1b3e0154ea4bab0b5cdaa;p=platform%2Fupstream%2Fllvm.git [IRMover] Improve diagnostic messages for conflicting metadata This does the similar for error messages as rL344011 has done for warnings. With llvm::lto::LTO, the error might appear when LTO::run() is executed. In that case, the calling code cannot know which module causes the error and, subsequently, cannot hint the user. Differential Revision: https://reviews.llvm.org/D61880 llvm-svn: 360857 --- diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp index b21b8f3..7635092 100644 --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -1223,7 +1223,9 @@ Error IRLinker::linkModuleFlagsMetadata() { if (SrcBehaviorValue == Module::Override && SrcOp->getOperand(2) != DstOp->getOperand(2)) return stringErr("linking module flags '" + ID->getString() + - "': IDs have conflicting override values"); + "': IDs have conflicting override values in '" + + SrcM->getModuleIdentifier() + "' and '" + + DstM.getModuleIdentifier() + "'"); continue; } else if (SrcBehaviorValue == Module::Override) { // Update the destination flag to that of the source. @@ -1234,7 +1236,9 @@ Error IRLinker::linkModuleFlagsMetadata() { // Diagnose inconsistent merge behavior types. if (SrcBehaviorValue != DstBehaviorValue) return stringErr("linking module flags '" + ID->getString() + - "': IDs have conflicting behaviors"); + "': IDs have conflicting behaviors in '" + + SrcM->getModuleIdentifier() + "' and '" + + DstM.getModuleIdentifier() + "'"); auto replaceDstValue = [&](MDNode *New) { Metadata *FlagOps[] = {DstOp->getOperand(0), ID, New}; @@ -1252,7 +1256,9 @@ Error IRLinker::linkModuleFlagsMetadata() { // Emit an error if the values differ. if (SrcOp->getOperand(2) != DstOp->getOperand(2)) return stringErr("linking module flags '" + ID->getString() + - "': IDs have conflicting values"); + "': IDs have conflicting values in '" + + SrcM->getModuleIdentifier() + "' and '" + + DstM.getModuleIdentifier() + "'"); continue; } case Module::Warning: { diff --git a/llvm/test/Linker/module-flags-5-a.ll b/llvm/test/Linker/module-flags-5-a.ll index 00fb4d1..d7ebee0 100644 --- a/llvm/test/Linker/module-flags-5-a.ll +++ b/llvm/test/Linker/module-flags-5-a.ll @@ -2,7 +2,7 @@ ; Test the 'override' error. -; CHECK: linking module flags 'foo': IDs have conflicting override values +; CHECK: linking module flags 'foo': IDs have conflicting override values in '{{.*}}module-flags-5-b.ll' and 'llvm-link' !0 = !{ i32 4, !"foo", i32 927 } diff --git a/llvm/test/Linker/module-flags-6-a.ll b/llvm/test/Linker/module-flags-6-a.ll index e15fd34..dd65197 100644 --- a/llvm/test/Linker/module-flags-6-a.ll +++ b/llvm/test/Linker/module-flags-6-a.ll @@ -2,7 +2,7 @@ ; Test module flags error messages. -; CHECK: linking module flags 'foo': IDs have conflicting values +; CHECK: linking module flags 'foo': IDs have conflicting values in '{{.*}}module-flags-6-b.ll' and 'llvm-link' !0 = !{ i32 1, !"foo", i32 37 } diff --git a/llvm/test/Linker/module-flags-7-a.ll b/llvm/test/Linker/module-flags-7-a.ll index 46c9d26..b8732c7 100644 --- a/llvm/test/Linker/module-flags-7-a.ll +++ b/llvm/test/Linker/module-flags-7-a.ll @@ -2,7 +2,7 @@ ; Test module flags error messages. -; CHECK: linking module flags 'foo': IDs have conflicting behaviors +; CHECK: linking module flags 'foo': IDs have conflicting behaviors in '{{.*}}module-flags-7-b.ll' and 'llvm-link' !0 = !{ i32 1, !"foo", i32 37 }