[clang] [Clang] Fix missing diagnostic for non-standard layout type in `offsetof` (PR #65246)

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 1 17:57:46 PDT 2023


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 97829935844e7f35216e12c13231f35fbea640c3 b9e201a80ee7e79f8ddfe37fee097b8efddc0a8a -- clang/lib/Sema/SemaExpr.cpp clang/test/SemaCXX/class-layout.cpp clang/test/SemaCXX/ms_struct.cpp clang/test/SemaCXX/offsetof.cpp libcxx/include/__type_traits/datasizeof.h
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/__type_traits/datasizeof.h b/libcxx/include/__type_traits/datasizeof.h
index cfdd8cbbc..389b006b6 100644
--- a/libcxx/include/__type_traits/datasizeof.h
+++ b/libcxx/include/__type_traits/datasizeof.h
@@ -47,7 +47,8 @@ struct __libcpp_datasizeof {
   };
 #endif
 
-  // _FirstPaddingByte<> is sometimes non-standard layout. Using `offsetof` is UB in that case, but GCC and Clang allow the use as an extension.
+  // _FirstPaddingByte<> is sometimes non-standard layout. Using `offsetof` is UB in that case, but GCC and Clang allow
+  // the use as an extension.
   // TODO : Find a way to replace `offsetof` ?
   _LIBCPP_DIAGNOSTIC_PUSH
   _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-offsetof")

``````````

</details>


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


More information about the cfe-commits mailing list