[llvm-bugs] [Bug 25851] New: scan-build: c-cpp-output is incorrect language for compiling pre-processed C (ccache)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 16 04:21:46 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25851

            Bug ID: 25851
           Summary: scan-build: c-cpp-output is incorrect language for
                    compiling pre-processed C (ccache)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: d.rigby at me.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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'

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151216/da9d3bc6/attachment.html>


More information about the llvm-bugs mailing list