[clang] [Clang][NFC][ByteCode] Initialize Function HasBody in constructor (PR #143443)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 9 14:38:36 PDT 2025
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/143443
Static analysis flagged HasBody as not being initialized during construction. It looks like an oversight in: https://github.com/llvm/llvm-project/pull/139671
This would be a lot simpler with C++20 which allows in class initialization of bit-fields.
>From cbc3cbb2cb07e9d3196bde17d59fa529889d1303 Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour <shafik.yaghmour at intel.com>
Date: Mon, 9 Jun 2025 14:35:31 -0700
Subject: [PATCH] [Clang][NFC][ByteCode] Initialize Function HasBody in
constructor
Static analysis flagged HasBody as not being initialized during construction.
It looks like an oversight in: https://github.com/llvm/llvm-project/pull/139671
This would be a lot simpler with C++20 which allows in class initialization of
bit-fields.
---
clang/lib/AST/ByteCode/Function.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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();
More information about the cfe-commits
mailing list