parameters: (filepath, gn_args, work_dir)
return_statement: return command
docstring: Get the whole command used to compile one cc file.
    Typically, clang++ with flags, defines and include paths.
  
    Args:
        filepath: path to .cc file.
        gen_args: build configuration for gn.
        work_dir: build dir.
  
    Returns:
      Command as a list, ready to be consumed by subprocess.Popen.
docstring_summary: Get the whole command used to compile one cc file.
    Typically, clang++ with flags, defines and include paths.
docstring_tokens: Get the whole command used to compile one cc file . Typically clang ++ with flags defines and include paths .
function: def GetCompilationCommand(filepath, gn_args, work_dir):
      """Get the whole command used to compile one cc file.
    Typically, clang++ with flags, defines and include paths.
  
    Args:
        filepath: path to .cc file.
        gen_args: build configuration for gn.
        work_dir: build dir.
  
    Returns:
      Command as a list, ready to be consumed by subprocess.Popen.
    """
      gn_errors = RunGnCommand(['gen'] + gn_args + [work_dir])
      if gn_errors:
          raise (RuntimeError('FYI, cannot complete check due to gn error:\n%s\n'
                              'Please open a bug.' % gn_errors))
  
      # Needed for single file compilation.
      commands = GetCompilationDb(work_dir)
  
      # Path as referenced by ninja.
      rel_path = os.path.relpath(os.path.abspath(filepath), work_dir)
  
      # Gather defines, include path and flags (such as -std=c++11).
      try:
          compilation_entry = commands[rel_path]
      except KeyError:
          raise ValueError('%s: Not found in compilation database.\n'
                           'Please check the path.' % filepath)
      command = compilation_entry['command'].split()
  
      # Remove troublesome flags. May trigger an error otherwise.
      if '-MMD' in command:
          command.remove('-MMD')
      if '-MF' in command:
          index = command.index('-MF')
          del command[index:index + 2]  # Remove filename as well.
  
      return command
function_tokens: def GetCompilationCommand ( filepath , gn_args , work_dir ) : gn_errors = RunGnCommand ( [ 'gen' ] + gn_args + [ work_dir ] ) if gn_errors : raise ( RuntimeError ( 'FYI, cannot complete check due to gn error:\n%s\n' 'Please open a bug.' % gn_errors ) ) # Needed for single file compilation. commands = GetCompilationDb ( work_dir ) # Path as referenced by ninja. rel_path = os . path . relpath ( os . path . abspath ( filepath ) , work_dir ) # Gather defines, include path and flags (such as -std=c++11). try : compilation_entry = commands [ rel_path ] except KeyError : raise ValueError ( '%s: Not found in compilation database.\n' 'Please check the path.' % filepath ) command = compilation_entry [ 'command' ] . split ( ) # Remove troublesome flags. May trigger an error otherwise. if '-MMD' in command : command . remove ( '-MMD' ) if '-MF' in command : index = command . index ( '-MF' ) del command [ index : index + 2 ] # Remove filename as well. return command