[clang] [PATCH] [clang][frontend] Fix AllocKind retrieving for `CXXConstructorDecl` refs #132794 (PR #133077)
Paul Schwabauer via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 26 06:35:59 PDT 2025
https://github.com/koplas updated https://github.com/llvm/llvm-project/pull/133077
>From d2da89cb6d2438b31ad25a05ec87d5f039e79064 Mon Sep 17 00:00:00 2001
From: koplas <paul at schwabauer.co>
Date: Wed, 26 Mar 2025 13:49:44 +0100
Subject: [PATCH] [PATCH] [clang][frontend] Fix AllocKind retrieving for
`CXXConstructorDecl` refs #132794
When getting the `ExplicitSpecifier` of the `CXXConstructorDecl`, one
of the canonical declaration is returned. When writing the declaration
record with `ExplicitSpecifier`, the `AllocKind` of the canonical
declaration has to be used.
If this is not done it will later crash when on deserialization.
---
clang/include/clang/AST/DeclCXX.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h
index dbd02ef7f8011..7728669b3bcec 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -2601,10 +2601,11 @@ class CXXConstructorDecl final
void anchor() override;
size_t numTrailingObjects(OverloadToken<InheritedConstructor>) const {
- return CXXConstructorDeclBits.IsInheritingConstructor;
+ return getCanonicalDecl()->CXXConstructorDeclBits.IsInheritingConstructor;
}
size_t numTrailingObjects(OverloadToken<ExplicitSpecifier>) const {
- return CXXConstructorDeclBits.HasTrailingExplicitSpecifier;
+ return getCanonicalDecl()
+ ->CXXConstructorDeclBits.HasTrailingExplicitSpecifier;
}
ExplicitSpecifier getExplicitSpecifierInternal() const {
More information about the cfe-commits
mailing list