summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov
Commit message (Collapse)AuthorAgeFilesLines
* Move coverage related code into a separate library.Easwaran Raman2016-04-296-7/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D19333 llvm-svn: 268089
* [llvm-cov] Don't emit 'nan%' in reportsVedant Kumar2016-04-291-0/+6
| | | | llvm-svn: 267971
* Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump ↵Kevin Enderby2016-04-061-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to produce a real error message Produce the first specific error message for a malformed Mach-O file describing the problem instead of the generic message for object_error::parse_failed of "Invalid data was encountered while parsing the file”.  Many more good error messages will follow after this first one. This is built on Lang Hames’ great work of adding the ’Error' class for structured error handling and threading Error through MachOObjectFile construction. And making createMachOObjectFile return Expected<...> . So to to get the error to the llvm-obdump tool, I changed the stack of these methods to also return Expected<...> : object::ObjectFile::createObjectFile() object::SymbolicFile::createSymbolicFile() object::createBinary() Then finally in ParseInputMachO() in MachODump.cpp the error can be reported and the specific error message can be printed in llvm-objdump and can be seen in the existing test case for the existing malformed binary but with the updated error message. Converting these interfaces to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now use of errorToErrorCode() and errorOrToExpected() are used where the callers are yet to be converted. Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values. So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: “// TODO: Actually report errors helpfully” and a call something like consumeError(ObjOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. Note there is one fix also needed to lld/COFF/InputFiles.cpp that goes along with this that I will commit right after this. So expect lld not to built after this commit and before the next one. llvm-svn: 265606
* Remove autoconf supportChris Bieneman2016-01-261-17/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* [llvm-cov] Adjust column widths for function and file reportsVedant Kumar2015-10-211-9/+13
| | | | | | | | Previously, we only expanded function and filename column widths when rendering file reports. This commit makes the change for function reports as well. llvm-svn: 250900
* Rename one of our two llvm::GCOVOptions classes to llvm::GCOV::Options. We usedRichard Smith2015-10-141-3/+3
| | | | | | | 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. llvm-svn: 250258
* [llvm-cov] Disable name and path truncationVedant Kumar2015-09-142-6/+22
| | | | | | | | | | | Change the output of llvm-cov s.t it does not truncate function names and file paths when printing coverage reports. Differential Revision: http://reviews.llvm.org/D12647 rdar://22531141 llvm-svn: 247635
* [Object] Search for architecures by name in ↵Frederic Riss2015-06-221-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | MachOUniversalBinary::getObjectForArch() The reason we need to search by name rather than by Triple::ArchType is to handle subarchitecture correclty. There is no different ArchType for the x86_64h architecture (it identifies itself as x86_64), or for the various ARM subarches. The only way to get to the subarch slice in an universal binary is to search by name. This issue led to hard to debug and transient symbolication failures in Asan tests (it mostly works, because the files are very similar). This also affects the Profiling infrastucture as it is the other user of that API. Reviewers: samsonov, bogner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10604 llvm-svn: 240339
* llvm-cov: Make llvm-cov --version DTRTJustin Bogner2015-06-031-0/+8
| | | | | | | | In r233132 we started requiring a subcommand in llvm-cov, but this made `llvm-cov --version` invalid, which is kind of silly. Print version information in this case, as most people would expect. llvm-svn: 238897
* Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer2015-05-291-2/+1
| | | | | | | | | | | | | | | | | | | | If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238602
* InstrProf: Fix display of large numbers in llvm-covJustin Bogner2015-05-131-21/+25
| | | | | | | | llvm-cov was truncating numbers that were larger than a particular fixed width, which is as confusing as it is useless. Instead, we use engineering notation with SI prefix for magnitude. llvm-svn: 237307
* llvm-cov: Warn if object file is newer than profileJustin Bogner2015-05-041-0/+13
| | | | | | | Looking at coverage with an out of date profile can be confusing. Provide a little hint that something might be wrong. llvm-svn: 236408
* llvm-cov: Require a subcommand when invoked as llvm-covJustin Bogner2015-03-241-16/+16
| | | | | | | | | | | | | | A while ago llvm-cov gained support for clang's instrumentation based profiling in addition to its gcov support, and subcommands were added to choose which behaviour to use. When no subcommand was specified, we fell back to gcov compatibility with a warning that a subcommand would be required in the future. Now, we require the subcommand. Note that if the basename of llvm-cov is gcov (via symlink or hardlink, for example), we still use the gcov compatible behaviour with no subcommand required. llvm-svn: 233132
* llvm-cov: Rename -color={always|never} to -use-color[=0]Justin Bogner2015-03-191-14/+6
| | | | | | | | | | | | | This is an ugly hack to fix the configure --enable-shared build. It turns out that *every cl::opt in LLVM* shows up in *every tool* in that configuration, which is hopelessly broken. This skirts around the issue by not colliding with another option's name, for now. I've also simplified the option implementation - the other "color" option used cl::boolOrDefault and was much nicer than what I'd written before. llvm-svn: 232704
* llvm-cov: Continue trying to appease a botJustin Bogner2015-03-191-1/+4
| | | | | | | | | | | This bot doesn't like me. I don't know why: http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/24425 Move the color option enum's definition out of the function that creates the cl::opt. llvm-svn: 232700
* llvm-cov: Try to appease a botJustin Bogner2015-03-191-2/+2
| | | | | | | | | | | | | | The clang-hexagon elf bot was complaining that "Option 'color' registered more than once!": http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/24425 I don't understand why this error is happening, and I don't see it on any other bots or on my own machine, so I'm kind of grasping at straws. Try using an unscoped enum and specifying a cl::init to see if they help. llvm-svn: 232698
* llvm-cov: Only emit colour by default if the output is a ttyJustin Bogner2015-03-191-10/+14
| | | | | | | This replaces the -no-color flag with a -color={auto|always|never} option, with auto as the default, which is much saner. llvm-svn: 232693
* InstrProf: Teach llvm-cov to handle universal binaries when given -archJustin Bogner2015-03-111-1/+17
| | | | llvm-svn: 231902
* Make helper functions static.Benjamin Kramer2015-03-092-4/+5
| | | | | | Found by -Wmissing-prototypes. NFC. llvm-svn: 231664
* InstrProf: Teach llvm-cov to show the max count instead of the lastJustin Bogner2015-02-231-4/+3
| | | | | | | | | | | | When multiple regions start on the same line, llvm-cov was just showing the count of the last one as the line count. This can be confusing and misleading for things like one-liner loops, where the count at the end isn't very interesting, or even "if" statements with an opening brace at the end of the line. Instead, use the maximum of all of the region start counts. llvm-svn: 230263
* Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for ↵Aaron Ballman2015-02-151-1/+1
| | | | | | requiring the macro. NFC; LLVM edition. llvm-svn: 229340
* llvm-cov: Actually use the command line arguments when reportingJustin Bogner2015-02-143-12/+12
| | | | | | | | This code didn't really make sense as is. If a filename is passed in, the user obviously wants the coverage *for that file*, not *for everything*. llvm-svn: 229217
* llvm-cov: Simplify coverage reports, fixing PR22575 in the processJustin Bogner2015-02-148-170/+69
| | | | | | | | | | | | | | PR22575 occurred because we were unsafely storing references into a std::vector. If the vector moved because it grew, we'd be left iterating through garbage memory. This avoids the issue by simplifying the logic to gather coverage information as we go, rather than storing it and iterating over it. I'm relying on the existing tests showing that this is semantically NFC, since it's difficult to hit the issue this fixes without relatively large covered programs. llvm-svn: 229215
* InstrProf: Remove an unused header (NFC)Justin Bogner2015-02-021-1/+0
| | | | llvm-svn: 227881
* llvm-cov: Don't use llvm::outs() in library codeJustin Bogner2015-01-231-1/+1
| | | | | | | Nothing in lib/ should be using llvm::outs() directly. Thread it in from the caller instead. llvm-svn: 226961
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-146-15/+15
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* Remove unused includes and out of date comment. NFC.Rafael Espindola2014-12-173-3/+0
| | | | llvm-svn: 224413
* llvm-cov: Sink some reporting logic into CoverageMappingJustin Bogner2014-11-143-39/+11
| | | | | | | | This teaches CoverageMapping::getCoveredFunctions to filter to a particular file and uses that to replace most of the logic found in llvm-cov report. llvm-svn: 221962
* [Object] Modify OwningBinary's interface to separate inspection from ownership.Lang Hames2014-10-311-1/+1
| | | | | | | | The getBinary and getBuffer method now return ordinary pointers of appropriate const-ness. Ownership is transferred by calling takeBinary(), which returns a pair of the Binary and a MemoryBuffer. llvm-svn: 221003
* llvm-cov: Follow LLVM naming conventionsJustin Bogner2014-10-304-22/+21
| | | | | | This renames a few things that are using an unusual naming convention. llvm-svn: 220929
* llvm-cov: Don't manually parse an option for no reasonJustin Bogner2014-10-301-18/+5
| | | | | | | | We're using cl::opt here, but for some reason we're reading out one particular option by hand instead. This makes -help and the like behave rather poorly, so let's not do it this way. llvm-svn: 220928
* llvm-cov: Very basic top level helpJustin Bogner2014-10-301-11/+17
| | | | llvm-svn: 220926
* Remove bogus std::error_code returns form SectionRef.Rafael Espindola2014-10-081-2/+1
| | | | | | | | | | | | | | There are two methods in SectionRef that can fail: * getName: The index into the string table can be invalid. * getContents: The section might point to invalid contents. Every other method will always succeed and returning and std::error_code just complicates the code. For example, a section can have an invalid alignment, but if we are able to get to the section structure at all and create a SectionRef, we will always be able to read that invalid alignment. llvm-svn: 219314
* llvm-cov/CoverageReport.cpp: Quick fix for msvcrt, since width specifier "z" ↵NAKAMURA Takumi2014-10-011-12/+12
| | | | | | | | is unavailable. Note, mingw uses its own printf instead of msvcrt. llvm-svn: 218723
* llvm-cov: Use the number of executed functions for the function coverage metric.Alex Lorenz2014-09-304-21/+24
| | | | | | | | This commit fixes llvm-cov's function coverage metric by using the number of executed functions instead of the number of fully covered functions. Differential Revision: http://reviews.llvm.org/D5196 llvm-svn: 218672
* llvm-cov: Allow creating CoverageMappings from filenamesJustin Bogner2014-09-201-18/+1
| | | | llvm-svn: 218185
* llvm-cov: Disentangle the coverage data logic from the display (NFC)Justin Bogner2014-09-2012-477/+137
| | | | | | | | | | This splits the logic for actually looking up coverage information from the logic that displays it. These were tangled rather thoroughly so this change is a bit large, but it mostly consists of moving things around. The coverage lookup logic itself now lives in the library, rather than being spread between the library and the tool. llvm-svn: 218184
* llvm-cov: Move some reader debug output out of the tool.Justin Bogner2014-09-201-11/+0
| | | | | | | This debug output is really for testing CoverageMappingReader, not the llvm-cov tool. Move it to where it can be more useful. llvm-svn: 218183
* llvm-cov: Return unique_ptrs instead of filling objects (NFC)Justin Bogner2014-09-191-53/+62
| | | | | | | Having create* functions return the object they create is more readable than using an in-out parameter. llvm-svn: 218139
* llvm-cov: Fix dropped lines when filters were appliedJustin Bogner2014-09-191-1/+2
| | | | | | | Uncovered lines in the middle of a covered region weren't being shown when filtering to a particular function. llvm-svn: 218109
* llvm-cov: Generalize -filename-equivalenceJustin Bogner2014-09-191-29/+51
| | | | | | | | | | | | | | The filename-equivalence flag allows you to show coverage when your source files don't have the same full paths as those that generated the data. This is mostly useful for writing tests in a cross-platform way. This wasn't triggering in cases where the filename was derived directly from the coverage data, which meant certain types of test case were impossible to write. This patch fixes that, and following patches involve tests that need this. llvm-svn: 218108
* llvm-cov: Simplify FunctionInstantiationSetCollector (NFC)Justin Bogner2014-09-181-28/+15
| | | | | | | | | - Replace std::unordered_map with DenseMap - Use std::pair instead of manually combining two unsigneds - Assert if insert is called with invalid arguments - Avoid an unnecessary copy of a std::vector llvm-svn: 218074
* Alternative (to r216344) fix of gcc -Wpedantic.Patrik Hagglund2014-09-181-1/+1
| | | | | | | | | | | | | | As suggested by David Blaikie, this may be easier to read. The original warning was: ../tools/llvm-cov/llvm-cov.cpp:53:49: error: ISO C++ forbids zero-size array 'argv' [-Werror=pedantic] std::string Invocation(std::string(argv[0]) + " " + argv[1]); It seems to be the case that GCC's warning gets confused and thinks 'argv' is a declaration here. GCC bugzilla issue #61259. llvm-svn: 218048
* llvm-cov: Push some more debug output into the View (NFC)Justin Bogner2014-09-172-24/+4
| | | | llvm-svn: 217984
* llvm-cov: Rework the API for getting the coverage of a file (NFC)Justin Bogner2014-09-176-362/+231
| | | | | | | | | | | | This encapsulates how we handle the coverage regions of a file or function. In the old model, the user had to deal with nested regions, so they needed to maintain their own auxiliary data structures to get any useful information out of this. The new API provides a sequence of non-overlapping coverage segments, which makes it possible to render coverage information in a single pass and avoids a fair amount of extra work. llvm-svn: 217975
* LineIterator: Provide a variant that keeps blank linesJustin Bogner2014-09-171-8/+4
| | | | | | | | It isn't always useful to skip blank lines, as evidenced by the somewhat awkward use of line_iterator in llvm-cov. This adds a knob to control whether or not to skip blanks. llvm-svn: 217960
* llvm-cov: Fix a typoJustin Bogner2014-09-171-1/+1
| | | | | | | It doesn't make sense for this default parameter to be false, since false makes the function a no-op. llvm-svn: 217945
* Add move constructors/assignment to make MSVC happy after r217940Justin Bogner2014-09-171-0/+16
| | | | llvm-svn: 217941
* llvm-cov: Distinguish expansion/instantiation from SourceCoverageViewJustin Bogner2014-09-173-113/+108
| | | | | | | | | | | | | SourceCoverageView currently has "Kind" and a list of child views, all of which must have either an expansion or an instantiation Kind. In addition to being an error-prone design, this makes it awkward to differentiate between the two child types and adds a number of optionally used members to the type. Split the subview types into their own separate objects, and maintain lists of each rather than one combined "Children" list. llvm-svn: 217940
* llvm-cov: Rename a variable and clean up its usageJustin Bogner2014-09-162-20/+19
| | | | | | | Offset is a terrible name for an indentation / nesting level, and it confuses me every time I look at this code. llvm-svn: 217861
OpenPOWER on IntegriCloud