aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorcor3ntin <corentinjabot@gmail.com>2024-04-28 20:25:44 +0200
committerGitHub <noreply@github.com>2024-04-28 20:25:44 +0200
commit6dd90616c477d83c156eed62c880e951bb508cfd (patch)
tree97249d834b0bb458a7509d5bab7abac35c000108 /clang/lib/Sema/SemaDecl.cpp
parent216787cffc4a864e0effb165c1c32b92328a0a06 (diff)
downloadllvm-6dd90616c477d83c156eed62c880e951bb508cfd.zip
llvm-6dd90616c477d83c156eed62c880e951bb508cfd.tar.gz
llvm-6dd90616c477d83c156eed62c880e951bb508cfd.tar.bz2
[Clang] Implement C++26 Attributes for Structured Bindings (P0609R3) (#89906)
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p0609r3.pdf We support this feature in all language mode. maybe_unused applied to a binding makes the whole declaration unused.
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index e0745fe9..671752b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1974,7 +1974,7 @@ static bool ShouldDiagnoseUnusedDecl(const LangOptions &LangOpts,
// it is, by the bindings' expressions).
bool IsAllPlaceholders = true;
for (const auto *BD : DD->bindings()) {
- if (BD->isReferenced())
+ if (BD->isReferenced() || BD->hasAttr<UnusedAttr>())
return false;
IsAllPlaceholders = IsAllPlaceholders && BD->isPlaceholderVar(LangOpts);
}