[clang] [compiler-rt] [Coverage] Fix region termination for GNU statement expressions (PR #130976)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 12 08:29:34 PDT 2025
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 9820248e0aaaffbee87edeb6a73ced54b4e25be4 6f3557780d06d6a2b1a7f315c49a3ad533d821e5 --extensions cpp -- compiler-rt/test/profile/Linux/coverage-statement-expression.cpp clang/lib/CodeGen/CoverageMappingGen.cpp clang/test/CoverageMapping/terminate-statements.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/test/profile/Linux/coverage-statement-expression.cpp b/compiler-rt/test/profile/Linux/coverage-statement-expression.cpp
index 5894275b94..8933322492 100644
--- a/compiler-rt/test/profile/Linux/coverage-statement-expression.cpp
+++ b/compiler-rt/test/profile/Linux/coverage-statement-expression.cpp
@@ -5,15 +5,28 @@
#include <stdio.h>
-__attribute__ ((__noreturn__))
-void foo(void) { while (1); } // CHECK: [[@LINE]]| 0|void foo(void)
-_Noreturn void bar(void) { while (1); } // CHECK: [[@LINE]]| 0|_Noreturn void bar(void)
- // CHECK: [[@LINE]]| |
-int main(int argc, char **argv) { // CHECK: [[@LINE]]| 1|int main(
- int rc = ({ if (argc > 3) foo(); 0; }); // CHECK: [[@LINE]]| 1| int rc =
- printf("coverage after foo is present\n"); // CHECK: [[@LINE]]| 1| printf(
- // CHECK: [[@LINE]]| |
- int rc2 = ({ if (argc > 3) bar(); 0; }); // CHECK: [[@LINE]]| 1| int rc2 =
- printf("coverage after bar is present\n"); // CHECK: [[@LINE]]| 1| printf(
- return rc + rc2; // CHECK: [[@LINE]]| 1| return rc
-} // CHECK: [[@LINE]]| 1|}
+__attribute__((__noreturn__)) void foo(void) {
+ while (1)
+ ;
+} // CHECK: [[@LINE]]| 0|void foo(void)
+_Noreturn void bar(void) {
+ while (1)
+ ;
+} // CHECK: [[@LINE]]| 0|_Noreturn void bar(void)
+ // CHECK: [[@LINE]]| |
+int main(int argc, char **argv) { // CHECK: [[@LINE]]| 1|int main(
+ int rc = ({
+ if (argc > 3)
+ foo();
+ 0;
+ }); // CHECK: [[@LINE]]| 1| int rc =
+ printf("coverage after foo is present\n"); // CHECK: [[@LINE]]| 1| printf(
+ // CHECK: [[@LINE]]| |
+ int rc2 = ({
+ if (argc > 3)
+ bar();
+ 0;
+ }); // CHECK: [[@LINE]]| 1| int rc2 =
+ printf("coverage after bar is present\n"); // CHECK: [[@LINE]]| 1| printf(
+ return rc + rc2; // CHECK: [[@LINE]]| 1| return rc
+} // CHECK: [[@LINE]]| 1|}
``````````
</details>
https://github.com/llvm/llvm-project/pull/130976
More information about the cfe-commits
mailing list