[clang] [clang] [C23] Fix crash with _BitInt running clang-tidy (PR #65889)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 11 02:56:08 PDT 2023


================
@@ -0,0 +1,10 @@
+// RUN: %check_clang_tidy %s bugprone-inc-dec-in-conditions %t
+
+#define foo(x)                                                 \
+  ({                                                           \
+    _BitInt(5) y = x;                                          \
+    16777215wb ?: ++y;                                         \
+  })
+
+_BitInt(8) v_401_0() { 0 && foo(0); }
----------------
DonatNagyE wrote:

Perhaps eliminate the macro definition and replace this function body with
```
if (0) {
  // block defined in the macro
}
```
because the current code seems to be "unnatural" for the untrained eye. (If I understand it correctly, this transformation would produce an equivalent testcase. If not, then explain why do you need the gcc statement expression.) 

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


More information about the cfe-commits mailing list