diff options
| -rw-r--r-- | clang/lib/CodeGen/CoverageMappingGen.cpp | 1 | ||||
| -rw-r--r-- | clang/test/CoverageMapping/label.cpp | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 8f1f3d169f0..2d844646359 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -872,6 +872,7 @@ struct CounterCoverageMappingBuilder Counter LabelCount = getRegionCounter(S); SourceLocation Start = getStart(S); completeTopLevelDeferredRegion(LabelCount, Start); + completeDeferred(LabelCount, Start); // We can't extendRegion here or we risk overlapping with our new region. handleFileExit(Start); pushRegion(LabelCount, Start); diff --git a/clang/test/CoverageMapping/label.cpp b/clang/test/CoverageMapping/label.cpp index 7bb11993bc2..71bb8a3edfc 100644 --- a/clang/test/CoverageMapping/label.cpp +++ b/clang/test/CoverageMapping/label.cpp @@ -69,3 +69,12 @@ int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 test1(0); test2(2); } + +// CHECK-LABEL: _Z5test3v: +#define a b +void test3() { + if (0) + goto b; // CHECK: Gap,File 0, [[@LINE]]:11 -> [[@LINE+1]]:1 = [[retnCount:#[0-9]+]] +a: // CHECK-NEXT: Expansion,File 0, [[@LINE]]:1 -> [[@LINE]]:2 = [[retnCount]] (Expanded file = 1) + return; // CHECK-NEXT: File 0, [[@LINE-1]]:2 -> [[@LINE]]:9 = [[retnCount]] +} |

