diff options
author | Vedant Kumar <vsk@apple.com> | 2017-04-15 00:09:57 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-04-15 00:09:57 +0000 |
commit | 1a6a2b642bd61910424cb7244f547c02460f18db (patch) | |
tree | 8dceb66e86d3a0cf9ed57913af96d5ba602cb695 /llvm/tools/llvm-cov/TestingSupport.cpp | |
parent | 03df14c6dd2ae36b04d0a085ae9fa69aad8193ab (diff) | |
download | bcm5719-llvm-1a6a2b642bd61910424cb7244f547c02460f18db.tar.gz bcm5719-llvm-1a6a2b642bd61910424cb7244f547c02460f18db.zip |
[ProfileData] Unify getInstrProf*SectionName helpers
This is a version of D32090 that unifies all of the
`getInstrProf*SectionName` helper functions. (Note: the build failures
which D32090 would have addressed were fixed with r300352.)
We should unify these helper functions because they are hard to use in
their current form. E.g we recently introduced more helpers to fix
section naming for COFF files. This scheme doesn't totally succeed at
hiding low-level details about section naming, so we should switch to an
API that is easier to maintain.
This is not an NFC commit because it fixes llvm-cov's testing support
for COFF files (this falls out of the API change naturally). This is an
area where we lack tests -- I will see about adding one as a follow up.
Testing: check-clang, check-profile, check-llvm.
Differential Revision: https://reviews.llvm.org/D32097
llvm-svn: 300381
Diffstat (limited to 'llvm/tools/llvm-cov/TestingSupport.cpp')
-rw-r--r-- | llvm/tools/llvm-cov/TestingSupport.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/tools/llvm-cov/TestingSupport.cpp b/llvm/tools/llvm-cov/TestingSupport.cpp index a272aa5422e..4713d75f17d 100644 --- a/llvm/tools/llvm-cov/TestingSupport.cpp +++ b/llvm/tools/llvm-cov/TestingSupport.cpp @@ -48,18 +48,16 @@ int convertForTestingMain(int argc, const char *argv[]) { // Look for the sections that we are interested in. int FoundSectionCount = 0; SectionRef ProfileNames, CoverageMapping; + auto ObjFormat = OF->getTripleObjectFormat(); for (const auto &Section : OF->sections()) { StringRef Name; if (Section.getName(Name)) return 1; - // TODO: with the current getInstrProfXXXSectionName interfaces, the - // the host tool is limited to read coverage section on - // binaries with compatible profile section naming scheme as the host - // platform. Currently, COFF format binaries have different section - // naming scheme from the all the rest. - if (Name == llvm::getInstrProfNameSectionName()) { + if (Name == llvm::getInstrProfSectionName(IPSK_name, ObjFormat, + /*AddSegmentInfo=*/false)) { ProfileNames = Section; - } else if (Name == llvm::getInstrProfCoverageSectionName()) { + } else if (Name == llvm::getInstrProfSectionName( + IPSK_covmap, ObjFormat, /*AddSegmentInfo=*/false)) { CoverageMapping = Section; } else continue; |