Skip to content

Commit 5139570

Browse files
committed
[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.
1 parent 23882f0 commit 5139570

File tree

2 files changed

+6761
-2
lines changed

2 files changed

+6761
-2
lines changed

clang/include/clang/AST/DeclCXX.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2601,10 +2601,11 @@ class CXXConstructorDecl final
26012601
void anchor() override;
26022602

26032603
size_t numTrailingObjects(OverloadToken<InheritedConstructor>) const {
2604-
return CXXConstructorDeclBits.IsInheritingConstructor;
2604+
return getCanonicalDecl()->CXXConstructorDeclBits.IsInheritingConstructor;
26052605
}
26062606
size_t numTrailingObjects(OverloadToken<ExplicitSpecifier>) const {
2607-
return CXXConstructorDeclBits.HasTrailingExplicitSpecifier;
2607+
return getCanonicalDecl()
2608+
->CXXConstructorDeclBits.HasTrailingExplicitSpecifier;
26082609
}
26092610

26102611
ExplicitSpecifier getExplicitSpecifierInternal() const {

0 commit comments

Comments
 (0)