[llvm] r196184 - llvm-cov: Removed output to STDOUT/specified file.

Yuchen Wu yuchenericwu at hotmail.com
Thu Dec 5 12:51:30 PST 2013


Aside from making testing a little harder for me (I have to make sure gcov and llvm-cov files don't clobber), I can't really come up with a good reason not to use the ".gcov" extension.

I've made the change in r196530.

-Yuchen

----------------------------------------
> Date: Thu, 5 Dec 2013 11:24:07 -0800
> Subject: Re: [llvm] r196184 - llvm-cov: Removed output to STDOUT/specified file.
> From: echristo at gmail.com
> To: bob.wilson at apple.com
> CC: yuchenericwu at hotmail.com; llvm-commits at cs.uiuc.edu
>
> Agreed. Unless we invite our own format, but otherwise definitely
> undesirable. :)
>
> -eric
>
> On Thu, Dec 5, 2013 at 11:19 AM, Bob Wilson <bob.wilson at apple.com> wrote:
>> Tools that operate on top of gcov are going to expect to find the output in “.gcov” files. I’d like llvm-cov to follow the same convention. I don’t see any reason to introduce a new “.llcov” convention.
>>
>> On Dec 2, 2013, at 4:57 PM, Yuchen Wu <yuchenericwu at hotmail.com> wrote:
>>
>>> Author: ywu
>>> Date: Mon Dec 2 18:57:11 2013
>>> New Revision: 196184
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=196184&view=rev
>>> Log:
>>> llvm-cov: Removed output to STDOUT/specified file.
>>>
>>> Instead of asking the user to specify a single file to output coverage
>>> info and defaulting to STDOUT, llvm-cov now creates files for each
>>> source file with a naming system of: <source filename> + ".llcov".
>>>
>>> This is what gcov does and although it can clutter the working directory
>>> with numerous coverage files, it will be easier to hook the llvm-cov
>>> output to tools which operate on this assumption (such as lcov).
>>>
>>> Modified:
>>> llvm/trunk/include/llvm/Support/GCOV.h
>>> llvm/trunk/lib/IR/GCOV.cpp
>>> llvm/trunk/test/tools/llvm-cov/llvm-cov.test
>>> llvm/trunk/tools/llvm-cov/llvm-cov.cpp
>>>
>>> Modified: llvm/trunk/include/llvm/Support/GCOV.h
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GCOV.h?rev=196184&r1=196183&r2=196184&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/include/llvm/Support/GCOV.h (original)
>>> +++ llvm/trunk/include/llvm/Support/GCOV.h Mon Dec 2 18:57:11 2013
>>> @@ -279,7 +279,7 @@ public:
>>> }
>>> void setRunCount(uint32_t Runs) { RunCount = Runs; }
>>> void setProgramCount(uint32_t Programs) { ProgramCount = Programs; }
>>> - void print(raw_fd_ostream &OS, StringRef gcnoFile, StringRef gcdaFile) const;
>>> + void print(StringRef gcnoFile, StringRef gcdaFile) const;
>>> private:
>>> StringMap<LineData> LineInfo;
>>> uint32_t RunCount;
>>>
>>> Modified: llvm/trunk/lib/IR/GCOV.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/GCOV.cpp?rev=196184&r1=196183&r2=196184&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/IR/GCOV.cpp (original)
>>> +++ llvm/trunk/lib/IR/GCOV.cpp Mon Dec 2 18:57:11 2013
>>> @@ -317,8 +317,7 @@ void GCOVBlock::dump() const {
>>> // FileInfo implementation.
>>>
>>> /// print - Print source files with collected line count information.
>>> -void FileInfo::print(raw_fd_ostream &OS, StringRef gcnoFile,
>>> - StringRef gcdaFile) const {
>>> +void FileInfo::print(StringRef gcnoFile, StringRef gcdaFile) const {
>>> for (StringMap<LineData>::const_iterator I = LineInfo.begin(),
>>> E = LineInfo.end(); I != E; ++I) {
>>> StringRef Filename = I->first();
>>> @@ -329,6 +328,12 @@ void FileInfo::print(raw_fd_ostream &OS,
>>> }
>>> StringRef AllLines = Buff->getBuffer();
>>>
>>> + std::string CovFilename = Filename.str() + ".llcov";
>>> + std::string ErrorInfo;
>>> + raw_fd_ostream OS(CovFilename.c_str(), ErrorInfo);
>>> + if (!ErrorInfo.empty())
>>> + errs() << ErrorInfo << "\n";
>>> +
>>> OS << " -: 0:Source:" << Filename << "\n";
>>> OS << " -: 0:Graph:" << gcnoFile << "\n";
>>> OS << " -: 0:Data:" << gcdaFile << "\n";
>>>
>>> Modified: llvm/trunk/test/tools/llvm-cov/llvm-cov.test
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/llvm-cov.test?rev=196184&r1=196183&r2=196184&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/test/tools/llvm-cov/llvm-cov.test (original)
>>> +++ llvm/trunk/test/tools/llvm-cov/llvm-cov.test Mon Dec 2 18:57:11 2013
>>> @@ -2,8 +2,9 @@ RUN: cd %p/Inputs
>>> # "cd" is unsupported in lit internal runner.
>>> REQUIRES: shell
>>>
>>> -RUN: llvm-cov -gcno=test.gcno -gcda=test.gcda \
>>> -RUN: | diff -aub test.cpp.gcov -
>>> +RUN: llvm-cov -gcno=test.gcno -gcda=test.gcda
>>> +RUN: diff test.cpp.gcov test.cpp.llcov
>>> +RUN: rm test.cpp.llcov
>>>
>>> RUN: not llvm-cov -gcno=test_read_fail.gcno -gcda=test.gcda
>>>
>>>
>>> Modified: llvm/trunk/tools/llvm-cov/llvm-cov.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/llvm-cov.cpp?rev=196184&r1=196183&r2=196184&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/tools/llvm-cov/llvm-cov.cpp (original)
>>> +++ llvm/trunk/tools/llvm-cov/llvm-cov.cpp Mon Dec 2 18:57:11 2013
>>> @@ -17,7 +17,6 @@
>>> #include "llvm/Support/ManagedStatic.h"
>>> #include "llvm/Support/MemoryObject.h"
>>> #include "llvm/Support/PrettyStackTrace.h"
>>> -#include "llvm/Support/raw_ostream.h"
>>> #include "llvm/Support/Signals.h"
>>> #include "llvm/Support/system_error.h"
>>> using namespace llvm;
>>> @@ -31,10 +30,6 @@ InputGCNO("gcno", cl::desc("<input gcno
>>> static cl::opt<std::string>
>>> InputGCDA("gcda", cl::desc("<input gcda file>"), cl::init(""));
>>>
>>> -static cl::opt<std::string>
>>> -OutputFile("o", cl::desc("<output llvm-cov file>"), cl::init("-"));
>>> -
>>> -
>>> //===----------------------------------------------------------------------===//
>>> int main(int argc, char **argv) {
>>> // Print a stack trace if we signal out.
>>> @@ -44,11 +39,6 @@ int main(int argc, char **argv) {
>>>
>>> cl::ParseCommandLineOptions(argc, argv, "llvm coverage tool\n");
>>>
>>> - std::string ErrorInfo;
>>> - raw_fd_ostream OS(OutputFile.c_str(), ErrorInfo);
>>> - if (!ErrorInfo.empty())
>>> - errs() << ErrorInfo << "\n";
>>> -
>>> GCOVFile GF;
>>> if (InputGCNO.empty())
>>> errs() << " " << argv[0] << ": No gcov input file!\n";
>>> @@ -83,6 +73,6 @@ int main(int argc, char **argv) {
>>>
>>> FileInfo FI;
>>> GF.collectLineCounts(FI);
>>> - FI.print(OS, InputGCNO, InputGCDA);
>>> + FI.print(InputGCNO, InputGCDA);
>>> return 0;
>>> }
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits 		 	   		  



More information about the llvm-commits mailing list