diff options
| author | Keith Smiley <keithbsmiley@gmail.com> | 2025-06-13 10:04:45 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-13 10:04:45 -0700 |
| commit | 65d88d31ea279bbab8a0fa2c8abfb3f723a1715b (patch) | |
| tree | cf0b436393566036be4f0ef397867a0729500146 /llvm/tools/llvm-cov/CodeCoverage.cpp | |
| parent | 2704b27a0b452f4aaf87ab26d315fdc92857373a (diff) | |
| download | llvm-65d88d31ea279bbab8a0fa2c8abfb3f723a1715b.zip llvm-65d88d31ea279bbab8a0fa2c8abfb3f723a1715b.tar.gz llvm-65d88d31ea279bbab8a0fa2c8abfb3f723a1715b.tar.bz2 | |
Revert "[llvm-cov] Add support for baseline coverage" (#144121)
Reverts llvm/llvm-project#117910
```
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/ProfileData/CoverageMappingTest.cpp
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/ProfileData/CoverageMappingTest.cpp:281:28: error: 'std::reference_wrapper' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
281 | std::make_optional(std::reference_wrapper(*ProfileReader));
| ^
/usr/lib/gcc/ppc64le-redhat-linux/8/../../../../include/c++/8/bits/refwrap.h:289:11: note: add a deduction guide to suppress this warning
289 | class reference_wrapper
| ^
```
Diffstat (limited to 'llvm/tools/llvm-cov/CodeCoverage.cpp')
| -rw-r--r-- | llvm/tools/llvm-cov/CodeCoverage.cpp | 78 |
1 files changed, 28 insertions, 50 deletions
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp index 6c66858..1f2484c 100644 --- a/llvm/tools/llvm-cov/CodeCoverage.cpp +++ b/llvm/tools/llvm-cov/CodeCoverage.cpp @@ -153,7 +153,7 @@ private: bool HadSourceFiles = false; /// The path to the indexed profile. - std::optional<std::string> PGOFilename; + std::string PGOFilename; /// A list of input source files. std::vector<std::string> SourceFiles; @@ -455,12 +455,10 @@ static bool modifiedTimeGT(StringRef LHS, StringRef RHS) { } std::unique_ptr<CoverageMapping> CodeCoverageTool::load() { - if (PGOFilename) { - for (StringRef ObjectFilename : ObjectFilenames) - if (modifiedTimeGT(ObjectFilename, PGOFilename.value())) - warning("profile data may be out of date - object is newer", - ObjectFilename); - } + for (StringRef ObjectFilename : ObjectFilenames) + if (modifiedTimeGT(ObjectFilename, PGOFilename)) + warning("profile data may be out of date - object is newer", + ObjectFilename); auto FS = vfs::getRealFileSystem(); auto CoverageOrErr = CoverageMapping::load( ObjectFilenames, PGOFilename, *FS, CoverageArches, @@ -670,16 +668,11 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) { "dump-collected-paths", cl::Optional, cl::Hidden, cl::desc("Show the collected paths to source files")); - cl::opt<std::string> PGOFilename( - "instr-profile", cl::Optional, + cl::opt<std::string, true> PGOFilename( + "instr-profile", cl::Required, cl::location(this->PGOFilename), cl::desc( "File with the profile data obtained after an instrumented run")); - cl::opt<bool> EmptyProfile( - "empty-profile", cl::Optional, - cl::desc("Use a synthetic profile with no data to generate " - "baseline coverage")); - cl::list<std::string> Arches( "arch", cl::desc("architectures of the coverage mapping binaries")); @@ -812,15 +805,6 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) { } this->CheckBinaryIDs = CheckBinaryIDs; - if (!PGOFilename.empty() == EmptyProfile) { - error( - "exactly one of -instr-profile and -empty-profile must be specified"); - return 1; - } - if (!PGOFilename.empty()) { - this->PGOFilename = std::make_optional(PGOFilename.getValue()); - } - if (!CovFilename.empty()) ObjectFilenames.emplace_back(CovFilename); for (const std::string &Filename : CovFilenames) @@ -1132,22 +1116,20 @@ int CodeCoverageTool::doShow(int argc, const char **argv, } } - if (PGOFilename) { - sys::fs::file_status Status; - if (std::error_code EC = sys::fs::status(PGOFilename.value(), Status)) { - error("could not read profile data!" + EC.message(), PGOFilename.value()); - return 1; - } + sys::fs::file_status Status; + if (std::error_code EC = sys::fs::status(PGOFilename, Status)) { + error("could not read profile data!" + EC.message(), PGOFilename); + return 1; + } - if (ShowCreatedTime) { - auto ModifiedTime = Status.getLastModificationTime(); - std::string ModifiedTimeStr = to_string(ModifiedTime); - size_t found = ModifiedTimeStr.rfind(':'); - ViewOpts.CreatedTimeStr = - (found != std::string::npos) - ? "Created: " + ModifiedTimeStr.substr(0, found) - : "Created: " + ModifiedTimeStr; - } + if (ShowCreatedTime) { + auto ModifiedTime = Status.getLastModificationTime(); + std::string ModifiedTimeStr = to_string(ModifiedTime); + size_t found = ModifiedTimeStr.rfind(':'); + ViewOpts.CreatedTimeStr = + (found != std::string::npos) + ? "Created: " + ModifiedTimeStr.substr(0, found) + : "Created: " + ModifiedTimeStr; } auto Coverage = load(); @@ -1256,12 +1238,10 @@ int CodeCoverageTool::doReport(int argc, const char **argv, return 1; } - if (PGOFilename) { - sys::fs::file_status Status; - if (std::error_code EC = sys::fs::status(PGOFilename.value(), Status)) { - error("could not read profile data!" + EC.message(), PGOFilename.value()); - return 1; - } + sys::fs::file_status Status; + if (std::error_code EC = sys::fs::status(PGOFilename, Status)) { + error("could not read profile data!" + EC.message(), PGOFilename); + return 1; } auto Coverage = load(); @@ -1323,12 +1303,10 @@ int CodeCoverageTool::doExport(int argc, const char **argv, return 1; } - if (PGOFilename) { - sys::fs::file_status Status; - if (std::error_code EC = sys::fs::status(PGOFilename.value(), Status)) { - error("could not read profile data!" + EC.message(), PGOFilename.value()); - return 1; - } + sys::fs::file_status Status; + if (std::error_code EC = sys::fs::status(PGOFilename, Status)) { + error("could not read profile data!" + EC.message(), PGOFilename); + return 1; } auto Coverage = load(); |
