[clang] [clang][bytecode] Support different integral types (e.g. addresses) (PR #185028)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 16 07:17:35 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,c,cpp -- clang/lib/AST/ByteCode/Char.h clang/test/AST/ByteCode/addr-label-diff.c clang/test/AST/ByteCode/addr-label-diff.cpp clang/test/AST/ByteCode/int-as-ptr-arith.c clang/lib/AST/ByteCode/Boolean.h clang/lib/AST/ByteCode/Context.cpp clang/lib/AST/ByteCode/Descriptor.cpp clang/lib/AST/ByteCode/Descriptor.h clang/lib/AST/ByteCode/Disasm.cpp clang/lib/AST/ByteCode/Integral.h clang/lib/AST/ByteCode/IntegralAP.h clang/lib/AST/ByteCode/Interp.cpp clang/lib/AST/ByteCode/Interp.h clang/lib/AST/ByteCode/InterpBuiltin.cpp clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp clang/lib/AST/ByteCode/InterpFrame.cpp clang/lib/AST/ByteCode/InterpStack.cpp clang/lib/AST/ByteCode/InterpStack.h clang/lib/AST/ByteCode/Pointer.cpp clang/lib/AST/ByteCode/Pointer.h clang/lib/AST/ByteCode/PrimType.cpp clang/lib/AST/ByteCode/PrimType.h clang/lib/AST/ByteCode/Primitives.h clang/lib/AST/ByteCode/Program.cpp clang/test/AST/ByteCode/builtin-bit-cast.cpp clang/test/AST/ByteCode/const-eval.c clang/test/AST/ByteCode/cxx11.cpp clang/test/CodeGen/const-init.c clang/test/CodeGen/const-label-addr.c clang/test/CodeGen/statements.c clang/test/CodeGen/staticinit.c clang/test/CodeGenCXX/2008-05-07-CrazyOffsetOf.cpp clang/test/CodeGenCXX/const-init-cxx11.cpp clang/test/CodeGenCXX/const-init.cpp clang/test/Sema/array-init.c clang/test/Sema/compound-literal.c clang/test/Sema/const-ptr-int-ptr-cast.c clang/test/Sema/init.c clang/test/SemaCXX/constexpr-string.cpp clang/unittests/AST/ByteCode/Descriptor.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/AST/ByteCode/Descriptor.cpp b/clang/lib/AST/ByteCode/Descriptor.cpp
index 8e2b1c184..13c106b81 100644
--- a/clang/lib/AST/ByteCode/Descriptor.cpp
+++ b/clang/lib/AST/ByteCode/Descriptor.cpp
@@ -487,7 +487,8 @@ bool Descriptor::hasTrivialDtor() const {
 bool Descriptor::isUnion() const { return isRecord() && ElemRecord->isUnion(); }
 
 unsigned Descriptor::getElemDataSize() const {
-  if ((isPrimitive() || isPrimitiveArray()) && isIntegerOrBoolType(getPrimType())) {
+  if ((isPrimitive() || isPrimitiveArray()) &&
+      isIntegerOrBoolType(getPrimType())) {
     FIXED_SIZE_INT_TYPE_SWITCH(getPrimType(), { return T::bitWidth() / 8; });
   }
   return ElemSize;

``````````

</details>


https://github.com/llvm/llvm-project/pull/185028


More information about the cfe-commits mailing list