[clang] [Clang] enhance diagnostic message for __builtin_bit_cast size mismatch (PR #115940)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 13:13:48 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 d922045381347a9d5c7301bf870ee0482bfdf0d4 2132ccb175f1eb37a4b4e60c8ee8ade90ba5bb18 --extensions cpp -- clang/lib/Sema/SemaCast.cpp clang/test/AST/ByteCode/builtin-bit-cast.cpp clang/test/SemaCXX/builtin-bit-cast.cpp clang/test/SemaCXX/constexpr-builtin-bit-cast.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
index 211e4dbfe6..fea7a15c31 100644
--- a/clang/lib/Sema/SemaCast.cpp
+++ b/clang/lib/Sema/SemaCast.cpp
@@ -3283,8 +3283,8 @@ void CastOperation::CheckBuiltinBitCast() {
   CharUnits SourceSize = Self.Context.getTypeSizeInChars(SrcType);
   if (DestSize != SourceSize) {
     Self.Diag(OpRange.getBegin(), diag::err_bit_cast_type_size_mismatch)
-      << SrcType << (int)SourceSize.getQuantity()
-      << DestType << (int)DestSize.getQuantity();
+        << SrcType << (int)SourceSize.getQuantity() << DestType
+        << (int)DestSize.getQuantity();
     SrcExpr = ExprError();
     return;
   }

``````````

</details>


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


More information about the cfe-commits mailing list