<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - scan-build: c-cpp-output is incorrect language for compiling pre-processed C (ccache)"
   href="https://llvm.org/bugs/show_bug.cgi?id=25851">25851</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>scan-build: c-cpp-output is incorrect language for compiling pre-processed C (ccache)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>d.rigby@me.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When attempting to run scan-build on Linux against a C codebase where ccache is
being used, clang fails with the following error:

    could not find clang line

I've dug into this a bit, and the issue appears to be triggered the fact that
ccache splits the compilation into separate prepress (.c -> .i) followed by
compile (i. -> .o) steps, and ccc-analyzer fails to use the correct language
when compiling a .i file. 

See the below test case (along with an annotated ccc-anlayzer) which prints the
arguments passed to clang (['Exec'] and '[Line]' prefixed output):

$ echo "int main() {return 0;}" > foo.i
$ scan-build-3.6 --use-cc=clang-3.6 --use-c++=clang++-3.6 -v gcc -c foo.i -o
foo.o
scan-build: Using '/usr/lib/llvm-3.6/bin/clang' for static analysis
scan-build: Emitting reports for this run to
'/tmp/scan-build-2015-12-16-121345-16395-1'.
[Exec] /usr/lib/llvm-3.6/bin/clang -fsyntax-only -x c-cpp-output foo.i at
/usr/share/clang/scan-build-3.6/ccc-analyzer line 161.
[Line] Ubuntu clang version 3.6.0-2ubuntu1~trusty1 (tags/RELEASE_360/final)
(based on LLVM 3.6.0)
[Line] Target: x86_64-pc-linux-gnu
[Line] Thread model: posix
[Line] clang: error: language not recognized: 'c-cpp-output'
[Line] clang: warning: foo.i: 'linker' input unused
could not find clang line
scan-build: Removing directory '/tmp/scan-build-2015-12-16-121345-16395-1'
because it contains no reports.
scan-build: No bugs found.

Specifically note:

   [Line] clang: error: language not recognized: 'c-cpp-output'

The bug appears to be that ccc-analyzer incorrectly uses 'c-cpp-output' for the
name of C-proprocessed source. It should be 'cpp-output'</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>