Skip to content

Commit e698079

Browse files
authored
Allow CoverageMapping::getCoverageForFile() to show Branches also outside functions (llvm#120416)
Fixes llvm#119952
1 parent ef95590 commit e698079

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/lib/ProfileData/Coverage/CoverageMapping.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,7 @@ CoverageData CoverageMapping::getCoverageForFile(StringRef Filename) const {
14121412
}
14131413
// Capture branch regions specific to the function (excluding expansions).
14141414
for (const auto &CR : Function.CountedBranchRegions)
1415-
if (FileIDs.test(CR.FileID) && (CR.FileID == CR.ExpandedFileID))
1415+
if (FileIDs.test(CR.FileID))
14161416
FileCoverage.BranchRegions.push_back(CR);
14171417
// Capture MCDC records specific to the function.
14181418
for (const auto &MR : Function.MCDCRecords)

llvm/test/tools/llvm-cov/branch-macros.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#define COND1 (a == b)
66
#define COND2 (a != b)
77
#define COND3 (COND1 && COND2)
8-
#define COND4 (COND3 ? COND2 : COND1)
8+
#define COND4 (COND3 ? COND2 : COND1) // CHECK: | Branch ([[@LINE]]:15): [True: 1, False: 2]
99
#define MACRO1 COND3
1010
#define MACRO2 MACRO1
1111
#define MACRO3 MACRO2

0 commit comments

Comments
 (0)