Skip to content

Commit e24ee9c

Browse files
committed
Fix attribute plugins
1 parent 0718c1a commit e24ee9c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

clang/lib/Sema/ParsedAttr.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,20 @@ bool ParsedAttr::isTypeAttr() const { return getInfo().IsType; }
193193
bool ParsedAttr::isStmtAttr() const { return getInfo().IsStmt; }
194194

195195
bool ParsedAttr::existsInTarget(const TargetInfo &Target) const {
196-
return getInfo().existsInTarget(Target) &&
197-
getInfo().spellingExistsInTarget(Target,
198-
getAttributeSpellingListIndex());
196+
Kind K = getParsedKind();
197+
198+
// If the attribute has a target-specific spelling, check that it exists.
199+
// Only call this if the attr is not ignored/unknown. For most targets, this
200+
// function just returns true.
201+
bool HasSpelling = K != IgnoredAttribute && K != UnknownAttribute &&
202+
K != NoSemaHandlerAttribute;
203+
bool TargetSpecificSpellingExists = !HasSpelling ||
204+
getInfo().spellingExistsInTarget(Target, getAttributeSpellingListIndex());
205+
206+
return getInfo().existsInTarget(Target) && TargetSpecificSpellingExists;
199207
}
200208

209+
201210
bool ParsedAttr::isKnownToGCC() const { return getInfo().IsKnownToGCC; }
202211

203212
bool ParsedAttr::isSupportedByPragmaAttribute() const {

0 commit comments

Comments
 (0)