[clang] Fix to attribute plugins reaching an unreachable (PR #70877)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 31 17:06:21 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Amy Huang (amykhuang)
<details>
<summary>Changes</summary>
[0faee97](https://github.com/llvm/llvm-project/commit/0faee97a924adec76d5c7cd680c289ced51e6b5a) made the attribute plugin code hit an unreachable.
Bug: [70702](https://github.com/llvm/llvm-project/issues/70702)
---
Full diff: https://github.com/llvm/llvm-project/pull/70877.diff
1 Files Affected:
- (modified) clang/lib/Sema/ParsedAttr.cpp (+6-2)
``````````diff
diff --git a/clang/lib/Sema/ParsedAttr.cpp b/clang/lib/Sema/ParsedAttr.cpp
index f59b01efe7ed8f4..2d6d17e74f6e38d 100644
--- a/clang/lib/Sema/ParsedAttr.cpp
+++ b/clang/lib/Sema/ParsedAttr.cpp
@@ -193,9 +193,13 @@ bool ParsedAttr::isTypeAttr() const { return getInfo().IsType; }
bool ParsedAttr::isStmtAttr() const { return getInfo().IsStmt; }
bool ParsedAttr::existsInTarget(const TargetInfo &Target) const {
+ Kind K = getParsedKind();
+ bool HasSpelling = K != IgnoredAttribute && K != UnknownAttribute &&
+ K != NoSemaHandlerAttribute;
return getInfo().existsInTarget(Target) &&
- getInfo().spellingExistsInTarget(Target,
- getAttributeSpellingListIndex());
+ (HasSpelling &&
+ getInfo().spellingExistsInTarget(Target,
+ getAttributeSpellingListIndex()));
}
bool ParsedAttr::isKnownToGCC() const { return getInfo().IsKnownToGCC; }
``````````
</details>
https://github.com/llvm/llvm-project/pull/70877
More information about the cfe-commits
mailing list