diff options
author | Igor Kudrin <ikudrin.dev@gmail.com> | 2016-04-18 15:36:30 +0000 |
---|---|---|
committer | Igor Kudrin <ikudrin.dev@gmail.com> | 2016-04-18 15:36:30 +0000 |
commit | 1c14dc4c5a3b0f17672a121f026e96a15f93dd4a (patch) | |
tree | 61fbe534ca14cbd136c9af0006f6f381858f5344 /llvm/test | |
parent | d09f15ea6f17e51ec2ec59b8c3b0e5ba52dd8358 (diff) | |
download | bcm5719-llvm-1c14dc4c5a3b0f17672a121f026e96a15f93dd4a.tar.gz bcm5719-llvm-1c14dc4c5a3b0f17672a121f026e96a15f93dd4a.zip |
Reapply "[Coverage] Prevent detection of false instantiations in case of macro expansion."
The root of the problem was that findMainViewFileID(File, Function)
could return some ID for any given file, even though that file
was not the main file for that function.
This patch ensures that the result of this function is conformed
with the result of findMainViewFileID(Function).
This commit reapplies r266436, which was reverted by r266458,
with the .covmapping file serialized in v1 format.
Differential Revision: http://reviews.llvm.org/D18787
llvm-svn: 266620
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmapping | bin | 0 -> 331 bytes | |||
-rw-r--r-- | llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.cpp | 15 | ||||
-rw-r--r-- | llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.proftext | 26 | ||||
-rw-r--r-- | llvm/test/tools/llvm-cov/lit.local.cfg | 2 | ||||
-rw-r--r-- | llvm/test/tools/llvm-cov/prevent_false_instantiations.h | 10 |
5 files changed, 52 insertions, 1 deletions
diff --git a/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmapping b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmapping Binary files differnew file mode 100644 index 00000000000..cfa4e295d36 --- /dev/null +++ b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmapping diff --git a/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.cpp b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.cpp new file mode 100644 index 00000000000..2a84f1dd58e --- /dev/null +++ b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.cpp @@ -0,0 +1,15 @@ +#include "prevent_false_instantiations.h" + +void func1() { + DO_SOMETHING(); +} + +void func2() { + DO_SOMETHING(); +} + +int main() { + func1(); + func2(); + return 0; +} diff --git a/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.proftext b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.proftext new file mode 100644 index 00000000000..ad5362e17e4 --- /dev/null +++ b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.proftext @@ -0,0 +1,26 @@ +_Z5func1v +# Func Hash: +3 +# Num Counters: +2 +# Counter Values: +1 +0 + +_Z5func2v +# Func Hash: +3 +# Num Counters: +2 +# Counter Values: +1 +0 + +main +# Func Hash: +0 +# Num Counters: +1 +# Counter Values: +1 + diff --git a/llvm/test/tools/llvm-cov/lit.local.cfg b/llvm/test/tools/llvm-cov/lit.local.cfg index 05aef8645e4..8b6fe62772f 100644 --- a/llvm/test/tools/llvm-cov/lit.local.cfg +++ b/llvm/test/tools/llvm-cov/lit.local.cfg @@ -1 +1 @@ -config.suffixes = ['.test', '.m', '.cpp', '.c'] +config.suffixes = ['.test', '.m', '.cpp', '.c', '.h'] diff --git a/llvm/test/tools/llvm-cov/prevent_false_instantiations.h b/llvm/test/tools/llvm-cov/prevent_false_instantiations.h new file mode 100644 index 00000000000..667ebde6d16 --- /dev/null +++ b/llvm/test/tools/llvm-cov/prevent_false_instantiations.h @@ -0,0 +1,10 @@ +// Checks that function instantiations don't go to a wrong file. + +// CHECK-NOT: {{_Z5func[1,2]v}} + +// RUN: llvm-profdata merge %S/Inputs/prevent_false_instantiations.proftext -o %t.profdata +// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s + +#define DO_SOMETHING() \ + do { \ + } while (0) |