comparison tools/llvm-cov/gcov.cpp @ 147:c2174574ed3a

LLVM 10
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 16:55:33 +0900
parents 3a76565eade5
children
comparison
equal deleted inserted replaced
134:3a76565eade5 147:c2174574ed3a
1 //===- gcov.cpp - GCOV compatible LLVM coverage tool ----------------------===// 1 //===- gcov.cpp - GCOV compatible LLVM coverage tool ----------------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // 4 // See https://llvm.org/LICENSE.txt for license information.
5 // This file is distributed under the University of Illinois Open Source 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 // License. See LICENSE.TXT for details.
7 // 6 //
8 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
9 // 8 //
10 // llvm-cov is a command line tools to analyze and report coverage information. 9 // llvm-cov is a command line tools to analyze and report coverage information.
11 // 10 //
123 cl::opt<bool> UncondBranch("u", cl::Grouping, cl::init(false), 122 cl::opt<bool> UncondBranch("u", cl::Grouping, cl::init(false),
124 cl::desc("Display unconditional branch info " 123 cl::desc("Display unconditional branch info "
125 "(requires -b)")); 124 "(requires -b)"));
126 cl::alias UncondBranchA("unconditional-branches", cl::aliasopt(UncondBranch)); 125 cl::alias UncondBranchA("unconditional-branches", cl::aliasopt(UncondBranch));
127 126
127 cl::opt<bool> HashFilenames("x", cl::Grouping, cl::init(false),
128 cl::desc("Hash long pathnames"));
129 cl::alias HashFilenamesA("hash-filenames", cl::aliasopt(HashFilenames));
130
131
128 cl::OptionCategory DebugCat("Internal and debugging options"); 132 cl::OptionCategory DebugCat("Internal and debugging options");
129 cl::opt<bool> DumpGCOV("dump", cl::init(false), cl::cat(DebugCat), 133 cl::opt<bool> DumpGCOV("dump", cl::init(false), cl::cat(DebugCat),
130 cl::desc("Dump the gcov file to stderr")); 134 cl::desc("Dump the gcov file to stderr"));
131 cl::opt<std::string> InputGCNO("gcno", cl::cat(DebugCat), cl::init(""), 135 cl::opt<std::string> InputGCNO("gcno", cl::cat(DebugCat), cl::init(""),
132 cl::desc("Override inferred gcno file")); 136 cl::desc("Override inferred gcno file"));
134 cl::desc("Override inferred gcda file")); 138 cl::desc("Override inferred gcda file"));
135 139
136 cl::ParseCommandLineOptions(argc, argv, "LLVM code coverage tool\n"); 140 cl::ParseCommandLineOptions(argc, argv, "LLVM code coverage tool\n");
137 141
138 GCOV::Options Options(AllBlocks, BranchProb, BranchCount, FuncSummary, 142 GCOV::Options Options(AllBlocks, BranchProb, BranchCount, FuncSummary,
139 PreservePaths, UncondBranch, LongNames, NoOutput); 143 PreservePaths, UncondBranch, LongNames, NoOutput,
144 HashFilenames);
140 145
141 for (const auto &SourceFile : SourceFiles) 146 for (const auto &SourceFile : SourceFiles)
142 reportCoverage(SourceFile, ObjectDir, InputGCNO, InputGCDA, DumpGCOV, 147 reportCoverage(SourceFile, ObjectDir, InputGCNO, InputGCDA, DumpGCOV,
143 Options); 148 Options);
144 return 0; 149 return 0;