Skip to content

Commit 6629cf1

Browse files
committed
update region only when needed
1 parent 108a9ac commit 6629cf1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang/lib/CodeGen/CoverageMappingGen.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,10 @@ class CoverageMappingBuilder {
374374
auto NonScratchExpansionLoc = getNonScratchExpansionLoc(Loc);
375375
Loc = NonScratchExpansionLoc.first;
376376
auto EndLoc = NonScratchExpansionLoc.second;
377-
Region.setStartLoc(Loc);
378-
Region.setEndLoc(EndLoc.has_value() ? EndLoc.value()
379-
: Region.getEndLoc());
377+
if (EndLoc.has_value()) {
378+
Region.setStartLoc(Loc);
379+
Region.setEndLoc(EndLoc.value());
380+
}
380381

381382
// Replace Loc with FileLoc if it is expanded with system headers.
382383
if (!SystemHeadersCoverage && SM.isInSystemMacro(Loc)) {

0 commit comments

Comments
 (0)