aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/DeclBase.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/AST/DeclBase.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/AST/DeclBase.cpp')
-rw-r--r--clang/lib/AST/DeclBase.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index c33babf..f341c74 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -1115,7 +1115,9 @@ int64_t Decl::getID() const {
const FunctionType *Decl::getFunctionType(bool BlocksToo) const {
QualType Ty;
- if (const auto *D = dyn_cast<ValueDecl>(this))
+ if (const auto *D = dyn_cast<BindingDecl>(this))
+ return nullptr;
+ else if (const auto *D = dyn_cast<ValueDecl>(this))
Ty = D->getType();
else if (const auto *D = dyn_cast<TypedefNameDecl>(this))
Ty = D->getUnderlyingType();