diff options
author | Vedant Kumar <vsk@apple.com> | 2019-02-19 20:45:00 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2019-02-19 20:45:00 +0000 |
commit | a0b97254797873b69ad5087ef748aebcf4426db8 (patch) | |
tree | 48122189823617ac729b4abd4c93d0bd35511182 /llvm/tools/llvm-cov | |
parent | 069af04a4a3855bd0b7d7f1bdad8a0d8bb10db85 (diff) | |
download | bcm5719-llvm-a0b97254797873b69ad5087ef748aebcf4426db8.tar.gz bcm5719-llvm-a0b97254797873b69ad5087ef748aebcf4426db8.zip |
[llvm-cov] Add support for gcov --hash-filenames option
The patch adds support for --hash-filenames to llvm-cov. This option adds md5
hash of the source path to the name of the generated .gcov file. The option is
crucial for cases where you have multiple files with the same name but can't
use --preserve-paths as resulting filenames exceed the limit.
from gcov(1):
```
-x
--hash-filenames
By default, gcov uses the full pathname of the source files to to
create an output filename. This can lead to long filenames that
can overflow filesystem limits. This option creates names of the
form source-file##md5.gcov, where the source-file component is
the final filename part and the md5 component is calculated from
the full mangled name that would have been used otherwise.
```
Patch by Igor Ignatev!
Differential Revision: https://reviews.llvm.org/D58370
llvm-svn: 354379
Diffstat (limited to 'llvm/tools/llvm-cov')
-rw-r--r-- | llvm/tools/llvm-cov/gcov.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/tools/llvm-cov/gcov.cpp b/llvm/tools/llvm-cov/gcov.cpp index 58ef2cf0219..8a00ff64711 100644 --- a/llvm/tools/llvm-cov/gcov.cpp +++ b/llvm/tools/llvm-cov/gcov.cpp @@ -124,6 +124,11 @@ int gcovMain(int argc, const char *argv[]) { "(requires -b)")); cl::alias UncondBranchA("unconditional-branches", cl::aliasopt(UncondBranch)); + cl::opt<bool> HashFilenames("x", cl::Grouping, cl::init(false), + cl::desc("Hash long pathnames")); + cl::alias HashFilenamesA("hash-filenames", cl::aliasopt(HashFilenames)); + + cl::OptionCategory DebugCat("Internal and debugging options"); cl::opt<bool> DumpGCOV("dump", cl::init(false), cl::cat(DebugCat), cl::desc("Dump the gcov file to stderr")); @@ -135,7 +140,8 @@ int gcovMain(int argc, const char *argv[]) { cl::ParseCommandLineOptions(argc, argv, "LLVM code coverage tool\n"); GCOV::Options Options(AllBlocks, BranchProb, BranchCount, FuncSummary, - PreservePaths, UncondBranch, LongNames, NoOutput); + PreservePaths, UncondBranch, LongNames, NoOutput, + HashFilenames); for (const auto &SourceFile : SourceFiles) reportCoverage(SourceFile, ObjectDir, InputGCNO, InputGCDA, DumpGCOV, |