Skip to content

Commit

Permalink
analyzer command generation does not append -### by default
Browse files Browse the repository at this point in the history
  • Loading branch information
rizsotto committed Jun 26, 2014
1 parent e4c2a8d commit d254f50
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions analyzer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,8 @@ def get_clang_arguments(cwd, cmd):
execute) or indidect way (whey you first ask Clang to print the command
to run for that compilation, and then execute the given command).
This script is using the indirect way. Which means it always pass '-###'
to generate the command, and then executes it.
This method receives the command (with the '-###' argument) and returns
the corresponding command.
This method receives the full command line for direct compilation. And
it generates the command for indirect compilation.
"""
def lastline(stream):
last = None
Expand All @@ -627,6 +624,7 @@ def strip_quotes(quoted):
return match.group(1) if match else quoted

try:
cmd.insert(1, '-###')
logging.debug('exec command in {0}: {1}'.format(cwd, ' '.join(cmd)))
child = subprocess.Popen(cmd,
cwd=cwd,
Expand All @@ -649,11 +647,9 @@ def strip_quotes(quoted):
def build_args(opts, output=None):
""" Create command to run analyzer or failure report generation.
The output of this method shall be passed to 'get_clang_arguments' to
get the real compilation command.
"""
If output is passed it returns failure report command.
If it's not given it returns the analyzer command. """
def syntax_check():
""" Esential parameters to run Clang against a source file. """
result = []
if 'arch' in opts:
result.extend(['-arch', opts['arch']])
Expand All @@ -672,7 +668,6 @@ def implicit_output():
return result

def static_analyzer():
""" Analyzer specific parameters. """
result = []
if 'store_model' in opts:
result.append('-analyzer-store={0}'.format(opts['store_model']))
Expand All @@ -697,8 +692,8 @@ def static_analyzer():
lambda acc, x: acc + ['-Xclang', x], result, [])

if output:
return [opts['clang'], '-###', '-fsyntax-only', '-E', '-o', output] + \
return [opts['clang'], '-fsyntax-only', '-E', '-o', output] + \
syntax_check()
else:
return [opts['clang'], '-###', '--analyze'] + \
return [opts['clang'], '--analyze'] + \
syntax_check() + static_analyzer() + implicit_output()

0 comments on commit d254f50

Please sign in to comment.