Author: vedantk Date: Wed Nov 29 14:25:14 2017 New Revision: 319373 URL: http://llvm.org/viewvc/llvm-project?rev=319373&view=rev Log: [Coverage] Emit gap areas in braces-optional statements (PR35387)
Emit a gap area starting after the r-paren location and ending at the start of the body for the braces-optional statements (for, for-each, while, etc). The count for the gap area equal to the body's count. This extends the fix in r317758. Fixes PR35387, rdar://35570345 Testing: stage2 coverage-enabled build of clang, check-clang Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp cfe/trunk/test/CoverageMapping/break.c cfe/trunk/test/CoverageMapping/continue.c cfe/trunk/test/CoverageMapping/if.cpp cfe/trunk/test/CoverageMapping/includehell.cpp cfe/trunk/test/CoverageMapping/label.cpp cfe/trunk/test/CoverageMapping/loops.cpp cfe/trunk/test/CoverageMapping/macro-expressions.cpp cfe/trunk/test/CoverageMapping/macros.c cfe/trunk/test/CoverageMapping/objc.m cfe/trunk/test/CoverageMapping/return.c cfe/trunk/test/CoverageMapping/test.c cfe/trunk/test/CoverageMapping/while.c Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original) +++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Wed Nov 29 14:25:14 2017 @@ -112,6 +112,9 @@ struct SpellingRegion { ColumnEnd = SM.getSpellingColumnNumber(LocEnd); } + SpellingRegion(SourceManager &SM, SourceMappingRegion &R) + : SpellingRegion(SM, R.getStartLoc(), R.getEndLoc()) {} + /// Check if the start and end locations appear in source order, i.e /// top->bottom, left->right. bool isInSourceOrder() const { @@ -583,6 +586,7 @@ struct CounterCoverageMappingBuilder MostRecentLocation = getIncludeOrExpansionLoc(EndLoc); assert(SM.isWrittenInSameFile(Region.getStartLoc(), EndLoc)); + assert(SpellingRegion(SM, Region).isInSourceOrder()); SourceRegions.push_back(Region); if (ParentOfDeferredRegion) { @@ -718,9 +722,11 @@ struct CounterCoverageMappingBuilder SourceLocation Loc = MostRecentLocation; while (isNestedIn(Loc, ParentFile)) { SourceLocation FileStart = getStartOfFileOrMacro(Loc); - if (StartLocs.insert(FileStart).second) + if (StartLocs.insert(FileStart).second) { SourceRegions.emplace_back(*ParentCounter, FileStart, getEndOfFileOrMacro(Loc)); + assert(SpellingRegion(SM, SourceRegions.back()).isInSourceOrder()); + } Loc = getIncludeOrExpansionLoc(Loc); } } @@ -753,12 +759,31 @@ struct CounterCoverageMappingBuilder LastTerminatedRegion = {EndLoc, RegionStack.size()}; } + /// Find a valid gap range between \p AfterLoc and \p BeforeLoc. + Optional<SourceRange> findGapAreaBetween(SourceLocation AfterLoc, + SourceLocation BeforeLoc) { + // If the start and end locations of the gap are both within the same macro + // file, the range may not be in source order. + if (AfterLoc.isMacroID() || BeforeLoc.isMacroID()) + return None; + if (!SM.isWrittenInSameFile(AfterLoc, BeforeLoc)) + return None; + return {{AfterLoc, BeforeLoc}}; + } + + /// Find the source range after \p AfterStmt and before \p BeforeStmt. + Optional<SourceRange> findGapAreaBetween(const Stmt *AfterStmt, + const Stmt *BeforeStmt) { + return findGapAreaBetween(getPreciseTokenLocEnd(getEnd(AfterStmt)), + getStart(BeforeStmt)); + } + /// Emit a gap region between \p StartLoc and \p EndLoc with the given count. void fillGapAreaWithCount(SourceLocation StartLoc, SourceLocation EndLoc, Counter Count) { - if (StartLoc == EndLoc || StartLoc.isMacroID() || EndLoc.isMacroID() || - !SM.isWrittenInSameFile(StartLoc, EndLoc)) + if (StartLoc == EndLoc) return; + assert(SpellingRegion(SM, StartLoc, EndLoc).isInSourceOrder()); handleFileExit(StartLoc); size_t Index = pushRegion(Count, StartLoc, EndLoc); getRegion().setGap(true); @@ -914,6 +939,11 @@ struct CounterCoverageMappingBuilder propagateCounts(CondCount, S->getCond()); adjustForOutOfOrderTraversal(getEnd(S)); + // The body count applies to the area immediately after the increment. + auto Gap = findGapAreaBetween(S->getCond(), S->getBody()); + if (Gap) + fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(), BodyCount); + Counter OutCount = addCounters(BC.BreakCount, subtractCounters(CondCount, BodyCount)); if (OutCount != ParentCount) @@ -968,6 +998,12 @@ struct CounterCoverageMappingBuilder adjustForOutOfOrderTraversal(getEnd(S)); } + // The body count applies to the area immediately after the increment. + auto Gap = findGapAreaBetween(getPreciseTokenLocEnd(S->getRParenLoc()), + getStart(S->getBody())); + if (Gap) + fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(), BodyCount); + Counter OutCount = addCounters(BC.BreakCount, subtractCounters(CondCount, BodyCount)); if (OutCount != ParentCount) @@ -987,6 +1023,12 @@ struct CounterCoverageMappingBuilder Counter BackedgeCount = propagateCounts(BodyCount, S->getBody()); BreakContinue BC = BreakContinueStack.pop_back_val(); + // The body count applies to the area immediately after the range. + auto Gap = findGapAreaBetween(getPreciseTokenLocEnd(S->getRParenLoc()), + getStart(S->getBody())); + if (Gap) + fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(), BodyCount); + Counter LoopCount = addCounters(ParentCount, BackedgeCount, BC.ContinueCount); Counter OutCount = @@ -1007,6 +1049,12 @@ struct CounterCoverageMappingBuilder Counter BackedgeCount = propagateCounts(BodyCount, S->getBody()); BreakContinue BC = BreakContinueStack.pop_back_val(); + // The body count applies to the area immediately after the collection. + auto Gap = findGapAreaBetween(getPreciseTokenLocEnd(S->getRParenLoc()), + getStart(S->getBody())); + if (Gap) + fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(), BodyCount); + Counter LoopCount = addCounters(ParentCount, BackedgeCount, BC.ContinueCount); Counter OutCount = @@ -1099,8 +1147,9 @@ struct CounterCoverageMappingBuilder propagateCounts(ParentCount, S->getCond()); // The 'then' count applies to the area immediately after the condition. - fillGapAreaWithCount(getPreciseTokenLocEnd(getEnd(S->getCond())), - getStart(S->getThen()), ThenCount); + auto Gap = findGapAreaBetween(S->getCond(), S->getThen()); + if (Gap) + fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(), ThenCount); extendRegion(S->getThen()); Counter OutCount = propagateCounts(ThenCount, S->getThen()); @@ -1108,8 +1157,9 @@ struct CounterCoverageMappingBuilder Counter ElseCount = subtractCounters(ParentCount, ThenCount); if (const Stmt *Else = S->getElse()) { // The 'else' count applies to the area immediately after the 'then'. - fillGapAreaWithCount(getPreciseTokenLocEnd(getEnd(S->getThen())), - getStart(Else), ElseCount); + Gap = findGapAreaBetween(S->getThen(), Else); + if (Gap) + fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(), ElseCount); extendRegion(Else); OutCount = addCounters(OutCount, propagateCounts(ElseCount, Else)); } else @@ -1148,8 +1198,10 @@ struct CounterCoverageMappingBuilder if (!isa<BinaryConditionalOperator>(E)) { // The 'then' count applies to the area immediately after the condition. - fillGapAreaWithCount(E->getQuestionLoc(), getStart(E->getTrueExpr()), - TrueCount); + auto Gap = + findGapAreaBetween(E->getQuestionLoc(), getStart(E->getTrueExpr())); + if (Gap) + fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(), TrueCount); extendRegion(E->getTrueExpr()); propagateCounts(TrueCount, E->getTrueExpr()); Modified: cfe/trunk/test/CoverageMapping/break.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/break.c?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/break.c (original) +++ cfe/trunk/test/CoverageMapping/break.c Wed Nov 29 14:25:14 2017 @@ -2,18 +2,18 @@ int main() { // CHECK: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 = #0 int cnt = 0; // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = #0 - while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+3]]:4 = #1 + while(cnt < 100) { // CHECK: File 0, [[@LINE]]:20 -> [[@LINE+3]]:4 = #1 break; ++cnt; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+1]]:4 = 0 } // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = #0 - while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+6]]:4 = #2 + while(cnt < 100) { // CHECK: File 0, [[@LINE]]:20 -> [[@LINE+6]]:4 = #2 { break; ++cnt; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE+3]]:4 = 0 } ++cnt; } // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = ((#0 + #3) - #4) - while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+7]]:4 = #3 + while(cnt < 100) { // CHECK: File 0, [[@LINE]]:20 -> [[@LINE+7]]:4 = #3 // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:16 = #3 if(cnt == 0) { // CHECK: File 0, [[@LINE]]:18 -> [[@LINE+3]]:6 = #4 break; @@ -21,7 +21,7 @@ int main() { // CHECK: File 0, [ } ++cnt; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+1]]:4 = (#3 - #4) } // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:18 = (#0 + #6) - while(cnt < 100) { // CHECK-NEXT: File 0, [[@LINE]]:20 -> [[@LINE+8]]:4 = #5 + while(cnt < 100) { // CHECK: File 0, [[@LINE]]:20 -> [[@LINE+8]]:4 = #5 // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:16 = #5 if(cnt == 0) { // CHECK: File 0, [[@LINE]]:18 -> [[@LINE+2]]:6 = #6 ++cnt; // CHECK-NEXT: Gap,File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = (#5 - #6) Modified: cfe/trunk/test/CoverageMapping/continue.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/continue.c?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/continue.c (original) +++ cfe/trunk/test/CoverageMapping/continue.c Wed Nov 29 14:25:14 2017 @@ -3,7 +3,7 @@ int main() { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+21]]:2 = #0 int j = 0; // CHECK-NEXT: File 0, [[@LINE+2]]:18 -> [[@LINE+2]]:24 = (#0 + #1) // CHECK-NEXT: File 0, [[@LINE+1]]:26 -> [[@LINE+1]]:29 = #1 - for(int i = 0; i < 20; ++i) { // CHECK-NEXT: File 0, [[@LINE]]:31 -> [[@LINE+17]]:4 = #1 + for(int i = 0; i < 20; ++i) { // CHECK: File 0, [[@LINE]]:31 -> [[@LINE+17]]:4 = #1 if(i < 10) { // CHECK: File 0, [[@LINE]]:16 -> [[@LINE+13]]:6 = #2 if(i < 5) { // CHECK: File 0, [[@LINE]]:17 -> [[@LINE+3]]:8 = #3 continue; Modified: cfe/trunk/test/CoverageMapping/if.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/if.cpp?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/if.cpp (original) +++ cfe/trunk/test/CoverageMapping/if.cpp Wed Nov 29 14:25:14 2017 @@ -43,3 +43,10 @@ int main() { // CHECK return 0; } + +#define FOO true + +// CHECK-LABEL: _Z7ternaryv: +void ternary() { + true ? FOO : FOO; // CHECK-NOT: Gap,{{.*}}, [[@LINE]]:8 -> +} Modified: cfe/trunk/test/CoverageMapping/includehell.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/includehell.cpp?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/includehell.cpp (original) +++ cfe/trunk/test/CoverageMapping/includehell.cpp Wed Nov 29 14:25:14 2017 @@ -37,18 +37,18 @@ int main() { // CHECK-MAIN-NEXT: File [[MAIN]], 16:35 -> 17:33 = #9 // CHECK-MAIN-NEXT: Expansion,File [[MAIN]], 17:12 -> 17:33 = #9 -// CHECK-START: File [[START1:[0-9]]], 1:1 -> 5:1 = #0 -// CHECK-START-NEXT: File [[START1]], 4:17 -> 4:22 = (#0 + #1) -// CHECK-START-NEXT: File [[START1]], 4:24 -> 4:27 = #1 -// CHECK-START-NEXT: File [[START1]], 4:29 -> 5:1 = #1 -// CHECK-START: File [[START2:[0-9]]], 1:1 -> 5:1 = #0 -// CHECK-START-NEXT: File [[START2]], 4:17 -> 4:22 = (#0 + #5) -// CHECK-START-NEXT: File [[START2]], 4:24 -> 4:27 = #5 -// CHECK-START-NEXT: File [[START2]], 4:29 -> 5:1 = #5 -// CHECK-START: File [[START3:[0-9]]], 1:1 -> 5:1 = #0 -// CHECK-START-NEXT: File [[START3]], 4:17 -> 4:22 = (#0 + #9) -// CHECK-START-NEXT: File [[START3]], 4:24 -> 4:27 = #9 -// CHECK-START-NEXT: File [[START3]], 4:29 -> 5:1 = #9 +// CHECK-START: File [[START1:[0-9]]], 1:1 -> 5:1 = #0 +// CHECK-START: File [[START1]], 4:17 -> 4:22 = (#0 + #1) +// CHECK-START: File [[START1]], 4:24 -> 4:27 = #1 +// CHECK-START: File [[START1]], 4:29 -> 5:1 = #1 +// CHECK-START: File [[START2:[0-9]]], 1:1 -> 5:1 = #0 +// CHECK-START: File [[START2]], 4:17 -> 4:22 = (#0 + #5) +// CHECK-START: File [[START2]], 4:24 -> 4:27 = #5 +// CHECK-START: File [[START2]], 4:29 -> 5:1 = #5 +// CHECK-START: File [[START3:[0-9]]], 1:1 -> 5:1 = #0 +// CHECK-START: File [[START3]], 4:17 -> 4:22 = (#0 + #9) +// CHECK-START: File [[START3]], 4:24 -> 4:27 = #9 +// CHECK-START: File [[START3]], 4:29 -> 5:1 = #9 // CHECK-CODE: File [[CODE1:[0-9]]], 1:1 -> 14:1 = #1 // CHECK-CODE-NEXT: File [[CODE1]], 4:5 -> 4:11 = #1 @@ -65,15 +65,15 @@ int main() { // CHECK-CODE: File [[CODE2]], 9:11 -> 11:2 = #7 // CHECK-CODE: File [[CODE2]], 11:8 -> 13:2 = (#5 - #7) -// CHECK-END: File [[END1:[0-9]]], 1:1 -> 3:2 = #1 -// CHECK-END-NEXT: File [[END1]], 1:1 -> 6:1 = #0 -// CHECK-END-NEXT: File [[END1]], 5:5 -> 5:9 = #0 +// CHECK-END: File [[END1:[0-9]]], 1:1 -> 3:2 = #1 +// CHECK-END: File [[END1]], 1:1 -> 6:1 = #0 +// CHECK-END: File [[END1]], 5:5 -> 5:9 = #0 // CHECK-END: File [[END1]], 5:11 -> 5:16 = #4 -// CHECK-END: File [[END2:[0-9]]], 1:1 -> 3:2 = #5 -// CHECK-END-NEXT: File [[END2]], 1:1 -> 6:1 = #0 -// CHECK-END-NEXT: File [[END2]], 5:5 -> 5:9 = #0 +// CHECK-END: File [[END2:[0-9]]], 1:1 -> 3:2 = #5 +// CHECK-END: File [[END2]], 1:1 -> 6:1 = #0 +// CHECK-END: File [[END2]], 5:5 -> 5:9 = #0 // CHECK-END: File [[END2]], 5:11 -> 5:16 = #8 -// CHECK-END: File [[END3:[0-9]]], 1:1 -> 3:2 = #9 -// CHECK-END-NEXT: File [[END3]], 1:1 -> 6:1 = #0 -// CHECK-END-NEXT: File [[END3]], 5:5 -> 5:9 = #0 +// CHECK-END: File [[END3:[0-9]]], 1:1 -> 3:2 = #9 +// CHECK-END: File [[END3]], 1:1 -> 6:1 = #0 +// CHECK-END: File [[END3]], 5:5 -> 5:9 = #0 // CHECK-END: File [[END3]], 5:11 -> 5:16 = #10 Modified: cfe/trunk/test/CoverageMapping/label.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/label.cpp?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/label.cpp (original) +++ cfe/trunk/test/CoverageMapping/label.cpp Wed Nov 29 14:25:14 2017 @@ -4,7 +4,7 @@ void func() { // CHECK-NEXT: File 0, [[@LINE]]:13 -> {{[0-9]+}}:2 = #0 int i = 0; // CHECK-NEXT: File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:20 = (#0 + #3) // CHECK-NEXT: File 0, [[@LINE+1]]:22 -> [[@LINE+1]]:25 = #3 - for(i = 0; i < 10; ++i) { // CHECK-NEXT: File 0, [[@LINE]]:27 -> [[@LINE+11]]:4 = #1 + for(i = 0; i < 10; ++i) { // CHECK: File 0, [[@LINE]]:27 -> [[@LINE+11]]:4 = #1 // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:13 = #1 if(i < 5) { // CHECK: File 0, [[@LINE]]:15 -> [[@LINE+6]]:6 = #2 { Modified: cfe/trunk/test/CoverageMapping/loops.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/loops.cpp?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/loops.cpp (original) +++ cfe/trunk/test/CoverageMapping/loops.cpp Wed Nov 29 14:25:14 2017 @@ -3,7 +3,7 @@ // CHECK: rangedFor void rangedFor() { // CHECK-NEXT: File 0, [[@LINE]]:18 -> {{[0-9]+}}:2 = #0 int arr[] = { 1, 2, 3, 4, 5 }; - int sum = 0; + int sum = 0; // CHECK: Gap,File 0, [[@LINE+1]]:20 -> [[@LINE+1]]:21 = #1 for(auto i : arr) { // CHECK: File 0, [[@LINE]]:21 -> [[@LINE+6]]:4 = #1 if (i == 3) continue; // CHECK: File 0, [[@LINE]]:7 -> [[@LINE]]:15 = #2 @@ -17,24 +17,27 @@ void rangedFor() { // C } // CHECK: main: -int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+24]]:2 = #0 +int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> {{.*}}:2 = #0 // CHECK-NEXT: File 0, [[@LINE+1]]:18 -> [[@LINE+1]]:24 = (#0 + #1) for(int i = 0; i < 10; ++i) // CHECK-NEXT: File 0, [[@LINE]]:26 -> [[@LINE]]:29 = #1 - ; // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE]]:7 = #1 + ; // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:30 -> [[@LINE]]:6 = #1 + // CHECK-NEXT: File 0, [[@LINE-1]]:6 -> [[@LINE-1]]:7 = #1 for(int i = 0; i < 10; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = (#0 + #2) ++i) // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:10 = #2 - { // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:4 = #2 - int x = 0; + { // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:11 -> [[@LINE]]:3 = #2 + int x = 0; // CHECK-NEXT: File 0, [[@LINE-1]]:3 -> [[@LINE+1]]:4 = #2 } int j = 0; // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:14 = (#0 + #3) - while(j < 5) ++j; // CHECK-NEXT: File 0, [[@LINE]]:16 -> [[@LINE]]:19 = #3 + while(j < 5) ++j; // CHECK-NEXT: Gap,File 0, [[@LINE]]:15 -> [[@LINE]]:16 = #3 + // CHECK-NEXT: File 0, [[@LINE-1]]:16 -> [[@LINE-1]]:19 = #3 + do { // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE+2]]:4 = (#0 + #4) ++j; } while(j < 10); // CHECK-NEXT: File 0, [[@LINE]]:11 -> [[@LINE]]:17 = (#0 + #4) j = 0; - while - (j < 5) // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:10 = (#0 + #5) + while // CHECK-NEXT: File 0, [[@LINE+1]]:5 -> [[@LINE+1]]:10 = (#0 + #5) + (j < 5) // CHECK-NEXT: Gap,File 0, [[@LINE]]:11 -> [[@LINE+1]]:6 = #5 ++j; // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE]]:9 = #5 do ++j; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:8 = (#0 + #6) Modified: cfe/trunk/test/CoverageMapping/macro-expressions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/macro-expressions.cpp?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/macro-expressions.cpp (original) +++ cfe/trunk/test/CoverageMapping/macro-expressions.cpp Wed Nov 29 14:25:14 2017 @@ -61,12 +61,12 @@ void foo(int i) { // CHECK-NEXT: File 0, [[@LINE+1]]:16 -> [[@LINE+1]]:18 = #2 if (EXPR(i)) {} // CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:9 -> [[@LINE+2]]:14 = (#0 + #3) - // CHECK-NEXT: File 0, [[@LINE+1]]:20 -> [[@LINE+1]]:22 = #3 + // CHECK: File 0, [[@LINE+1]]:20 -> [[@LINE+1]]:22 = #3 for (;NEXPR(i);) {} // CHECK-NEXT: Expansion,File 0, [[@LINE+4]]:8 -> [[@LINE+4]]:14 = #0 // CHECK-NEXT: Expansion,File 0, [[@LINE+3]]:33 -> [[@LINE+3]]:35 = (#0 + #4) // CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:43 -> [[@LINE+2]]:46 = #4 - // CHECK-NEXT: File 0, [[@LINE+1]]:51 -> [[@LINE+1]]:53 = #4 + // CHECK: File 0, [[@LINE+1]]:51 -> [[@LINE+1]]:53 = #4 for (ASSIGN(DECL(int, j), 0); LT(j, i); INC(j)) {} // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:9 = #0 ASSIGN(DECL(int, k), 0); @@ -79,7 +79,7 @@ void foo(int i) { do {} while (NEXPR(i)); // CHECK-NEXT: Expansion,File 0, [[@LINE+3]]:8 -> [[@LINE+3]]:12 = #0 // CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:23 -> [[@LINE+2]]:26 = #0 - // CHECK-NEXT: File 0, [[@LINE+1]]:42 -> [[@LINE+1]]:44 = #7 + // CHECK: File 0, [[@LINE+1]]:42 -> [[@LINE+1]]:44 = #7 for (DECL(int, j) : ARR(int, 1, 2, 3)) {} // CHECK-NEXT: Expansion,File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:20 = #0 Modified: cfe/trunk/test/CoverageMapping/macros.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/macros.c?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/macros.c (original) +++ cfe/trunk/test/CoverageMapping/macros.c Wed Nov 29 14:25:14 2017 @@ -40,7 +40,7 @@ void func3() { // CHECK-NEXT: File 0, [[ void func4() { // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+6]]:2 = #0 int i = 0; while (i++ < 10) // CHECK-NEXT: File 0, [[@LINE]]:10 -> [[@LINE]]:18 = (#0 + #1) - if (i < 5) // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+2]]:14 = #1 + if (i < 5) // CHECK: File 0, [[@LINE]]:5 -> [[@LINE+2]]:14 = #1 // CHECK-NEXT: File 0, [[@LINE-1]]:9 -> [[@LINE-1]]:14 = #1 MACRO_2; // CHECK-NEXT: Expansion,File 0, [[@LINE]]:7 -> [[@LINE]]:14 = #2 } Modified: cfe/trunk/test/CoverageMapping/objc.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/objc.m?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/objc.m (original) +++ cfe/trunk/test/CoverageMapping/objc.m Wed Nov 29 14:25:14 2017 @@ -17,7 +17,7 @@ void func(A *a) { // CHECK-NEXT: Fil // CHECK: func2 void func2(NSArray *array) { // CHECK-NEXT: File 0, [[@LINE]]:28 -> {{[0-9]+}}:2 = #0 - int i = 0; + int i = 0; // CHECK-NEXT: Gap,File 0, [[@LINE+1]]:28 -> [[@LINE+1]]:29 = #1 for (NSArray *x in array) { // CHECK-NEXT: File 0, [[@LINE]]:29 -> [[@LINE+7]]:4 = #1 // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:10 = #1 if (x) { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = #2 Modified: cfe/trunk/test/CoverageMapping/return.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/return.c?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/return.c (original) +++ cfe/trunk/test/CoverageMapping/return.c Wed Nov 29 14:25:14 2017 @@ -10,7 +10,7 @@ void func() { // CHECK void func2() { // CHECK-NEXT: File 0, [[@LINE]]:14 -> {{[0-9]+}}:2 = #0 // CHECK-NEXT: File 0, [[@LINE+2]]:18 -> [[@LINE+2]]:24 = ((#0 + #1) - #2) // CHECK-NEXT: File 0, [[@LINE+1]]:26 -> [[@LINE+1]]:29 = (#1 - #2) - for(int i = 0; i < 10; ++i) { // CHECK-NEXT: File 0, [[@LINE]]:31 -> {{[0-9]+}}:4 = #1 + for(int i = 0; i < 10; ++i) { // CHECK: File 0, [[@LINE]]:31 -> {{[0-9]+}}:4 = #1 // CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:13 = #1 if(i > 2) { // CHECK: File 0, [[@LINE]]:15 -> [[@LINE+2]]:6 = #2 return; // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+3]]:5 = (#1 - #2) @@ -29,7 +29,7 @@ void func3(int x) { // CHECK- // CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:11 = #0 if(x > 5) { // CHECK: File 0, [[@LINE]]:13 -> [[@LINE+6]]:4 = #1 while(x >= 9) { // CHECK-NEXT: File 0, [[@LINE]]:11 -> [[@LINE]]:17 = #1 - return; // CHECK-NEXT: File 0, [[@LINE-1]]:19 -> [[@LINE+2]]:6 = #2 + return; // CHECK: File 0, [[@LINE-1]]:19 -> [[@LINE+2]]:6 = #2 --x; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE+1]]:6 = 0 } int i = 0; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+1]]:4 = (#1 - #2) Modified: cfe/trunk/test/CoverageMapping/test.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/test.c?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/test.c (original) +++ cfe/trunk/test/CoverageMapping/test.c Wed Nov 29 14:25:14 2017 @@ -7,7 +7,7 @@ static void static_func(); int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+7]]:2 = #0 // CHECK-NEXT: File 0, [[@LINE+1]]:18 -> [[@LINE+1]]:24 = (#0 + #1) for(int i = 0; i < 10; ++i) { // CHECK-NEXT: File 0, [[@LINE]]:26 -> [[@LINE]]:29 = #1 - bar(); // CHECK-NEXT: File 0, [[@LINE-1]]:31 -> [[@LINE+1]]:4 = #1 + bar(); // CHECK: File 0, [[@LINE-1]]:31 -> [[@LINE+1]]:4 = #1 } static_func(); return 0; Modified: cfe/trunk/test/CoverageMapping/while.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/while.c?rev=319373&r1=319372&r2=319373&view=diff ============================================================================== --- cfe/trunk/test/CoverageMapping/while.c (original) +++ cfe/trunk/test/CoverageMapping/while.c Wed Nov 29 14:25:14 2017 @@ -3,10 +3,10 @@ // CHECK: main int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+8]]:2 = #0 int j = 0; // CHECK-NEXT: File 0, [[@LINE+1]]:9 -> [[@LINE+1]]:14 = (#0 + #1) - while(j < 5) ++j; // CHECK-NEXT: File 0, [[@LINE]]:16 -> [[@LINE]]:19 = #1 - j = 0; - while - (j < 5) // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:10 = (#0 + #2) + while(j < 5) ++j; // CHECK-NEXT: File 0, [[@LINE]]:15 -> [[@LINE]]:16 = #1 + j = 0; // CHECK-NEXT: File 0, [[@LINE-1]]:16 -> [[@LINE-1]]:19 = #1 + while // CHECK-NEXT: File 0, [[@LINE+1]]:5 -> [[@LINE+1]]:10 = (#0 + #2) + (j < 5) // CHECK-NEXT: Gap,File 0, [[@LINE]]:11 -> [[@LINE+1]]:6 = #2 ++j; // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE]]:9 = #2 return 0; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits