Skip to content

Commit 7cfbe57

Browse files
committed
Fix: Remove IsCustomFunction bitfield to avoid size overflow
The IsCustomFunction bit pushed CXXConstructorDeclBitfields over the 64-bit limit, causing static assertion failures. For Phase 1, we only need to parse the 'custom' keyword correctly, which we can do without storing the flag in FunctionDecl. The parser recognizes the keyword and DeclSpec tracks it during parsing. Changes: - Removed IsCustomFunction bit from FunctionDeclBitfields - Reverted NumFunctionDeclBits back to 32 - Removed isCustomFunction()/setCustomFunction() accessor methods - Commented out custom flag usage in SemaDecl.cpp with TODO for Phase 2 Parser and DeclSpec changes remain intact, so the keyword is still recognized and validated. We'll add proper AST storage in Phase 2 when implementing the transformation, potentially using an attribute or external tracking mechanism.
1 parent 6207c5b commit 7cfbe57

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

clang/include/clang/AST/Decl.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2904,14 +2904,6 @@ class FunctionDecl : public DeclaratorDecl,
29042904
FunctionDeclBits.IsInline = I;
29052905
}
29062906

2907-
/// Determine whether the "custom" keyword was specified for this function.
2908-
bool isCustomFunction() const { return FunctionDeclBits.IsCustomFunction; }
2909-
2910-
/// Set whether the "custom" keyword was specified for this function.
2911-
void setCustomFunction(bool C = true) {
2912-
FunctionDeclBits.IsCustomFunction = C;
2913-
}
2914-
29152907
/// Determine whether the function was declared in source context
29162908
/// that requires constrained FP intrinsics
29172909
bool UsesFPIntrin() const { return FunctionDeclBits.UsesFPIntrin; }

clang/include/clang/AST/DeclBase.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,8 +1742,6 @@ class DeclContext {
17421742
uint64_t IsInline : 1;
17431743
LLVM_PREFERRED_TYPE(bool)
17441744
uint64_t IsInlineSpecified : 1;
1745-
LLVM_PREFERRED_TYPE(bool)
1746-
uint64_t IsCustomFunction : 1;
17471745

17481746
LLVM_PREFERRED_TYPE(bool)
17491747
uint64_t IsVirtualAsWritten : 1;
@@ -1834,7 +1832,7 @@ class DeclContext {
18341832
};
18351833

18361834
/// Number of inherited and non-inherited bits in FunctionDeclBitfields.
1837-
enum { NumFunctionDeclBits = NumDeclContextBits + 33 };
1835+
enum { NumFunctionDeclBits = NumDeclContextBits + 32 };
18381836

18391837
/// Stores the bits used by CXXConstructorDecl. If modified
18401838
/// NumCXXConstructorDeclBits and the accessor

clang/lib/Sema/SemaDecl.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10088,9 +10088,8 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
1008810088
bool isVirtual = D.getDeclSpec().isVirtualSpecified();
1008910089
bool hasExplicit = D.getDeclSpec().hasExplicitSpecifier();
1009010090
isFriend = D.getDeclSpec().isFriendSpecified();
10091-
bool isCustom = D.getDeclSpec().isCustomSpecified();
10092-
if (isCustom)
10093-
NewFD->setCustomFunction(true);
10091+
// TODO(Phase 2): Store custom function flag when implementing transformation
10092+
// bool isCustom = D.getDeclSpec().isCustomSpecified();
1009410093
if (ImplicitInlineCXX20 && isFriend && D.isFunctionDefinition()) {
1009510094
// Pre-C++20 [class.friend]p5
1009610095
// A function can be defined in a friend declaration of a

0 commit comments

Comments
 (0)