[clang] [llvm] [Clang] Correct __builtin_dynamic_object_size for subobject types (PR #78526)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 16:46:41 PST 2024


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 8947469ec1ad6d35b2feec0acc43d0d191514f0b ab13650e232b1a17cf9c7335f90a33f7eb71f741 -- clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CGExpr.cpp clang/test/CodeGen/catch-undef-behavior.c clang/test/CodeGen/pass-object-size.c llvm/include/llvm/Analysis/MemoryBuiltins.h llvm/lib/Analysis/MemoryBuiltins.cpp llvm/lib/IR/AutoUpgrade.cpp llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index 56d6313905..41b6eefffe 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -732,8 +732,8 @@ SizeOffsetAPInt ObjectSizeOffsetVisitor::computeImpl(Value *V) {
   if (!Options.WholeObjectSize && AllocaTy) {
     // At this point, SOT.Size is the size of the whole struct. However, we
     // want the size of the sub-object.
-    const StructLayout &SL = *DL.getStructLayout(
-        const_cast<StructType *>(AllocaTy));
+    const StructLayout &SL =
+        *DL.getStructLayout(const_cast<StructType *>(AllocaTy));
 
     unsigned Idx = SL.getElementContainingOffset(Offset.getLimitedValue());
 

``````````

</details>


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


More information about the cfe-commits mailing list