Non-implicit attribute creation requires a source range; NFC

There are two factory functions used to create a semantic attribute,
Create() and CreateImplicit(). CreateImplicit() does not need to
specify the source range of the attribute since it's an implicitly-
generated attribute. The same logic does not apply to Create(), so
this removes the default argument from those declarations to avoid
accidentally creating a semantic attribute without source location
information.
This commit is contained in:
Aaron Ballman 2020-11-12 10:06:30 -08:00
parent 8df4e60945
commit b336826c1d
2 changed files with 2 additions and 2 deletions

View File

@ -742,7 +742,7 @@ def Annotate : InheritableParamAttr {
// '#pragma clang attribute' even though it has no subject list.
let AdditionalMembers = [{
static AnnotateAttr *Create(ASTContext &Ctx, llvm::StringRef Annotation, \
const AttributeCommonInfo &CommonInfo = {SourceRange{}}) {
const AttributeCommonInfo &CommonInfo) {
return AnnotateAttr::Create(Ctx, Annotation, nullptr, 0, CommonInfo);
}
static AnnotateAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, \

View File

@ -2367,7 +2367,7 @@ static void emitAttributes(RecordKeeper &Records, raw_ostream &OS,
ai->writeCtorParameters(OS);
}
OS << ", const AttributeCommonInfo &CommonInfo";
if (Header)
if (Header && Implicit)
OS << " = {SourceRange{}}";
OS << ")";
if (Header) {