summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/CodeCoverage.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Reapply "[llvm-cov] Add an -output-dir option for the show sub-command""Vedant Kumar2016-06-281-5/+34
| | | | | | | | | | | | | | | Passing -output-dir path/to/dir to llvm-cov show creates path/to/dir if it doesn't already exist, and prints reports into that directory. In function view mode, all views are written into path/to/dir/functions.$EXTENSION. In file view mode, all views are written into path/to/dir/coverage/$PATH.$EXTENSION. Changes since the initial commit: - Avoid accidentally closing stdout twice. llvm-svn: 273985
* Revert "[llvm-cov] Add an -output-dir option for the show sub-command"Vedant Kumar2016-06-281-34/+5
| | | | | | | This reverts commit r273971. test/profile/instrprof-visibility.cpp is failing because of an uncaught error in SafelyCloseFileDescriptor. llvm-svn: 273978
* [llvm-cov] Add an -output-dir option for the show sub-commandVedant Kumar2016-06-281-5/+34
| | | | | | | | | | | Passing -output-dir path/to/dir to llvm-cov show creates path/to/dir if it doesn't already exist, and prints reports into that directory. In function view mode, all views are written into path/to/dir/functions.$EXTENSION. In file view mode, all views are written into path/to/dir/coverage/$PATH.$EXTENSION. llvm-svn: 273971
* [llvm-cov] clang-format a line, NFCVedant Kumar2016-06-281-1/+2
| | | | llvm-svn: 273969
* [llvm-cov] Add a format option for the 'show' sub-command (mostly NFC)Vedant Kumar2016-06-281-0/+8
| | | | llvm-svn: 273968
* [llvm-cov] Separate presentation logic from formatting logic, NFCVedant Kumar2016-06-251-16/+12
| | | | | | | | | | This makes it easier to add renderers for new kinds of output formats. - Define and document a pure-virtual coverage rendering interface. - Move the text-based rendering logic into its a new file. - Re-work the API to better reflect the presentation/formatting split. llvm-svn: 273767
* [llvm-cov] Fix two warningsVedant Kumar2016-06-241-5/+5
| | | | | | | | | They were using output streams inconsistently. One also had a grammar bug. I noticed these while trying to pare down D18278. llvm-svn: 273642
* [llvm-cov] Add SourceNames to SourceCoverageViews, NFCVedant Kumar2016-06-241-11/+10
| | | | | | | | | | | | | A SourceName can be a file or a function. It makes sense to attach this information to a SourceCoverageView, seeing as views (1) already point to the text corresponding to the relevant source code and (2) are already used to render that text along with the SourceNames. This is a nice cleanup which is independent of the upcoming html patch. While we're at it, document the fields in SourceCoverageView. llvm-svn: 273634
* Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith2016-06-091-8/+0
| | | | | | | looking for it along $PATH. This allows installs of LLVM tools outside of $PATH to find the symbolizer and produce pretty backtraces if they crash. llvm-svn: 272232
* Apply most suggestions of clang-tidy's performance-unnecessary-value-paramBenjamin Kramer2016-06-081-1/+1
| | | | | | | Avoids unnecessary copies. All changes audited & pass tests with asan. No functional change intended. llvm-svn: 272190
* Retry^3 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-191-3/+2
| | | | | | | | | | | | | | | Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. - Remove the base ProfError class to work around an MSVC ICE. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 270020
* Revert "Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""Vedant Kumar2016-05-161-2/+3
| | | | | | | | This reverts commit r269694. MSVC says: error C2086: 'char llvm::ProfErrorInfoBase<enum llvm::instrprof_error>::ID' : redefinition llvm-svn: 269700
* Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-161-3/+2
| | | | | | | | | | | | | | | Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Address undefined-var-template warning. - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269694
* Revert "Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""Chandler Carruth2016-05-141-2/+3
| | | | | | | This reverts commit r269491. It triggers warnings with Clang, breaking builds for -Werror users including several build bots. llvm-svn: 269547
* Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-131-3/+2
| | | | | | | | | | | | | | Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269491
* Revert "(HEAD -> master, origin/master, origin/HEAD) [ProfileData] (llvm) ↵Vedant Kumar2016-05-131-2/+3
| | | | | | | | Use Error in InstrProf and Coverage, NFC" This reverts commit r269462. It fails two llvm-profdata tests. llvm-svn: 269466
* [ProfileData] (llvm) Use Error in InstrProf and Coverage, NFCVedant Kumar2016-05-131-3/+2
| | | | | | | | | Transition InstrProf and Coverage over to the stricter Error/Expected interface. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269462
* Move coverage related code into a separate library.Easwaran Raman2016-04-291-2/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D19333 llvm-svn: 268089
* [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
* 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
* 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: 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
* llvm-cov: Actually use the command line arguments when reportingJustin Bogner2015-02-141-9/+8
| | | | | | | | 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-141-4/+1
| | | | | | | | | | | | | | 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
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-141-7/+7
| | | | | | | | | | | 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-171-1/+0
| | | | llvm-svn: 224413
* llvm-cov: Sink some reporting logic into CoverageMappingJustin Bogner2014-11-141-1/+1
| | | | | | | | 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
* llvm-cov: Follow LLVM naming conventionsJustin Bogner2014-10-301-2/+2
| | | | | | 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: 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-201-273/+96
| | | | | | | | | | 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: 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
* llvm-cov: Push some more debug output into the View (NFC)Justin Bogner2014-09-171-24/+0
| | | | llvm-svn: 217984
* llvm-cov: Rework the API for getting the coverage of a file (NFC)Justin Bogner2014-09-171-12/+12
| | | | | | | | | | | | 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
* llvm-cov: Distinguish expansion/instantiation from SourceCoverageViewJustin Bogner2014-09-171-6/+14
| | | | | | | | | | | | | 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: Make debug output more consistentJustin Bogner2014-09-151-4/+4
| | | | | | | | This changes the debug output of the llvm-cov tool to consistently write to stderr, and moves the highlighting output closer to where it's relevant. llvm-svn: 217838
* llvm-cov: Clean up some redundancy in the view API (NFC)Justin Bogner2014-09-151-11/+4
| | | | | | | This removes the need to pass a starting and ending line when creating a SourceCoverageView, since these are easy to determine. llvm-svn: 217746
* llvm-cov: Move FunctionCoverageMapping into CoverageMapping.h (NFC)Justin Bogner2014-09-121-1/+0
| | | | llvm-svn: 217657
* Revert "llvm-cov: Remove an overly system specific test"Justin Bogner2014-09-111-1/+1
| | | | | | | | | | This fixes a call to sys::fs::equivalent that should've been to CodeCoverageTool::equivalentFiles, which lets us restore the test of r217476 that was removed in r217478. This reverts r217478, but the test works this time. llvm-svn: 217646
* llvm-cov: Combine two types that were nearly identical (NFC)Justin Bogner2014-09-091-1/+2
| | | | | | | | | llvm-cov had a SourceRange type that was nearly identical to a CountedRegion except that it shaved off a couple of fields. There aren't likely to be enough of these for the minor memory savings to be worth the extra complexity here. llvm-svn: 217417
* llvm-cov: Rename MappingRegion to coverage::CountedRegion (NFC)Justin Bogner2014-09-091-30/+30
| | | | | | | This name was too similar to CoverageMappingRegion, and the type really belongs in the coverage library anyway. llvm-svn: 217416
* llvm-cov: Use ErrorOr rather than an error_code* (NFC)Justin Bogner2014-09-081-4/+4
| | | | llvm-svn: 217404
OpenPOWER on IntegriCloud