forked from OSchip/llvm-project
[AttrBuilder] Assert correct attribute kind
Make sure that addAttribute() is only used with simple enum attributes. Integer and type attributes need to provide an additional value/type.
This commit is contained in:
parent
2a7711f33a
commit
a465f07cf9
|
@ -846,9 +846,8 @@ public:
|
|||
AttrBuilder &addAttribute(Attribute::AttrKind Val) {
|
||||
assert((unsigned)Val < Attribute::EndAttrKinds &&
|
||||
"Attribute out of range!");
|
||||
// TODO: This should really assert isEnumAttrKind().
|
||||
assert(!Attribute::isIntAttrKind(Val) &&
|
||||
"Adding integer attribute without adding a value!");
|
||||
assert(Attribute::isEnumAttrKind(Val) &&
|
||||
"Adding integer/type attribute without an argument!");
|
||||
Attrs[Val] = true;
|
||||
return *this;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue