[llvm] r258376 - [Coverage] Add a test case for comdat
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 20 16:57:45 PST 2016
Author: davidxl
Date: Wed Jan 20 18:57:42 2016
New Revision: 258376
URL: http://llvm.org/viewvc/llvm-project?rev=258376&view=rev
Log:
[Coverage] Add a test case for comdat
The binary contains two (merged) covmap sections which
have duplicate CovMapRecords from comdat (template instantation).
This test makes sure the reader reads it properly. It also
tests that the coverage data from different instantiations
of the same template function are properly merged in show
output.
Added:
llvm/trunk/test/tools/llvm-cov/Inputs/elf_binary_comdat (with props)
llvm/trunk/test/tools/llvm-cov/Inputs/elf_binary_comdat.profdata (with props)
llvm/trunk/test/tools/llvm-cov/Inputs/instrprof-comdat.h
llvm/trunk/test/tools/llvm-cov/cov-comdat.test
Added: llvm/trunk/test/tools/llvm-cov/Inputs/elf_binary_comdat
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/elf_binary_comdat?rev=258376&view=auto
==============================================================================
Binary file - no diff available.
Propchange: llvm/trunk/test/tools/llvm-cov/Inputs/elf_binary_comdat
------------------------------------------------------------------------------
svn:executable = *
Propchange: llvm/trunk/test/tools/llvm-cov/Inputs/elf_binary_comdat
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: llvm/trunk/test/tools/llvm-cov/Inputs/elf_binary_comdat.profdata
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/elf_binary_comdat.profdata?rev=258376&view=auto
==============================================================================
Binary file - no diff available.
Propchange: llvm/trunk/test/tools/llvm-cov/Inputs/elf_binary_comdat.profdata
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: llvm/trunk/test/tools/llvm-cov/Inputs/instrprof-comdat.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/instrprof-comdat.h?rev=258376&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/Inputs/instrprof-comdat.h (added)
+++ llvm/trunk/test/tools/llvm-cov/Inputs/instrprof-comdat.h Wed Jan 20 18:57:42 2016
@@ -0,0 +1,19 @@
+template <class T> class FOO {
+public:
+ FOO() : t(0) {}
+
+ T DoIt(T ti);
+
+private:
+ T t;
+};
+
+template <class T> T FOO<T>::DoIt(T ti) { // HEADER: 2| [[@LINE]]|template
+ for (T I = 0; I < ti; I++) { // HEADER: 22| [[@LINE]]| for (T
+ t += I; // HEADER: 20| [[@LINE]]| t += I;
+ if (I > ti / 2) // HEADER: 20| [[@LINE]]| if (I > ti
+ t -= 1; // HEADER: 8| [[@LINE]]| t -= 1;
+ } // HEADER: 10| [[@LINE]]| }
+ // HEADER: 1| [[@LINE]]|
+ return t; // HEADER: 1| [[@LINE]]| return t;
+}
Added: llvm/trunk/test/tools/llvm-cov/cov-comdat.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/cov-comdat.test?rev=258376&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/cov-comdat.test (added)
+++ llvm/trunk/test/tools/llvm-cov/cov-comdat.test Wed Jan 20 18:57:42 2016
@@ -0,0 +1,10 @@
+REQUIRES: shell
+
+# The binary contains two (merged) covmap sections which
+# have duplicate CovMapRecords from comdat (template instantation).
+# This test makes sure the reader reads it properly. It also
+# tests that the coverage data from different instantiations
+# of the same template function are properly merged in show
+# output.
+
+// RUN: llvm-cov show %S/Inputs/elf_binary_comdat -instr-profile %S/Inputs/elf_binary_comdat.profdata -filename-equivalence %S/Inputs/instrprof-comdat.h | FileCheck --check-prefix=HEADER %S/Inputs/instrprof-comdat.h
More information about the llvm-commits
mailing list