Verify the LLVMContext that an Attribute belongs to.
authorNick Lewycky <nick@wasmer.io>
Wed, 24 Mar 2021 23:13:29 +0000 (16:13 -0700)
committerNick Lewycky <nicholas@mxc.ca>
Fri, 16 Apr 2021 16:44:38 +0000 (09:44 -0700)
commit244d9d6e41db71e76eeb55e56d84f658b3f56681
tree6ea85937b7734021641ce5984dec4eff8912a6a3
parent8f683366afcfd7c03faea615d1529a0014d7dbde
Verify the LLVMContext that an Attribute belongs to.

Attributes don't know their parent Context, adding this would make Attribute larger. Instead, we add hasParentContext that answers whether this Attribute belongs to a particular LLVMContext by checking for itself inside the context's FoldingSet. Same with AttributeSet and AttributeList. The Verifier checks them with the Module context.

Differential Revision: https://reviews.llvm.org/D99362
llvm/include/llvm/IR/Attributes.h
llvm/lib/IR/Attributes.cpp
llvm/lib/IR/Verifier.cpp
llvm/unittests/IR/AttributesTest.cpp
llvm/unittests/IR/VerifierTest.cpp