llvm.org GIT mirror llvm / c41e268
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360857 91177308-0d34-0410-b5e6-96231b3b80d8 Igor Kudrin 1 year, 2 months ago
4 changed file(s) with 12 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
12221222 if (SrcBehaviorValue == Module::Override &&
12231223 SrcOp->getOperand(2) != DstOp->getOperand(2))
12241224 return stringErr("linking module flags '" + ID->getString() +
1225 "': IDs have conflicting override values");
1225 "': IDs have conflicting override values in '" +
1226 SrcM->getModuleIdentifier() + "' and '" +
1227 DstM.getModuleIdentifier() + "'");
12261228 continue;
12271229 } else if (SrcBehaviorValue == Module::Override) {
12281230 // Update the destination flag to that of the source.
12331235 // Diagnose inconsistent merge behavior types.
12341236 if (SrcBehaviorValue != DstBehaviorValue)
12351237 return stringErr("linking module flags '" + ID->getString() +
1236 "': IDs have conflicting behaviors");
1238 "': IDs have conflicting behaviors in '" +
1239 SrcM->getModuleIdentifier() + "' and '" +
1240 DstM.getModuleIdentifier() + "'");
12371241
12381242 auto replaceDstValue = [&](MDNode *New) {
12391243 Metadata *FlagOps[] = {DstOp->getOperand(0), ID, New};
12511255 // Emit an error if the values differ.
12521256 if (SrcOp->getOperand(2) != DstOp->getOperand(2))
12531257 return stringErr("linking module flags '" + ID->getString() +
1254 "': IDs have conflicting values");
1258 "': IDs have conflicting values in '" +
1259 SrcM->getModuleIdentifier() + "' and '" +
1260 DstM.getModuleIdentifier() + "'");
12551261 continue;
12561262 }
12571263 case Module::Warning: {
11
22 ; Test the 'override' error.
33
4 ; CHECK: linking module flags 'foo': IDs have conflicting override values
4 ; CHECK: linking module flags 'foo': IDs have conflicting override values in '{{.*}}module-flags-5-b.ll' and 'llvm-link'
55
66 !0 = !{ i32 4, !"foo", i32 927 }
77
11
22 ; Test module flags error messages.
33
4 ; CHECK: linking module flags 'foo': IDs have conflicting values
4 ; CHECK: linking module flags 'foo': IDs have conflicting values in '{{.*}}module-flags-6-b.ll' and 'llvm-link'
55
66 !0 = !{ i32 1, !"foo", i32 37 }
77
11
22 ; Test module flags error messages.
33
4 ; CHECK: linking module flags 'foo': IDs have conflicting behaviors
4 ; CHECK: linking module flags 'foo': IDs have conflicting behaviors in '{{.*}}module-flags-7-b.ll' and 'llvm-link'
55
66 !0 = !{ i32 1, !"foo", i32 37 }
77