[Verifier] Make error message precise about which variable is being diagnosed.

NFCI.
This commit is contained in:
Yuanfang Chen 2021-12-15 16:03:16 -08:00
parent fd65d39793
commit ebf65d4842
2 changed files with 7 additions and 2 deletions

View File

@ -735,8 +735,9 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) {
Value *V = Op->stripPointerCasts();
Assert(isa<GlobalVariable>(V) || isa<Function>(V) ||
isa<GlobalAlias>(V),
"invalid llvm.used member", V);
Assert(V->hasName(), "members of llvm.used must be named", V);
Twine("invalid ") + GV.getName() + " member", V);
Assert(V->hasName(),
Twine("members of ") + GV.getName() + " must be named", V);
}
}
}

View File

@ -2,6 +2,10 @@
@a = global i8 42
@llvm.used = appending global [2 x i8*] [i8* @a, i8* null], section "llvm.metadata"
@llvm.compiler.used = appending global [2 x i8*] [i8* @a, i8* null], section "llvm.metadata"
; CHECK: invalid llvm.used member
; CHECK-NEXT: i8* null
; CHECK: invalid llvm.compiler.used member
; CHECK-NEXT: i8* null