Skip to content

Commit a465f07

Browse files
committed
[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.
1 parent 2a7711f commit a465f07

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/include/llvm/IR/Attributes.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -846,9 +846,8 @@ class AttrBuilder {
846846
AttrBuilder &addAttribute(Attribute::AttrKind Val) {
847847
assert((unsigned)Val < Attribute::EndAttrKinds &&
848848
"Attribute out of range!");
849-
// TODO: This should really assert isEnumAttrKind().
850-
assert(!Attribute::isIntAttrKind(Val) &&
851-
"Adding integer attribute without adding a value!");
849+
assert(Attribute::isEnumAttrKind(Val) &&
850+
"Adding integer/type attribute without an argument!");
852851
Attrs[Val] = true;
853852
return *this;
854853
}

0 commit comments

Comments
 (0)