Skip to content

Commit

Permalink
[analyze] Fix ccache compiler detection
Browse files Browse the repository at this point in the history
When we try to find compiler binaries from the `PATH` we will resolve the
symlinks by using `os.path.realpath` function. If the compiler
(`g++/gcc/clang`) is a symlink to `ccache` it will think that the compiler
is ccache. When we try to get for example the version of the detected
analyze it will return the version for the ccache binary and not for
the original compiler.
For this reason if the detected compiler binary is `ccache` we will use
the original compiler path instead of resolving the symlink.
  • Loading branch information
csordasmarton committed Feb 22, 2021
1 parent 4a1fcdf commit a3c7851
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions analyzer/codechecker_analyzer/analyzer_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@ def __populate_analyzers(self):

self.__analyzers[name] = os.path.realpath(compiler_binary)

# If the compiler binary is a simlink to ccache, use the
# original compiler binary.
if self.__analyzers[name].endswith("/ccache"):
self.__analyzers[name] = compiler_binary

def __populate_replacer(self):
""" Set clang-apply-replacements tool. """
replacer_binary = self.pckg_layout.get('clang-apply-replacements')
Expand Down

0 comments on commit a3c7851

Please sign in to comment.