File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -771,6 +771,9 @@ void Verifier::visitGlobalValue(const GlobalValue &GV) {
771771 }
772772
773773 if (GO->hasMetadata (LLVMContext::MD_ref)) {
774+ Check (!GO->isDeclaration (),
775+ " ref metadata must not be placed on a declaration" , GO);
776+
774777 SmallVector<MDNode *> MDs;
775778 GO->getMetadata (LLVMContext::MD_ref, MDs);
776779 for (const MDNode *MD : MDs) {
Original file line number Diff line number Diff line change 44@b = global i32 2 , !ref !1
55@c = global i32 3 , !ref !1 , !ref !2
66@d = global i32 4 , !ref !3
7+ @e = external global i32 , !ref !1
78
89!0 = !{i32 1 }
910!1 = !{ptr @b }
2526; CHECK: ref metadata must have one operand
2627; CHECK: ptr @d
2728; CHECK: !3 = !{ptr @c, ptr @a}
29+
30+ ; CHECK: ref metadata must not be placed on a declaration
31+ ; CHECK: @e
You can’t perform that action at this time.
0 commit comments