forked from OSchip/llvm-project
[Attributor][NFC] Add assertion to guard against accidental misuse
llvm-svn: 370925
This commit is contained in:
parent
2f6220633c
commit
912edafcf1
|
@ -674,7 +674,10 @@ struct Attributor {
|
||||||
// Put the attribute in the lookup map structure and the container we use to
|
// Put the attribute in the lookup map structure and the container we use to
|
||||||
// keep track of all attributes.
|
// keep track of all attributes.
|
||||||
IRPosition &IRP = AA.getIRPosition();
|
IRPosition &IRP = AA.getIRPosition();
|
||||||
AAMap[IRP][&AAType::ID] = &AA;
|
auto &KindToAbstractAttributeMap = AAMap[IRP];
|
||||||
|
assert(!KindToAbstractAttributeMap.count(&AAType::ID) &&
|
||||||
|
"Attribute already in map!");
|
||||||
|
KindToAbstractAttributeMap[&AAType::ID] = &AA;
|
||||||
AllAbstractAttributes.push_back(&AA);
|
AllAbstractAttributes.push_back(&AA);
|
||||||
return AA;
|
return AA;
|
||||||
}
|
}
|
||||||
|
@ -821,8 +824,7 @@ private:
|
||||||
|
|
||||||
// Lookup the abstract attribute of type AAType. If found, return it after
|
// Lookup the abstract attribute of type AAType. If found, return it after
|
||||||
// registering a dependence of QueryingAA on the one returned attribute.
|
// registering a dependence of QueryingAA on the one returned attribute.
|
||||||
const auto &KindToAbstractAttributeMap =
|
const auto &KindToAbstractAttributeMap = AAMap.lookup(IRP);
|
||||||
AAMap.lookup(const_cast<IRPosition &>(IRP));
|
|
||||||
if (AAType *AA = static_cast<AAType *>(
|
if (AAType *AA = static_cast<AAType *>(
|
||||||
KindToAbstractAttributeMap.lookup(&AAType::ID))) {
|
KindToAbstractAttributeMap.lookup(&AAType::ID))) {
|
||||||
// Do not register a dependence on an attribute with an invalid state.
|
// Do not register a dependence on an attribute with an invalid state.
|
||||||
|
|
Loading…
Reference in New Issue