From 061d496c511b02a0c2bd394539c757c5ad4511e3 Mon Sep 17 00:00:00 2001 From: Igor Kudrin Date: Fri, 15 Apr 2016 14:56:50 +0000 Subject: [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). Differential Revision: http://reviews.llvm.org/D18787 llvm-svn: 266436 --- .../Inputs/prevent_false_instantiations.covmapping | Bin 0 -> 318 bytes .../Inputs/prevent_false_instantiations.cpp | 15 ++++++++++++ .../Inputs/prevent_false_instantiations.proftext | 26 +++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmapping create mode 100644 llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.cpp create mode 100644 llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.proftext (limited to 'llvm/test/tools/llvm-cov/Inputs') diff --git a/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmapping b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmapping new file mode 100644 index 00000000000..c255aa3272f Binary files /dev/null and b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmapping differ 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 + -- cgit v1.2.3