@@ -543,6 +543,7 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
543
543
void visitAliasScopeListMetadata (const MDNode *MD);
544
544
void visitAccessGroupMetadata (const MDNode *MD);
545
545
void visitCapturesMetadata (Instruction &I, const MDNode *Captures);
546
+ void visitAllocTokenMetadata (Instruction &I, MDNode *MD);
546
547
547
548
template <class Ty > bool isValidMetadataArray (const MDTuple &N);
548
549
#define HANDLE_SPECIALIZED_MDNODE_LEAF (CLASS ) void visit##CLASS(const CLASS &N);
@@ -5395,6 +5396,12 @@ void Verifier::visitCapturesMetadata(Instruction &I, const MDNode *Captures) {
5395
5396
}
5396
5397
}
5397
5398
5399
+ void Verifier::visitAllocTokenMetadata (Instruction &I, MDNode *MD) {
5400
+ Check (isa<CallBase>(I), " !alloc_token should only exist on calls" , &I);
5401
+ Check (MD->getNumOperands () == 1 , " !alloc_token must have 1 operand" , MD);
5402
+ Check (isa<MDString>(MD->getOperand (0 )), " expected string" , MD);
5403
+ }
5404
+
5398
5405
// / verifyInstruction - Verify that an instruction is well formed.
5399
5406
// /
5400
5407
void Verifier::visitInstruction (Instruction &I) {
@@ -5625,6 +5632,9 @@ void Verifier::visitInstruction(Instruction &I) {
5625
5632
if (MDNode *Captures = I.getMetadata (LLVMContext::MD_captures))
5626
5633
visitCapturesMetadata (I, Captures);
5627
5634
5635
+ if (MDNode *MD = I.getMetadata (LLVMContext::MD_alloc_token))
5636
+ visitAllocTokenMetadata (I, MD);
5637
+
5628
5638
if (MDNode *N = I.getDebugLoc ().getAsMDNode ()) {
5629
5639
CheckDI (isa<DILocation>(N), " invalid !dbg metadata attachment" , &I, N);
5630
5640
visitMDNode (*N, AreDebugLocsAllowed::Yes);
0 commit comments