File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
compiler-rt/test/profile/Linux Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -1505,6 +1505,14 @@ struct CounterCoverageMappingBuilder
1505
1505
handleFileExit (getEnd (S));
1506
1506
}
1507
1507
1508
+ void VisitStmtExpr (const StmtExpr *E) {
1509
+ Visit (E->getSubStmt ());
1510
+ // Any region termination (such as a noreturn CallExpr) within the statement
1511
+ // expression has been handled by visiting the sub-statement. The visitor
1512
+ // cannot be at a terminate statement leaving the statement expression.
1513
+ HasTerminateStmt = false ;
1514
+ }
1515
+
1508
1516
void VisitDecl (const Decl *D) {
1509
1517
Stmt *Body = D->getBody ();
1510
1518
Original file line number Diff line number Diff line change @@ -346,6 +346,12 @@ int elsecondnoret(void) {
346
346
return 0 ;
347
347
}
348
348
349
+ // CHECK-LABEL: _Z18statementexprnoretb:
350
+ int statementexprnoret (bool crash) {
351
+ int rc = ({ if (crash) abort (); 0 ; }); // CHECK: File 0, 351:35 -> 352:12 = (#0 - #1)
352
+ return rc; // CHECK-NOT: Gap
353
+ }
354
+
349
355
int main () {
350
356
foo (0 );
351
357
foo (1 );
@@ -368,5 +374,6 @@ int main() {
368
374
ornoret ();
369
375
abstractcondnoret ();
370
376
elsecondnoret ();
377
+ statementexprnoret (false );
371
378
return 0 ;
372
379
}
Original file line number Diff line number Diff line change
1
+ // REQUIRES: lld-available
2
+ // XFAIL: powerpc64-target-arch
3
+
4
+ // RUN: %clangxx_profgen -std=gnu++17 -fuse-ld=lld -fcoverage-mapping -o %t %s
5
+ // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
6
+ // RUN: llvm-profdata merge -o %t.profdata %t.profraw
7
+ // RUN: llvm-cov show %t -instr-profile=%t.profdata 2>&1 | FileCheck %s
8
+
9
+ #include < stdio.h>
10
+
11
+ // clang-format off
12
+ __attribute__ ((__noreturn__))
13
+ void foo(void ) { while (1 ); } // CHECK: [[@LINE]]| 0|void foo(void)
14
+ _Noreturn void bar (void ) { while (1 ); } // CHECK: [[@LINE]]| 0|_Noreturn void bar(void)
15
+ // CHECK: [[@LINE]]| |
16
+ int main (int argc, char **argv) { // CHECK: [[@LINE]]| 1|int main(
17
+ int rc = ({ if (argc > 3 ) foo (); 0 ; }); // CHECK: [[@LINE]]| 1| int rc =
18
+ printf (" coverage after foo is present\n " ); // CHECK: [[@LINE]]| 1| printf(
19
+ // CHECK: [[@LINE]]| |
20
+ int rc2 = ({ if (argc > 3 ) bar (); 0 ; }); // CHECK: [[@LINE]]| 1| int rc2 =
21
+ printf (" coverage after bar is present\n " ); // CHECK: [[@LINE]]| 1| printf(
22
+ return rc + rc2; // CHECK: [[@LINE]]| 1| return rc
23
+ } // CHECK: [[@LINE]]| 1|}
24
+ // clang-format on
You can’t perform that action at this time.
0 commit comments