https://github.com/amykhuang updated https://github.com/llvm/llvm-project/pull/70877
>From 18369263a3160963b943cd8574edaa212b6d0996 Mon Sep 17 00:00:00 2001 From: Amy Huang <akhu...@google.com> Date: Tue, 31 Oct 2023 16:45:17 -0700 Subject: [PATCH 1/2] Fix attribute plugins --- clang/lib/Sema/ParsedAttr.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/clang/lib/Sema/ParsedAttr.cpp b/clang/lib/Sema/ParsedAttr.cpp index f59b01efe7ed8f4..ad95a61d7587264 100644 --- a/clang/lib/Sema/ParsedAttr.cpp +++ b/clang/lib/Sema/ParsedAttr.cpp @@ -193,11 +193,20 @@ bool ParsedAttr::isTypeAttr() const { return getInfo().IsType; } bool ParsedAttr::isStmtAttr() const { return getInfo().IsStmt; } bool ParsedAttr::existsInTarget(const TargetInfo &Target) const { - return getInfo().existsInTarget(Target) && - getInfo().spellingExistsInTarget(Target, - getAttributeSpellingListIndex()); + Kind K = getParsedKind(); + + // If the attribute has a target-specific spelling, check that it exists. + // Only call this if the attr is not ignored/unknown. For most targets, this + // function just returns true. + bool HasSpelling = K != IgnoredAttribute && K != UnknownAttribute && + K != NoSemaHandlerAttribute; + bool TargetSpecificSpellingExists = !HasSpelling || + getInfo().spellingExistsInTarget(Target, getAttributeSpellingListIndex()); + + return getInfo().existsInTarget(Target) && TargetSpecificSpellingExists; } + bool ParsedAttr::isKnownToGCC() const { return getInfo().IsKnownToGCC; } bool ParsedAttr::isSupportedByPragmaAttribute() const { >From f068257dac770959b130bc8b33eb4689e5dd47db Mon Sep 17 00:00:00 2001 From: Amy Huang <akhu...@google.com> Date: Tue, 7 Nov 2023 14:51:06 -0800 Subject: [PATCH 2/2] clang-format --- clang/lib/Sema/ParsedAttr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/Sema/ParsedAttr.cpp b/clang/lib/Sema/ParsedAttr.cpp index ad95a61d7587264..06c213267c7ef5d 100644 --- a/clang/lib/Sema/ParsedAttr.cpp +++ b/clang/lib/Sema/ParsedAttr.cpp @@ -200,13 +200,13 @@ bool ParsedAttr::existsInTarget(const TargetInfo &Target) const { // function just returns true. bool HasSpelling = K != IgnoredAttribute && K != UnknownAttribute && K != NoSemaHandlerAttribute; - bool TargetSpecificSpellingExists = !HasSpelling || - getInfo().spellingExistsInTarget(Target, getAttributeSpellingListIndex()); + bool TargetSpecificSpellingExists = + !HasSpelling || + getInfo().spellingExistsInTarget(Target, getAttributeSpellingListIndex()); return getInfo().existsInTarget(Target) && TargetSpecificSpellingExists; } - bool ParsedAttr::isKnownToGCC() const { return getInfo().IsKnownToGCC; } bool ParsedAttr::isSupportedByPragmaAttribute() const { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits