Repository: ericsson/codechecker
Issue: There is something wrong with default clang autodetection

**Describe the bug**
```bash
$ clang --version
clang version 10.0.0-+20191116100608+584704c725a-1~exp1~20191116211218.2875 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
$ whereis clang
clang: /usr/lib/clang /usr/local/bin/clang /usr/include/clang /usr/share/clang
$ ls -lah /usr/local/bin/clang
lrwxrwxrwx 1 root root 17 Jul 26 15:29 /usr/local/bin/clang -> /usr/bin/clang-10
```

By default, CTU does not work:
```bash
$ CodeChecker analyze --ctu build-Clang-SANITIZE/compile_commands.json -o clang-sa-reports --verbose debug
usage: CodeChecker [-h] {analyze} ...
CodeChecker: error: unrecognized arguments: --ctu
```

But after following https://github.com/Ericsson/codechecker#configuring-clang-version
and pointing those options at the `/usr/bin/clang-10`, it works.
Since `clang` is in the `$PATH`, i.e. it can be executed without specifying the path
said adjustment must not be necessary..

**CodeChecker version**
```bash
$ CodeChecker version
CodeChecker analyzer version:
---------------------------------------------------------------
Kind                 | Version                                 
---------------------------------------------------------------
Base package version | 6.11.0                                  
Package build date   | 2019-11-17T18:43                        
Git commit ID (hash) | 17d4645419142982d7789ecdc837eb3f1d0d9eaa
Git tag information  | 6.11                                    
---------------------------------------------------------------

CodeChecker web version:
------------------------------------------------------------------------
Kind                          | Version                                 
------------------------------------------------------------------------
Base package version          | 6.11.0                                  
Package build date            | 2019-11-17T18:43                        
Git commit ID (hash)          | 17d4645419142982d7789ecdc837eb3f1d0d9eaa
Git tag information           | 6.11                                    
Server supported API (Thrift) | 6.21                                    
Client API (Thrift)           | 6.21                                    
------------------------------------------------------------------------
```

**Desktop (please complete the following information)**
 - OS: Debian sid


Changed files:
analyzer/codechecker_analyzer/cmd/checkers.py, analyzer/codechecker_analyzer/analyzers/analyzer_types.py, analyzer/codechecker_analyzer/analyzer_context.py

diff --git a/analyzer/codechecker_analyzer/analyzer_context.py b/analyzer/codechecker_analyzer/analyzer_context.py
index 3c3f1bd9..7a5f2a3d 100644
--- a/analyzer/codechecker_analyzer/analyzer_context.py
+++ b/analyzer/codechecker_analyzer/analyzer_context.py
@@ -12,12 +12,15 @@ from __future__ import division
 from __future__ import absolute_import
 
 from collections import Mapping
+from distutils.spawn import find_executable
 import os
 import sys
 
 from codechecker_common import logger
 from codechecker_common.util import load_json_or_empty
 
+from . import env
+
 LOG = logger.get_logger('system')
 
 
@@ -116,6 +119,7 @@ class Context(object):
             self.__package_git_tag = package_git_dirtytag
 
     def __populate_analyzers(self):
+        analyzer_env = env.extend(self.path_env_extra, self.ld_lib_path_extra)
         compiler_binaries = self.pckg_layout.get('analyzers')
         for name, value in compiler_binaries.items():
             if os.path.dirname(value):
@@ -123,7 +127,8 @@ class Context(object):
                 self.__analyzers[name] = os.path.join(self._package_root,
                                                       value)
             else:
-                self.__analyzers[name] = value
+                compiler_binary = find_executable(value, analyzer_env['PATH'])
+                self.__analyzers[name] = os.path.realpath(compiler_binary)
 
     @property
     def checker_config(self):
diff --git a/analyzer/codechecker_analyzer/analyzers/analyzer_types.py b/analyzer/codechecker_analyzer/analyzers/analyzer_types.py
index e592c1ee..c54e9696 100644
--- a/analyzer/codechecker_analyzer/analyzers/analyzer_types.py
+++ b/analyzer/codechecker_analyzer/analyzers/analyzer_types.py
@@ -137,7 +137,8 @@ def check_supported_analyzers(analyzers, context):
                 LOG.debug("Configured binary '%s' for analyzer '%s' was "
                           "not found, but environment PATH contains '%s'.",
                           analyzer_bin, analyzer_name, found_bin)
-                context.analyzer_binaries[analyzer_name] = found_bin
+                context.analyzer_binaries[analyzer_name] = \\
+                    os.path.realpath(found_bin)
 
             analyzer_bin = found_bin
 
diff --git a/analyzer/codechecker_analyzer/cmd/checkers.py b/analyzer/codechecker_analyzer/cmd/checkers.py
index 49e1843c..5ee2ea87 100644
--- a/analyzer/codechecker_analyzer/cmd/checkers.py
+++ b/analyzer/codechecker_analyzer/cmd/checkers.py
@@ -11,7 +11,6 @@ from __future__ import division
 from __future__ import absolute_import
 
 import argparse
-from distutils.spawn import find_executable
 import os
 import subprocess
 import sys
@@ -27,7 +26,7 @@ from codechecker_analyzer import env
 LOG = logger.get_logger('system')
 
 
-def get_diagtool_bin(env=None):
+def get_diagtool_bin():
     """
     Return full path of diagtool.
 
@@ -35,12 +34,7 @@ def get_diagtool_bin(env=None):
     clang binary and return full path of this binary if it exists.
     """
     context = analyzer_context.get_context()
-    analyzer_binary = context.analyzer_binaries.get(ClangSA.ANALYZER_NAME)
-
-    clang_bin = analyzer_binary
-    if not os.path.isabs(clang_bin):
-        clang_bin = find_executable(analyzer_binary,
-                                    env['PATH'] if env else None)
+    clang_bin = context.analyzer_binaries.get(ClangSA.ANALYZER_NAME)
 
     if not clang_bin:
         return None
@@ -63,7 +57,7 @@ def get_warnings(env=None):
     """
     Returns list of warning flags by using diagtool.
     """
-    diagtool_bin = get_diagtool_bin(env)
+    diagtool_bin = get_diagtool_bin()
 
     if not diagtool_bin:
         return []
@@ -135,11 +129,7 @@ def add_arguments_to_parser(parser):
                              ', '.join(analyzer_types.
                                        supported_analyzers) + ".")
 
-    context = analyzer_context.get_context()
-    analyzer_environment = env.extend(context.path_env_extra,
-                                      context.ld_lib_path_extra)
-
-    if get_diagtool_bin(analyzer_environment):
+    if get_diagtool_bin():
         parser.add_argument('-w', '--warnings',
                             dest='show_warnings',
                             default=argparse.SUPPRESS,