diff options
author | Eli Friedman <efriedma@codeaurora.org> | 2017-08-03 22:27:36 +0000 |
---|---|---|
committer | Eli Friedman <efriedma@codeaurora.org> | 2017-08-03 22:27:36 +0000 |
commit | 2d30c64ae3704c8698345711a2396b0d952aed64 (patch) | |
tree | c303fb68f553225293017f14b34f710630f782f8 /clang/test/CoverageMapping | |
parent | 974d4eea93a62d54f53f569deb1038bd5c0fb207 (diff) | |
download | bcm5719-llvm-2d30c64ae3704c8698345711a2396b0d952aed64.tar.gz bcm5719-llvm-2d30c64ae3704c8698345711a2396b0d952aed64.zip |
[coverage] Special-case calls to noreturn functions.
The code after a noreturn call doesn't execute.
The pattern in the testcase is pretty common in LLVM (a switch with
a default case that calls llvm_unreachable).
Differential Revision: https://reviews.llvm.org/D36250
llvm-svn: 309995
Diffstat (limited to 'clang/test/CoverageMapping')
-rw-r--r-- | clang/test/CoverageMapping/switch.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CoverageMapping/switch.cpp b/clang/test/CoverageMapping/switch.cpp index 17aa53bb486..52f22e8eda1 100644 --- a/clang/test/CoverageMapping/switch.cpp +++ b/clang/test/CoverageMapping/switch.cpp @@ -97,3 +97,16 @@ int fallthrough(int i) { // CHECK-NEXT: File 0, [[@LINE]]:24 -> [[@LINE+12]]:2 = break; } } + +void abort(void) __attribute((noreturn)); + // CHECK: noret +int noret(int x) { // CHECK-NEXT: File 0, [[@LINE]]:18 -> [[@LINE+9]]:2 + switch (x) { + default: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:12 + abort(); + case 1: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:13 + return 5; + case 2: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:14 + return 10; + } +} |