[llvm-dev] bool Attribute::doesAttrKindHaveArgument(Attribute::AttrKind AttrKind)

Riyaz Puthiyapurayil via llvm-dev llvm-dev at lists.llvm.org
Sat Feb 6 11:33:38 PST 2021


The following function in Attributes.cpp seems to be checking that the specified AttrKind is one of the Int attributes (all the currently supported IntAttrs are specified here). The name of the function seems a bit misleading. Does it make sense to rename it to isIntAttrKind or doesAttrKindHaveIntArgument?

bool Attribute::doesAttrKindHaveArgument(Attribute::AttrKind AttrKind) {
  return AttrKind == Attribute::Alignment ||
         AttrKind == Attribute::StackAlignment ||
         AttrKind == Attribute::Dereferenceable ||
         AttrKind == Attribute::AllocSize ||
         AttrKind == Attribute::DereferenceableOrNull;
}

Also, shouldn't this function be generated by llvm-tblgen so that it gets automatically updated if any new IntAttrs are added?

/Riyaz


More information about the llvm-dev mailing list