<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - llvm-cov: unused methods of template classes are not shown as uncovered"
   href="https://bugs.llvm.org/show_bug.cgi?id=42110">42110</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-cov: unused methods of template classes are not shown as uncovered
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dennis.felsing@sap.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat x.cpp
template<typename T>
struct C
{
    C(T x)
    : v(x)
    {
    }

    void foo(T x)
    {
        v = x;
    }

    T v;
};

int main()
{
    C<int> c(5);
}

$ clang++ -fprofile-instr-generate -fcoverage-mapping x.cpp -o x
$ ./x
$ llvm-profdata merge -sparse default.profraw -o default.profdata 
$ llvm-cov show ./x -instr-profile=default.profdata
    1|       |template<typename T>
    2|       |struct C
    3|       |{
    4|       |    C(T x)
    5|       |    : v(x)
    6|      1|    {
    7|      1|    }
    8|       |
    9|       |    void foo(T x)
   10|       |    {
   11|       |        v = x;
   12|       |    }
   13|       |
   14|       |    T v;
   15|       |};
   16|       |
   17|       |int main()
   18|      1|{
   19|      1|    C<int> c(5);
   20|      1|}

I would expect foo to be considered uncovered, but since the method is inside
of a template class it is apparently not generated when it's also not used. If
the class is non-templated foo is shown correctly as being uncovered.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>