tools/android/eclipse/generate_cdt_clang_settings.py
def GetClangDefines(compiler_path):
  """Gets the system defines as determined by the clang compiler.

  Returns:
    The dict of defines.
  """

  all_defines = {}
  command = [compiler_path, '-E', '-dM', '-']
  proc = subprocess.Popen(args=command, stdin=subprocess.PIPE,
                          stdout=subprocess.PIPE)

  # Extract the list of defines from the output, which has this format:
  # #define __SIZEOF_INT__ 4
  # ...
  # #define unix 1
  output = proc.communicate()[0]
  for line in output.splitlines():
    if not line.strip():
      continue
    line_parts = line.split(' ', 2)
    key = line_parts[1]
    if len(line_parts) >= 3:
      val = line_parts[2]
    else:
      val = '1'
    all_defines[key] = val

  return all_defines
Gets the system defines as determined by the clang compiler.

  Returns:
    The dict of defines.
  
Gets the system defines as determined by the clang compiler.
Gets the system defines as determined by the clang compiler .
def GetClangDefines(compiler_path):
  all_defines = {}
  command = [compiler_path, '-E', '-dM', '-']
  proc = subprocess.Popen(args=command, stdin=subprocess.PIPE,
                          stdout=subprocess.PIPE)
  output = proc.communicate()[0]
  for line in output.splitlines():
    if not line.strip():
      continue
    line_parts = line.split(' ', 2)
    key = line_parts[1]
    if len(line_parts) >= 3:
      val = line_parts[2]
    else:
      val = '1'
    all_defines[key] = val
  return all_defines
def GetClangDefines ( compiler_path ) : all_defines = { } command = [ compiler_path , '-E' , '-dM' , '-' ] proc = subprocess . Popen ( args = command , stdin = subprocess . PIPE , stdout = subprocess . PIPE ) output = proc . communicate ( ) [ 0 ] for line in output . splitlines ( ) : if not line . strip ( ) : continue line_parts = line . split ( ' ' , 2 ) key = line_parts [ 1 ] if len ( line_parts ) >= 3 : val = line_parts [ 2 ] else : val = '1' all_defines [ key ] = val return all_defines
Gets the system defines as determined by the clang compiler.
Gets the system defines as determined by the clang compiler .
"""Gets the system defines as determined by the clang compiler.

  Returns:
    The dict of defines.
  """ # Extract the list of defines from the output, which has this format: # #define __SIZEOF_INT__ 4 # ... # #define unix 1
The dict of defines.
The dict of defines .
compiler_path