Skip to content

[Clang][NFC][ByteCode] Initialize Function HasBody in constructor #143443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

shafik
Copy link
Collaborator

@shafik shafik commented Jun 9, 2025

Static analysis flagged HasBody as not being initialized during construction. It looks like an oversight in: #139671

This would be a lot simpler with C++20 which allows in class initialization of bit-fields.

Static analysis flagged HasBody as not being initialized during construction.
It looks like an oversight in: llvm#139671

This would be a lot simpler with C++20 which allows in class initialization of
bit-fields.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:bytecode Issues for the clang bytecode constexpr interpreter labels Jun 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 9, 2025

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

Changes

Static analysis flagged HasBody as not being initialized during construction. It looks like an oversight in: #139671

This would be a lot simpler with C++20 which allows in class initialization of bit-fields.


Full diff: https://github.com/llvm/llvm-project/pull/143443.diff

1 Files Affected:

  • (modified) clang/lib/AST/ByteCode/Function.cpp (+1-1)
diff --git a/clang/lib/AST/ByteCode/Function.cpp b/clang/lib/AST/ByteCode/Function.cpp
index 9eb6744ea47ad..0e639df3cafba 100644
--- a/clang/lib/AST/ByteCode/Function.cpp
+++ b/clang/lib/AST/ByteCode/Function.cpp
@@ -23,7 +23,7 @@ Function::Function(Program &P, FunctionDeclTy Source, unsigned ArgSize,
       ParamTypes(std::move(ParamTypes)), Params(std::move(Params)),
       ParamOffsets(std::move(ParamOffsets)), IsValid(false),
       IsFullyCompiled(false), HasThisPointer(HasThisPointer), HasRVO(HasRVO),
-      Defined(false) {
+      HasBody(false), Defined(false) {
   if (const auto *F = dyn_cast<const FunctionDecl *>(Source)) {
     Variadic = F->isVariadic();
     Immediate = F->isImmediateFunction();

@shafik shafik merged commit 8d6841f into llvm:main Jun 10, 2025
11 checks passed
rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
…vm#143443)

Static analysis flagged HasBody as not being initialized during
construction. It looks like an oversight in:
llvm#139671

This would be a lot simpler with C++20 which allows in class
initialization of bit-fields.
@shafik shafik deleted the bytecodeFunctionHasBodyInit branch June 11, 2025 15:02
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
…vm#143443)

Static analysis flagged HasBody as not being initialized during
construction. It looks like an oversight in:
llvm#139671

This would be a lot simpler with C++20 which allows in class
initialization of bit-fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:bytecode Issues for the clang bytecode constexpr interpreter clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants