From 1184005c1ef3377ebb0b327df90c7819bcd7a1da Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 14 Oct 2015 00:04:19 +0000 Subject: [PATCH] Rename one of our two llvm::GCOVOptions classes to llvm::GCOV::Options. We used to get away with this because llvm/Support/GCOV.h was an implementation detail of the llvm-gcov tool, but it's now being used by FDO. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250258 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/GCOV.h | 12 ++++++------ include/llvm/module.modulemap | 4 ---- lib/IR/GCOV.cpp | 4 ++-- tools/llvm-cov/gcov.cpp | 6 +++--- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/include/llvm/Support/GCOV.h b/include/llvm/Support/GCOV.h index 4c35128deca..544434f036a 100644 --- a/include/llvm/Support/GCOV.h +++ b/include/llvm/Support/GCOV.h @@ -31,11 +31,10 @@ class FileInfo; namespace GCOV { enum GCOVVersion { V402, V404, V704 }; -} // end GCOV namespace -/// GCOVOptions - A struct for passing gcov options between functions. -struct GCOVOptions { - GCOVOptions(bool A, bool B, bool C, bool F, bool P, bool U, bool L, bool N) +/// \brief A struct for passing gcov options between functions. +struct Options { + Options(bool A, bool B, bool C, bool F, bool P, bool U, bool L, bool N) : AllBlocks(A), BranchInfo(B), BranchCount(C), FuncCoverage(F), PreservePaths(P), UncondBranch(U), LongFileNames(L), NoOutput(N) {} @@ -48,6 +47,7 @@ struct GCOVOptions { bool LongFileNames; bool NoOutput; }; +} // end GCOV namespace /// GCOVBuffer - A wrapper around MemoryBuffer to provide GCOV specific /// read operations. @@ -395,7 +395,7 @@ class FileInfo { }; public: - FileInfo(const GCOVOptions &Options) + FileInfo(const GCOV::Options &Options) : Options(Options), LineInfo(), RunCount(0), ProgramCount(0) {} void addBlockLine(StringRef Filename, uint32_t Line, const GCOVBlock *Block) { @@ -429,7 +429,7 @@ private: void printFuncCoverage(raw_ostream &OS) const; void printFileCoverage(raw_ostream &OS) const; - const GCOVOptions &Options; + const GCOV::Options &Options; StringMap LineInfo; uint32_t RunCount; uint32_t ProgramCount; diff --git a/include/llvm/module.modulemap b/include/llvm/module.modulemap index 6d6fcbe2296..7b0b92d18fe 100644 --- a/include/llvm/module.modulemap +++ b/include/llvm/module.modulemap @@ -190,10 +190,6 @@ module LLVM_Utils { // Exclude this; it's fundamentally non-modular. exclude header "Support/PluginLoader.h" - // Exclude this; it's a weirdly-factored part of llvm-gcov and conflicts - // with the Analysis module (which also defines an llvm::GCOVOptions). - exclude header "Support/GCOV.h" - // FIXME: Mislayered? exclude header "Support/TargetRegistry.h" diff --git a/lib/IR/GCOV.cpp b/lib/IR/GCOV.cpp index 6ed58913172..35b8157751b 100644 --- a/lib/IR/GCOV.cpp +++ b/lib/IR/GCOV.cpp @@ -448,7 +448,7 @@ static uint32_t branchDiv(uint64_t Numerator, uint64_t Divisor) { namespace { struct formatBranchInfo { - formatBranchInfo(const GCOVOptions &Options, uint64_t Count, uint64_t Total) + formatBranchInfo(const GCOV::Options &Options, uint64_t Count, uint64_t Total) : Options(Options), Count(Count), Total(Total) {} void print(raw_ostream &OS) const { @@ -460,7 +460,7 @@ struct formatBranchInfo { OS << "taken " << branchDiv(Count, Total) << "%"; } - const GCOVOptions &Options; + const GCOV::Options &Options; uint64_t Count; uint64_t Total; }; diff --git a/tools/llvm-cov/gcov.cpp b/tools/llvm-cov/gcov.cpp index 4377a50b556..a5343fa29af 100644 --- a/tools/llvm-cov/gcov.cpp +++ b/tools/llvm-cov/gcov.cpp @@ -26,7 +26,7 @@ using namespace llvm; static void reportCoverage(StringRef SourceFile, StringRef ObjectDir, const std::string &InputGCNO, const std::string &InputGCDA, bool DumpGCOV, - const GCOVOptions &Options) { + const GCOV::Options &Options) { SmallString<128> CoverageFileStem(ObjectDir); if (CoverageFileStem.empty()) { // If no directory was specified with -o, look next to the source file. @@ -143,8 +143,8 @@ int gcovMain(int argc, const char *argv[]) { cl::ParseCommandLineOptions(argc, argv, "LLVM code coverage tool\n"); - GCOVOptions Options(AllBlocks, BranchProb, BranchCount, FuncSummary, - PreservePaths, UncondBranch, LongNames, NoOutput); + GCOV::Options Options(AllBlocks, BranchProb, BranchCount, FuncSummary, + PreservePaths, UncondBranch, LongNames, NoOutput); for (const auto &SourceFile : SourceFiles) reportCoverage(SourceFile, ObjectDir, InputGCNO, InputGCDA, DumpGCOV, -- 2.34.1