summaryrefslogtreecommitdiffstats
path: root/clang/test/CoverageMapping
Commit message (Collapse)AuthorAgeFilesLines
...
* [Coverage] Remove '..' from filenames *after* getting an absolute pathVedant Kumar2016-07-181-4/+15
| | | | | | | | Failure to do this breaks relative paths which begin with '..'. This issue was caught by the (still nascent) coverage bot. llvm-svn: 275924
* [Coverage] Normalize '..' out of filename stringsVedant Kumar2016-07-181-0/+7
| | | | | | | | This fixes the issue of having duplicate entries for the same file in a coverage report s.t none of the entries actually displayed the correct coverage information. llvm-svn: 275913
* [Coverage] Do not map regions from system headersVedant Kumar2016-07-111-2/+1
| | | | | | | | | | | | | | | Do not assign source regions located within system headers file ID's, and do not construct counter mapping regions out of them. This makes coverage reports less cluttered and less mysterious. E.g using the "assert" macro doesn't cause assert.h to appear in reports, and it no longer shows the "assertion failed" branch as an uncovered region. It also makes coverage mapping sections a bit smaller (e.g a 1% reduction in a stage2 build of bin/llvm-as). llvm-svn: 275121
* [Coverage] Push a new region when handling CXXTryStmtsVedant Kumar2016-06-222-1/+20
| | | | | | | | Push a new region for the try block and propagate execution counts through it. This ensures that catch statements get a region counter distinct from the try block's counter. llvm-svn: 273463
* Reapply [Coverage] Fix an assertion failure if the definition of an unused ↵Igor Kudrin2016-06-073-0/+39
| | | | | | | | | | | | | | | function spans multiple files. We have an assertion failure if, for example, the definition of an unused inline function starts in one macro and ends in another. This patch fixes the issue by finding the common ancestor of the start and end locations of that function's body and changing the locations accordingly. Thanks to NAKAMURA Takumi for helping with fixing the test failure on Windows. Differential Revision: http://reviews.llvm.org/D20997 llvm-svn: 271995
* Revert [Coverage] Fix an assertion failure if the definition of an unused ↵Igor Kudrin2016-06-073-39/+0
| | | | | | | | function spans multiple files. r271969 The test case fails on Windows. llvm-svn: 271976
* [Coverage] Fix an assertion failure if the definition of an unused function ↵Igor Kudrin2016-06-073-0/+39
| | | | | | | | | | | | | spans multiple files. We have an assertion failure if, for example, the definition of an unused inline function starts in one macro and ends in another. This patch fixes the issue by finding the common ancestor of the start and end locations of that function's body and changing the locations accordingly. Differential Revision: http://reviews.llvm.org/D20997 llvm-svn: 271969
* [Coverage] Fix crash on a switch partially covered by a macro (PR27948)Vedant Kumar2016-05-311-0/+8
| | | | | | | We have to handle file exits before and after visiting regions in the switch body. Fixes PR27948. llvm-svn: 271308
* [Lexer] Don't merge macro args from different macro filesVedant Kumar2016-05-192-0/+31
| | | | | | | | | | | | | | | | | | The lexer sets the end location of macro arguments incorrectly *if*, while merging consecutive args to fit into a single SLocEntry, it finds args which come from different macro files. Fix the issue by using separate SLocEntries in this situation. This fixes a code coverage crasher (rdar://problem/26181005). Because the lexer reported end locations for certain macro args incorrectly, we would generate bogus coverage mappings with negative line offsets. Reviewed-by: akyrtzi Differential Revision: http://reviews.llvm.org/D20401 llvm-svn: 270160
* [Coverage] Fix an issue where a coverage region might not be created for a ↵Igor Kudrin2016-05-041-0/+23
| | | | | | | | | | | macro containing a loop statement. The issue happened when a macro contained a full for or while statement, which body ended at the end of the macro. Differential Revision: http://reviews.llvm.org/D19725 llvm-svn: 268511
* [Coverage] Fix the start/end locations of switch statementsVedant Kumar2016-03-042-14/+24
| | | | | | | | | | | | While pushing switch statements onto the region stack we neglected to specify their start/end locations. This results in a crash (PR26825) if we end up in nested macro expansions without enough information to handle the relevant file exits. I added a test in switchmacro.c and fixed up a bunch of incorrect CHECK lines that specify strange end locations for switches. llvm-svn: 262697
* Restrengthen tests relaxed in r259955Xinliang David Li2016-02-172-1/+2
| | | | llvm-svn: 261046
* [Coverage] Fix crash when handling certain macro expansionsVedant Kumar2016-02-081-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When handling 'if' statements, we crash if the condition and the consequent branch are spanned by a single macro expansion. The crash occurs because of a sanity 'reset' in popRegions(): if an expansion exactly spans an entire region, we set MostRecentLocation to the start of the expansion (its 'include location'). This ensures we don't handleFileExit() ourselves out of the expansion before we're done processing all of the regions within it. This is tested in test/CoverageMapping/macro-expressions.c. This causes a problem when an expansion spans both the condition and the consequent branch of an 'if' statement. MostRecentLocation is updated to the start of the 'if' statement in popRegions(), so the file for the expansion isn't exited by the time we're done handling the statement. We then crash with 'fatal: File exit not handled before popRegions'. The fix for this is to detect these kinds of expansions, and conservatively update MostRecentLocation to the end of expansion region containing the conditional. I've added tests to make sure we don't have the same problem with other kinds of statements. rdar://problem/23630316 Differential Revision: http://reviews.llvm.org/D16934 llvm-svn: 260129
* [PGO] Test case updateXinliang David Li2016-02-052-4/+4
| | | | | | | | Temporarily relax check in test to avoid breakage for format change in LLVM side. Once that is done, the test case will be retightened. llvm-svn: 259955
* [PGO] cc1 option name change for profile instrumentationRong Xu2016-02-0442-42/+42
| | | | | | | | | | | | This patch changes cc1 option -fprofile-instr-generate to an enum option -fprofile-instrument={clang|none}. It also changes cc1 options -fprofile-instr-generate= to -fprofile-instrument-path=. The driver level option -fprofile-instr-generate and -fprofile-instr-generate= remain intact. This change will pave the way to integrate new PGO instrumentation in IR level. Review: http://reviews.llvm.org/D16730 llvm-svn: 259811
* [PGO] Cleanup: Use covmap header definition in the template fileXinliang David Li2016-01-031-1/+1
| | | | | | | | | | | | | | This is one last remaining instrumentatation related structure that needs to be migrate to use the centralized template definition. With this change, instrumentation code related to coverage module header will be kept in sync with the coverage mapping reader. The remaining code which makes implicit assumption about covmap control structure layout in the the lowering pass will cleaned up in a different patch. This patch is not intended to have no functional change. llvm-svn: 256714
* [PGO] make profile prefix even shorter and more readableXinliang David Li2015-12-152-5/+5
| | | | llvm-svn: 255587
* [PGO] Shorten profile symbol prefixesXinliang David Li2015-12-142-5/+5
| | | | | | | | | | (test case update) Profile symbols have long prefixes which waste space and creating pressure for linker. This patch shortens the prefixes to minimal length without losing verbosity. Differential Revision: http://reviews.llvm.org/D15503 llvm-svn: 255576
* [PGO] Stop using invalid char in instr variable names.Xinliang David Li2015-12-121-1/+1
| | | | | | | (This is part-2 of the patch of r255434 -- fixing test cases, second try) llvm-svn: 255435
* [PGO] Revert r255366: solution incomplete, not handling lambda yetXinliang David Li2015-12-111-1/+1
| | | | llvm-svn: 255368
* [PGO] Stop using invalid char in instr variable names.Xinliang David Li2015-12-111-1/+1
| | | | | | | | | | | | | | | | (This is part-2 of the patch -- fixing test cases) Before the patch, -fprofile-instr-generate compile will fail if no integrated-as is specified when the file contains any static functions (the -S output is also invalid). This patch fixed the issue. With the change, the index format version will be bumped up by 1. Backward compatibility is preserved with this change. Differential Revision: http://reviews.llvm.org/D15243 llvm-svn: 255366
* InstrProf: Fix a misuse of the FunctionDecl API when generating coverageJustin Bogner2015-07-281-0/+15
| | | | | | | | | | | This was calling FD->hasBody(), meaning "Does the function that this decl refers to have a body?", rather than FD->doesThisDeclarationHaveABody(), meaning "Is this decl a non-deleted definition?". We might want to consider renaming these APIs :/ llvm-svn: 243360
* InstrProf: Fix a typo in the test for r243066Justin Bogner2015-07-231-1/+1
| | | | llvm-svn: 243068
* InstrProf: Don't extend coverage regions into the catch keywordJustin Bogner2015-07-231-0/+24
| | | | | | | | The catch keyword isn't really part of a region, so it's fairly meaningless to extend into it. This was usually harmless, but it could crash when catch blocks involved macros in strange ways. llvm-svn: 243066
* InstrProf: Pack the coverage mapping structs that we write outJustin Bogner2015-07-021-1/+1
| | | | | | | When we read this data we treat it as unaligned and packed, so we should really be explicit about that when we write it. llvm-svn: 241218
* InstrProf: Fix a crash when an implicit def appears in a macroJustin Bogner2015-06-231-0/+16
| | | | llvm-svn: 240452
* InstrProf: Fix coverage mapping when "if" is a macroJustin Bogner2015-06-161-0/+14
| | | | | | | | | We were propagating the coverage map into the body of an if statement, but not into the condition thereafter. This is fine as long as the two locations are in the same virtual file, but they won't be when the "if" part of the statement is from a macro and the condition is not. llvm-svn: 239803
* InstrProf: Only disable coverage in built-in macros, not all system macrosJustin Bogner2015-05-141-0/+24
| | | | | | | | | The issue I was trying to solve in r236547 was about built-in macros, but I disabled coverage in all system macros. This is actually a bit of overkill, and makes the display of coverage around system macros degrade unnecessarily. Instead, limit this to builtins specifically. llvm-svn: 237397
* InstrProf: Don't start or end coverage regions inside of system macrosJustin Bogner2015-05-051-0/+12
| | | | | | | | | | | It doesn't make much sense to try to show coverage inside system macros, and source locations in builtins confuses the coverage mapping. Just avoid doing this. Fixes an assert that fired when a __block storage specifier starts a region. llvm-svn: 236547
* InstrProf: Fix a coverage crash where a macro begins in an unreachable blockJustin Bogner2015-05-011-0/+15
| | | | llvm-svn: 236335
* InstrProf: Make sure coverage propagates out of foreach loops correctlyJustin Bogner2015-04-301-4/+11
| | | | llvm-svn: 236264
* InstrProf: Mark code regions after throw expressions as unreachableJustin Bogner2015-04-281-6/+8
| | | | | | | We weren't setting regions as being unreachable after C++ throw expressions, leading to incorrect count propagations. llvm-svn: 235967
* InstrProf: Fix coverage maps for conditional operatorsJustin Bogner2015-04-241-1/+15
| | | | | | | | | This fixes a crash when we're emitting coverage and a macro appears between two binary conditional operators, ie, "foo ?: MACRO ?: bar", and fixes the interaction of macros and conditional operators in general. llvm-svn: 235793
* InstrProf: Fix a shadowing error that would break length of profile namesJustin Bogner2015-04-231-3/+3
| | | | | | | | We try to use the member variable "FuncName" here, but we've also used that name as a parameter. This ends with us getting the length of the function name wrong when we generate the coverage data. llvm-svn: 235565
* InstrProf: Handle whitespace and comments at the ends of macrosJustin Bogner2015-03-251-0/+11
| | | | | | | | | | | | | | | When we try to find the end loc for a token, we have to re-lex the token. This was running into a problem when we'd store the end loc of a macro's coverage region, since we wouldn't actually be at the beginning of a token when we tried to re-lex it, leading us to do silly things (and eventually assert) when whitespace or comments followed. This pushes our use of getPreciseTokenLocEnd earlier, so that we won't call it when it doesn't make sense to. It also removes an unnecessary adjustment by 1 that was working around this problem in some cases. llvm-svn: 233169
* Test case updates for explicit type parameter to the gep operatorDavid Blaikie2015-03-131-1/+1
| | | | llvm-svn: 232187
* InstrProf: Make sure counts in lambdas don't escape to the parent scopeJustin Bogner2015-02-241-0/+17
| | | | | | | | When generating coverage maps, we were traversing the body as if it were part of the parent function, but this doesn't make sense since we're currently counting lambdas as separate functions. llvm-svn: 230304
* InstrProf: Always emit a coverage region for the condition of an ifJustin Bogner2015-02-1915-41/+76
| | | | | | | | When tools like llvm-cov show regions, it's much easier to understand what's happening if the condition of an if shows a counter as well as the body. llvm-svn: 229813
* InstrProf: Rewrite most of coverage mapping generation in a simpler wayJustin Bogner2015-02-1825-145/+631
| | | | | | | | | | | | | | | | | | | | | | | The coverage mapping generation code previously generated a large number of redundant coverage regions and then tried to merge similar ones back together. This then relied on some awkward heuristics to prevent combining of regions that were importantly different but happened to have the same count. The end result was inefficient and hard to follow. Now, we more carefully create the regions we actually want. This makes it much easier to create regions at precise locations as well as making the basic approach quite a bit easier to follow. There's still a fair bit of complexity here dealing with included code and macro expansions, but that's pretty hard to avoid without significantly reducing the quality of data we provide. I had to modify quite a few tests where the source ranges became more precise or the old ranges seemed to be wrong anyways, and I've added quite a few new tests since a large number of constructs didn't seem to be tested before. llvm-svn: 229748
* InstrProf: Add a test for PR22531Justin Bogner2015-02-111-4/+11
| | | | | | | | This is a test for the llvm change in r228793. We need to make sure that names referred to by coverage end up in the right section, or the coverage tools won't work. llvm-svn: 228794
* InstrProf: Remove CoverageMapping::HasCodeBefore, it isn't usedJustin Bogner2015-02-0323-244/+243
| | | | llvm-svn: 228035
* InstrProf: Avoid creating profile names for symbols in system headersJustin Bogner2015-01-221-0/+21
| | | | | | | | | | We don't emit any coverage mapping for uncovered functions that come from system headers, but we were creating a GlobalVariable with each of their names. This is wasteful since the linker will need to dead strip the unused symbols, and it can lead to issues when merging coverage with others TUs that do have coverage for those functions. llvm-svn: 226764
* InstrProf: Don't emit coverage for uninstantiated templatesJustin Bogner2014-11-181-4/+24
| | | | | | | | | | | | | We include unused functions and methods in -fcoverage-mapping so that we can differentiate between uninstrumented and unused. This can cause problems for uninstantiated templates though, since they may involve an incomplete type that can't be mangled. This shows up in things like libc++'s <unordered_map> and makes coverage unusable. Avoid the issue by skipping uninstantiated methods of a templated class. llvm-svn: 222204
* InstrProf: Avoid repeated linear searches in a hot pathJustin Bogner2014-10-014-39/+43
| | | | | | | | | | | | | | | | | | | | | | When generating coverage regions, we were doing a linear search through the existing regions in order to try to merge related ones. Most of the time this would find what it was looking for in a small number of steps and it wasn't a big deal, but in cases with many regions and few mergeable ones this leads to an absurd compile time regression. This changes the coverage mapping logic to do a single sort and then merge as we go, which is a bit simpler and about 100 times faster. I've also added FIXMEs on a couple of behaviours that seem a little suspect, while keeping them behaving as they were - I'll look into these soon. The test changes here are mostly tedious reorganization, because the ordering of regions we output has become slightly (but not completely) more consistent from the almost completely arbitrary ordering we got before. llvm-svn: 218738
* Coverage Mapping: store function's hash in coverage function records.Alex Lorenz2014-08-211-1/+1
| | | | | | | | | | The profile data format was recently updated and the new indexing api requires the code coverage tool to know the function's hash as well as the function's name to get the execution counts for a function. Differential Revision: http://reviews.llvm.org/D4995 llvm-svn: 216208
* Test: CoverageMapping: use "RUN: FileCheck" command instead of "RUN: cat | ↵Alex Lorenz2014-08-203-9/+9
| | | | | | | | | | Filecheck". Change the lit RUN commands for 3 tests to use the following pattern "FileCheck -input-file ..." instead of "cat ... | FileCheck ..." as suggested by Justin Bogner. llvm-svn: 216085
* Coverage mapping: fix mapping for objective-c for statementAlex Lorenz2014-08-201-0/+18
| | | | llvm-svn: 216082
* Coverage mapping: fix mapping for objective-c message expressionAlex Lorenz2014-08-201-0/+11
| | | | llvm-svn: 216081
* Test: Coverage Mapping: add missing RUN commandsAlex Lorenz2014-08-192-10/+10
| | | | | | | Add the llvm-lit RUN commands for the two coverage mapping tests that filecheck a temporary file. llvm-svn: 216020
* Add tests for coverage mapping generation.Alex Lorenz2014-08-1926-0/+712
| | | | | | | | | | This patch adds the tests for the coverage mapping generation. Most of the tests check the mapping regions produced by the generator, and one checks the llvm IR. Differential Revision: http://reviews.llvm.org/D4847 llvm-svn: 215995
OpenPOWER on IntegriCloud