diff options
author | Yury Gribov <y.gribov@samsung.com> | 2016-02-18 11:08:46 +0000 |
---|---|---|
committer | Yury Gribov <y.gribov@samsung.com> | 2016-02-18 11:08:46 +0000 |
commit | a6560ebe4c4bc540d6eb8cbfd60fe0788194c90c (patch) | |
tree | 99b77dd582cb9a9ac123067ae1394010bf8cd7e5 /clang/tools/scan-build-py/libscanbuild/analyze.py | |
parent | 9c4ed175c2055711b1a2d8a4d1a1575b9a5e41fb (diff) | |
download | llvm-a6560ebe4c4bc540d6eb8cbfd60fe0788194c90c.zip llvm-a6560ebe4c4bc540d6eb8cbfd60fe0788194c90c.tar.gz llvm-a6560ebe4c4bc540d6eb8cbfd60fe0788194c90c.tar.bz2 |
[analyzer] Add --force-analyze-debug-code option to scan-build
to force debug build and hopefully enable more precise warnings.
Static Analyzer is much more efficient when built in debug mode
(-UNDEBUG) so we advice users to enable it manually. This may be
inconvenient in case of large complex projects (think about Linux
distros e.g. Android or Tizen). This patch adds a flag to scan-build
which inserts -UNDEBUG automatically.
Differential Revision: http://reviews.llvm.org/D16200
llvm-svn: 261204
Diffstat (limited to 'clang/tools/scan-build-py/libscanbuild/analyze.py')
-rw-r--r-- | clang/tools/scan-build-py/libscanbuild/analyze.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/clang/tools/scan-build-py/libscanbuild/analyze.py b/clang/tools/scan-build-py/libscanbuild/analyze.py index 0d3547b..9b00d04 100644 --- a/clang/tools/scan-build-py/libscanbuild/analyze.py +++ b/clang/tools/scan-build-py/libscanbuild/analyze.py @@ -106,7 +106,8 @@ def run_analyzer(args, output_dir): 'output_dir': output_dir, 'output_format': args.output_format, 'output_failures': args.output_failures, - 'direct_args': analyzer_params(args) + 'direct_args': analyzer_params(args), + 'force_analyze_debug_code' : args.force_analyze_debug_code } logging.debug('run analyzer against compilation database') @@ -138,7 +139,9 @@ def setup_environment(args, destination, bin_dir): 'ANALYZE_BUILD_REPORT_DIR': destination, 'ANALYZE_BUILD_REPORT_FORMAT': args.output_format, 'ANALYZE_BUILD_REPORT_FAILURES': 'yes' if args.output_failures else '', - 'ANALYZE_BUILD_PARAMETERS': ' '.join(analyzer_params(args)) + 'ANALYZE_BUILD_PARAMETERS': ' '.join(analyzer_params(args)), + 'ANALYZE_BUILD_FORCE_ANALYZE_DEBUG_CODE' + : 'yes' if args.force_analyze_debug_code else '' }) return environment @@ -168,6 +171,8 @@ def analyze_build_wrapper(cplusplus): 'output_failures': os.getenv('ANALYZE_BUILD_REPORT_FAILURES'), 'direct_args': os.getenv('ANALYZE_BUILD_PARAMETERS', '').split(' '), + 'force_analyze_debug_code': + os.getenv('ANALYZE_BUILD_FORCE_ANALYZE_DEBUG_CODE'), 'directory': os.getcwd(), } # get relevant parameters from command line arguments @@ -450,6 +455,13 @@ def create_parser(from_build_command): Could be usefull when project contains 3rd party libraries. The directory path shall be absolute path as file names in the compilation database.""") + advanced.add_argument( + '--force-analyze-debug-code', + dest='force_analyze_debug_code', + action='store_true', + help="""Tells analyzer to enable assertions in code even if they were + disabled during compilation, enabling more precise + results.""") plugins = parser.add_argument_group('checker options') plugins.add_argument( |