From a7764adcbb3d6fa3f41d3af50d974d6502bf6981 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Sat, 5 Aug 2017 00:34:10 +0000 Subject: [PATCH] Revert "[Coverage] Precise region termination with deferred regions" This reverts commit r310010. I don't think there's anything wrong with this commit, but it's causing clang to generate output that llvm-cov doesn't do a good job with and the fix isn't immediately clear. See Eli's comment in D36250 for more context. I'm reverting the clang change so the coverage bot can revert back to producing sensible output, and to give myself some time to investigate what went wrong in llvm. llvm-svn: 310154 --- clang/lib/CodeGen/CoverageMappingGen.cpp | 91 +---------- .../test/CoverageMapping/deferred-region.cpp | 142 ------------------ clang/test/CoverageMapping/label.cpp | 25 ++- clang/test/CoverageMapping/moremacros.c | 6 +- clang/test/CoverageMapping/return.c | 2 +- clang/test/CoverageMapping/switch.cpp | 6 +- clang/test/CoverageMapping/switchmacro.c | 1 - clang/test/CoverageMapping/trycatch.cpp | 2 +- 8 files changed, 22 insertions(+), 253 deletions(-) delete mode 100644 clang/test/CoverageMapping/deferred-region.cpp diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 07d16186b661..1484ec78b886 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -45,14 +45,10 @@ class SourceMappingRegion { /// \brief The region's ending location. Optional LocEnd; - /// Whether this region should be emitted after its parent is emitted. - bool DeferRegion; - public: SourceMappingRegion(Counter Count, Optional LocStart, - Optional LocEnd, bool DeferRegion = false) - : Count(Count), LocStart(LocStart), LocEnd(LocEnd), - DeferRegion(DeferRegion) {} + Optional LocEnd) + : Count(Count), LocStart(LocStart), LocEnd(LocEnd) {} const Counter &getCounter() const { return Count; } @@ -75,10 +71,6 @@ public: assert(LocEnd && "Region has no end location"); return *LocEnd; } - - bool isDeferred() const { return DeferRegion; } - - void setDeferred(bool Deferred) { DeferRegion = Deferred; } }; /// Spelling locations for the start and end of a source region. @@ -417,10 +409,6 @@ struct CounterCoverageMappingBuilder /// \brief A stack of currently live regions. std::vector RegionStack; - /// The currently deferred region: its end location and count can be set once - /// its parent has been popped from the region stack. - Optional DeferredRegion; - CounterExpressionBuilder Builder; /// \brief A location in the most recently visited file or macro. @@ -456,60 +444,19 @@ struct CounterCoverageMappingBuilder /// used with popRegions to exit a "scope", ending the region that was pushed. size_t pushRegion(Counter Count, Optional StartLoc = None, Optional EndLoc = None) { - if (StartLoc) { + if (StartLoc) MostRecentLocation = *StartLoc; - completeDeferred(Count, MostRecentLocation); - } RegionStack.emplace_back(Count, StartLoc, EndLoc); return RegionStack.size() - 1; } - /// Complete any pending deferred region by setting its end location and - /// count, and then pushing it onto the region stack. - size_t completeDeferred(Counter Count, SourceLocation DeferredEndLoc) { - size_t Index = RegionStack.size(); - if (!DeferredRegion) - return Index; - - // Consume the pending region. - SourceMappingRegion DR = DeferredRegion.getValue(); - DeferredRegion = None; - - // If the region ends in an expansion, find the expansion site. - if (SM.getFileID(DeferredEndLoc) != SM.getMainFileID()) { - FileID StartFile = SM.getFileID(DR.getStartLoc()); - if (isNestedIn(DeferredEndLoc, StartFile)) { - do { - DeferredEndLoc = getIncludeOrExpansionLoc(DeferredEndLoc); - } while (StartFile != SM.getFileID(DeferredEndLoc)); - } - } - - // The parent of this deferred region ends where the containing decl ends, - // so the region isn't useful. - if (DR.getStartLoc() == DeferredEndLoc) - return Index; - - // If we're visiting statements in non-source order (e.g switch cases or - // a loop condition) we can't construct a sensible deferred region. - if (!SpellingRegion(SM, DR.getStartLoc(), DeferredEndLoc).isInSourceOrder()) - return Index; - - DR.setCounter(Count); - DR.setEndLoc(DeferredEndLoc); - handleFileExit(DeferredEndLoc); - RegionStack.push_back(DR); - return Index; - } - /// \brief Pop regions from the stack into the function's list of regions. /// /// Adds all regions from \c ParentIndex to the top of the stack to the /// function's \c SourceRegions. void popRegions(size_t ParentIndex) { assert(RegionStack.size() >= ParentIndex && "parent not in stack"); - bool ParentOfDeferredRegion = false; while (RegionStack.size() > ParentIndex) { SourceMappingRegion &Region = RegionStack.back(); if (Region.hasStartLoc()) { @@ -541,26 +488,9 @@ struct CounterCoverageMappingBuilder assert(SM.isWrittenInSameFile(Region.getStartLoc(), EndLoc)); SourceRegions.push_back(Region); - - if (ParentOfDeferredRegion) { - ParentOfDeferredRegion = false; - - // If there's an existing deferred region, keep the old one, because - // it means there are two consecutive returns (or a similar pattern). - if (!DeferredRegion.hasValue() && - // File IDs aren't gathered within macro expansions, so it isn't - // useful to try and create a deferred region inside of one. - (SM.getFileID(EndLoc) == SM.getMainFileID())) - DeferredRegion = - SourceMappingRegion(Counter::getZero(), EndLoc, None); - } - } else if (Region.isDeferred()) { - assert(!ParentOfDeferredRegion && "Consecutive deferred regions"); - ParentOfDeferredRegion = true; } RegionStack.pop_back(); } - assert(!ParentOfDeferredRegion && "Deferred region with no parent"); } /// \brief Return the currently active region. @@ -687,8 +617,6 @@ struct CounterCoverageMappingBuilder handleFileExit(StartLoc); if (!Region.hasStartLoc()) Region.setStartLoc(StartLoc); - - completeDeferred(Region.getCounter(), StartLoc); } /// \brief Mark \c S as a terminator, starting a zero region. @@ -698,7 +626,6 @@ struct CounterCoverageMappingBuilder if (!Region.hasEndLoc()) Region.setEndLoc(getEnd(S)); pushRegion(Counter::getZero()); - getRegion().setDeferred(true); } /// \brief Keep counts of breaks and continues inside loops. @@ -712,15 +639,13 @@ struct CounterCoverageMappingBuilder CoverageMappingModuleGen &CVM, llvm::DenseMap &CounterMap, SourceManager &SM, const LangOptions &LangOpts) - : CoverageMappingBuilder(CVM, SM, LangOpts), CounterMap(CounterMap), - DeferredRegion(None) {} + : CoverageMappingBuilder(CVM, SM, LangOpts), CounterMap(CounterMap) {} /// \brief Write the mapping data to the output stream void write(llvm::raw_ostream &OS) { llvm::SmallVector VirtualFileMapping; gatherFileIDs(VirtualFileMapping); SourceRegionFilter Filter = emitExpansionRegions(); - assert(!DeferredRegion && "Deferred region never completed"); emitSourceRegions(Filter); gatherSkippedRegions(); @@ -742,19 +667,13 @@ struct CounterCoverageMappingBuilder } void VisitDecl(const Decl *D) { - assert(!DeferredRegion && "Deferred region never completed"); - Stmt *Body = D->getBody(); // Do not propagate region counts into system headers. if (Body && SM.isInSystemHeader(SM.getSpellingLoc(getStart(Body)))) return; - Counter ExitCount = propagateCounts(getRegionCounter(Body), Body); - assert(RegionStack.empty() && "Regions entered but never exited"); - - // Complete any deferred regions introduced by the last statement in a decl. - popRegions(completeDeferred(ExitCount, getEnd(Body))); + propagateCounts(getRegionCounter(Body), Body); } void VisitReturnStmt(const ReturnStmt *S) { diff --git a/clang/test/CoverageMapping/deferred-region.cpp b/clang/test/CoverageMapping/deferred-region.cpp deleted file mode 100644 index dbf4b54b90c2..000000000000 --- a/clang/test/CoverageMapping/deferred-region.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// RUN: %clang_cc1 -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -fexceptions -fcxx-exceptions -emit-llvm-only -triple %itanium_abi_triple -main-file-name deferred-region.cpp %s | FileCheck %s - -#define IF if -#define STMT(S) S - -// CHECK-LABEL: _Z3fooi: -void foo(int x) { - if (x == 0) { - return; - } // CHECK: [[@LINE]]:4 -> [[@LINE+2]]:2 = (#0 - #1) - -} - -// CHECK-NEXT: _Z4foooi: -void fooo(int x) { - if (x == 0) { - return; - } // CHECK: [[@LINE]]:4 -> [[@LINE+2]]:3 = (#0 - #1) - - if (x == 1) { - return; - } // CHECK: [[@LINE]]:4 -> [[@LINE+2]]:2 = ((#0 - #1) - #2) - -} - -// CHECK-LABEL: _Z3bazv: -void baz() { // CHECK: [[@LINE]]:12 -> [[@LINE+2]]:2 - return; // CHECK-NOT: File -} - -// CHECK-LABEL: _Z3bari: -void bar(int x) { - IF (x) - return; // CHECK: [[@LINE]]:11 -> [[@LINE+2]]:3 = (#0 - #1) - - IF (!x) - return; // CHECK: [[@LINE]]:11 -> [[@LINE+2]]:3 = ((#0 - #1) - #2) - - foo(x); -} - -// CHECK-LABEL: _Z4quuxi: -// Deferred regions are not emitted within macro expansions. -void quux(int x) { - STMT( - if (x == 0) - return;) - - // CHECK-NOT: [[@LINE-2]]:{{.*}} -> [[@LINE+2]] - - if (x == 1) - STMT(return;) - - // CHECK-NOT: [[@LINE-2]]:{{.*}} -> [[@LINE+3]] - - STMT( - if (x == 2) - return; - - // CHECK-NOT: [[@LINE-2]]:{{.*}} -> [[@LINE+2]] - - if (x == 3) - return; - ) -} - -// CHECK-LABEL: _Z8for_loopv: -void for_loop() { - if (false) - return; // CHECK: [[@LINE]]:11 -> [[@LINE+2]]:3 = (#0 - #1) - - for (int i = 0; i < 10; ++i) { - if (i % 2 == 0) - continue; // CHECK: [[@LINE]]:15 -> [[@LINE+2]]:5 = (#2 - #3) - - if (i % 5 == 0) - break; // CHECK: [[@LINE]]:12 -> [[@LINE+2]]:5 = ((#2 - #3) - #4) - - int x = i; // CHECK: [[@LINE]]:5 -> [[@LINE+3]]:4 = ((#2 - #3) - #4) - return; // CHECK-NOT: [[@LINE]]:11 -> [[@LINE+2]] - - } -} - -struct Error {}; - -// CHECK-LABEL: _Z10while_loopv: -void while_loop() { - if (false) - return; // CHECK: [[@LINE]]:11 -> [[@LINE+2]]:3 = (#0 - #1) - - int x = 0; - while (++x < 10) { - if (x == 1) - continue; // CHECK: [[@LINE]]:15 -> [[@LINE+2]]:5 = (#2 - #3) - - while (++x < 4) { - if (x == 3) - break; // CHECK: [[@LINE]]:14 -> [[@LINE+2]]:7 = (#4 - #5) - - while (++x < 5) {} - } - - if (x == 0) - throw Error(); // CHECK: [[@LINE]]:20 -> [[@LINE+2]]:5 = ((#2 - #3) - #7) - - while (++x < 9) { - if (x == 0) - break; // CHECK-NOT: [[@LINE]]:14 -> [[@LINE+2]] - - } - } -} - -// CHECK-LABEL: _Z5gotosv: -void gotos() { - if (false) - goto out; // CHECK: [[@LINE]]:13 -> [[@LINE+2]]:3 = (#0 - #1) - - return; // CHECK: [[@LINE]]:3 -> [[@LINE+4]]:2 = (#0 - #1) - -out: - return; // CHECK: [[@LINE]]:8 -> [[@LINE+1]]:2 = 0 -} - -int main() { - foo(0); - foo(1); - fooo(0); - fooo(1); - baz(); - bar(0); - bar(1); - quux(0); - quux(1); - quux(2); - quux(3); - for_loop(); - while_loop(); - gotos(); - return 0; -} diff --git a/clang/test/CoverageMapping/label.cpp b/clang/test/CoverageMapping/label.cpp index aec5e4f7ebf5..1c5111a675a1 100644 --- a/clang/test/CoverageMapping/label.cpp +++ b/clang/test/CoverageMapping/label.cpp @@ -14,22 +14,19 @@ void func() { // CHECK-NEXT: File 0, [[@LINE]]:13 -> {{[0-9]+}}:2 int m = 2; } else goto x; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = (#1 - #2) - int k = 3; // CHECK-NEXT: File 0, [[@LINE-1]]:13 -> [[@LINE]]:5 = #3 - } // CHECK-NEXT: File 0, [[@LINE-1]]:5 -> [[@LINE]]:4 = #3 - static int j = 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+5]]:2 = ((#0 + #3) - #1) + int k = 3; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+1]]:4 = #3 + } + static int j = 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+4]]:2 = ((#0 + #3) - #1) ++j; if(j == 1) // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE]]:12 = ((#0 + #3) - #1) goto x; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #4 - // CHECK-NEXT: File 0, [[@LINE-1]]:11 -> [[@LINE+1]]:2 = (((#0 + #3) - #1) - #4) } // CHECK-NEXT: test1 void test1(int x) { // CHECK-NEXT: File 0, [[@LINE]]:19 -> {{[0-9]+}}:2 = #0 if(x == 0) // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE]]:12 = #0 goto a; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #1 - // CHECK-NEXT: File 0, [[@LINE-1]]:11 -> [[@LINE+1]]:3 = (#0 - #1) - goto b; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+5]]:2 = (#0 - #1) - // CHECK-NEXT: File 0, [[@LINE-1]]:3 -> [[@LINE+4]]:2 = #3 + goto b; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:9 = (#0 - #1) a: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+3]]:2 = #2 b: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+2]]:2 = #3 x = x + 1; @@ -39,11 +36,9 @@ b: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+2]]:2 void test2(int x) { // CHECK-NEXT: File 0, [[@LINE]]:19 -> {{[0-9]+}}:2 = #0 if(x == 0) // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE]]:12 = #0 goto a; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #1 - // CHECK-NEXT: File 0, [[@LINE-1]]:11 -> [[@LINE+3]]:8 = #0 - // CHECK-NEXT: File 0, [[@LINE+2]]:8 -> [[@LINE+3]]:11 = (#0 - #1) + // CHECK-NEXT: File 0, [[@LINE+2]]:8 -> [[@LINE+2]]:25 = (#0 - #1) // CHECK-NEXT: File 0, [[@LINE+1]]:11 -> [[@LINE+1]]:17 = (#0 - #1) - else if(x == 1) // CHECK-NEXT: File 0, [[@LINE+1]]:5 -> [[@LINE+1]]:11 = #2 - goto b; // CHECK-NEXT: File 0, [[@LINE]]:11 -> [[@LINE+1]]:1 = #3 + else if(x == 1) goto b; // CHECK-NEXT: File 0, [[@LINE]]:19 -> [[@LINE]]:25 = #2 a: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+3]]:2 = #3 b: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+2]]:2 = #4 x = x + 1; @@ -52,13 +47,11 @@ b: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+2]]:2 // CHECK-NEXT: main int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 = #0 int j = 0; - for(int i = 0; i < 10; ++i) { // CHECK: File 0, [[@LINE]]:31 -> [[@LINE+13]]:4 = #1 - a: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+12]]:4 = #2 + for(int i = 0; i < 10; ++i) { // CHECK: File 0, [[@LINE]]:31 -> [[@LINE+11]]:4 = #1 + a: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+10]]:4 = #2 if(i < 3) // CHECK-NEXT: File 0, [[@LINE]]:8 -> [[@LINE]]:13 = #2 goto e; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = #3 - // CHECK-NEXT: File 0, [[@LINE-1]]:13 -> [[@LINE+1]]:5 = (#2 - #3) - goto c; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+8]]:4 = (#2 - #3) - + goto c; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = (#2 - #3) b: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:4 = #4 j = 2; c: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+4]]:4 = #5 diff --git a/clang/test/CoverageMapping/moremacros.c b/clang/test/CoverageMapping/moremacros.c index 630b75d855ee..56662270d073 100644 --- a/clang/test/CoverageMapping/moremacros.c +++ b/clang/test/CoverageMapping/moremacros.c @@ -15,7 +15,7 @@ int main(int argc, const char *argv[]) { if (!argc) LBRAC return 0; // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:8 = #2 - RBRAC // CHECK-NEXT: [[@LINE]]:8 -> [[@LINE+6]]:3 = (#0 - #2) + RBRAC // CHECK-NEXT: File 0, [[@LINE+4]]:3 -> [[@LINE+15]]:2 = (#0 - #2) // CHECK-NEXT: File 0, [[@LINE+3]]:7 -> [[@LINE+3]]:12 = (#0 - #2) @@ -23,7 +23,7 @@ int main(int argc, const char *argv[]) { // CHECK-NEXT: File 0, [[@LINE+1]]:19 -> [[@LINE+3]]:4 = #3 if (!argc) LBRAC return 0; - } // CHECK-NEXT: [[@LINE]]:4 -> [[@LINE+5]]:3 = ((#0 - #2) - #3) + } // CHECK-NEXT: File 0, [[@LINE+3]]:3 -> [[@LINE+7]]:2 = ((#0 - #2) - #3) // CHECK-NEXT: File 0, [[@LINE+2]]:7 -> [[@LINE+2]]:12 = ((#0 - #2) - #3) @@ -31,7 +31,7 @@ int main(int argc, const char *argv[]) { if (!argc) { return 0; // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:8 = #4 - RBRAC // CHECK-NEXT: [[@LINE]]:8 -> [[@LINE+1]]:2 = (((#0 - #2) - #3) - #4) + RBRAC } // CHECK-NEXT: File 1, 3:15 -> 3:16 = #2 diff --git a/clang/test/CoverageMapping/return.c b/clang/test/CoverageMapping/return.c index 3cc271b7ca34..1b190b0eb733 100644 --- a/clang/test/CoverageMapping/return.c +++ b/clang/test/CoverageMapping/return.c @@ -13,7 +13,7 @@ void func2() { // CHECK-NEXT: File 0, [[@LINE]]:14 -> {{[0-9]+} for(int i = 0; i < 10; ++i) { // CHECK-NEXT: File 0, [[@LINE]]:31 -> {{[0-9]+}}:4 = #1 // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:13 = #1 if(i > 2) { // CHECK-NEXT: File 0, [[@LINE]]:15 -> [[@LINE+2]]:6 = #2 - return; // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+3]]:5 = (#1 - #2) + return; } // CHECK-NEXT: File 0, [[@LINE+2]]:5 -> {{[0-9]+}}:4 = (#1 - #2) // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:14 = (#1 - #2) if(i == 3) { // CHECK-NEXT: File 0, [[@LINE]]:16 -> [[@LINE+2]]:6 = #3 diff --git a/clang/test/CoverageMapping/switch.cpp b/clang/test/CoverageMapping/switch.cpp index 8b0cf7c2fb8e..17aa53bb4860 100644 --- a/clang/test/CoverageMapping/switch.cpp +++ b/clang/test/CoverageMapping/switch.cpp @@ -6,7 +6,7 @@ void foo(int i) { // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+8]]:2 = #0 case 1: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:11 = #2 return; case 2: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #3 - break; // CHECK-NEXT: File 0, [[@LINE]]:10 -> [[@LINE+2]]:3 = #1 + break; } int x = 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #1 } @@ -55,7 +55,7 @@ int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+35]]:2 = #0 i = 2; break; default: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #4 - break; // CHECK-NEXT: File 0, [[@LINE]]:10 -> [[@LINE+2]]:3 = #1 + break; } switch(i) { // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+23]]:2 = #1 case 0: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:10 = #6 @@ -64,7 +64,7 @@ int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+35]]:2 = #0 case 1: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:10 = #7 i = 2; default: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = (#7 + #8) - break; // CHECK-NEXT: File 0, [[@LINE]]:10 -> [[@LINE+3]]:3 = #5 + break; } switch(i) { // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+13]]:2 = #5 diff --git a/clang/test/CoverageMapping/switchmacro.c b/clang/test/CoverageMapping/switchmacro.c index 8fb1b83d711f..55f93d8f60c0 100644 --- a/clang/test/CoverageMapping/switchmacro.c +++ b/clang/test/CoverageMapping/switchmacro.c @@ -8,7 +8,6 @@ int foo(int i) { // CHECK-NEXT: File 0, [[@LINE]]:16 -> {{[0-9]+}}:2 = #0 default: // CHECK-NEXT: File 0, [[@LINE]]:3 -> {{[0-9]+}}:11 = #2 if (i == 1) // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE]]:15 = #2 return 0; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:15 = #3 - // CHECK-NEXT: File 0, [[@LINE-1]]:15 -> [[@LINE+3]]:5 = (#2 - #3) // CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:5 -> [[@LINE+2]]:8 = (#2 - #3) (Expanded file = 1) // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> {{[0-9]+}}:11 = (#2 - #3) FOO(1); diff --git a/clang/test/CoverageMapping/trycatch.cpp b/clang/test/CoverageMapping/trycatch.cpp index 37b35d30987f..01d8fb930740 100644 --- a/clang/test/CoverageMapping/trycatch.cpp +++ b/clang/test/CoverageMapping/trycatch.cpp @@ -18,7 +18,7 @@ void func(int i) { // CHECK-NEXT: File 0, [[@LINE]]:18 -> {{[ // CHECK-NEXT: File 0, [[@LINE+1]]:10 -> [[@LINE+2]]:27 = (#0 - #1) } else if(i == 8) // CHECK-NEXT: File 0, [[@LINE]]:13 -> [[@LINE]]:19 = (#0 - #1) throw ImportantError(); // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:27 = #2 -} // CHECK-NEXT: File 0, [[@LINE-1]]:27 -> [[@LINE]]:2 = ((#0 - #1) - #2) +} // CHECK-NEXT: main int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+13]]:2 = #0