Ninja
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CLParser Struct Reference

Visual Studio's cl.exe requires some massaging to work with Ninja; for example, it emits include information on stderr in a funny format when building with /showIncludes. More...

#include <msvc_helper.h>

Public Member Functions

string Parse (const string &output)
 Parse the full output of cl, returning the output (if any) that should printed. More...
 

Static Public Member Functions

static bool FilterInputFilename (string line)
 Parse a line of cl.exe output and return true if it looks like it's printing an input filename. More...
 
static string FilterShowIncludes (const string &line)
 Parse a line of cl.exe output and extract /showIncludes info. More...
 
static bool IsSystemInclude (string path)
 Return true if a mentioned include file is a system path. More...
 

Public Attributes

set< string > includes_
 

Detailed Description

Visual Studio's cl.exe requires some massaging to work with Ninja; for example, it emits include information on stderr in a funny format when building with /showIncludes.

This class parses this output.

Definition at line 26 of file msvc_helper.h.

Member Function Documentation

bool CLParser::FilterInputFilename ( string  line)
static

Parse a line of cl.exe output and return true if it looks like it's printing an input filename.

This is a heuristic but it appears to be the best we can do. Exposed for testing.

Definition at line 75 of file msvc_helper-win32.cc.

Referenced by Parse(), and TEST().

string CLParser::FilterShowIncludes ( const string &  line)
static

Parse a line of cl.exe output and extract /showIncludes info.

If a dependency is extracted, returns a nonempty string. Exposed for testing.

Definition at line 51 of file msvc_helper-win32.cc.

Referenced by Parse(), and TEST().

bool CLParser::IsSystemInclude ( string  path)
static

Return true if a mentioned include file is a system path.

Filtering these out reduces dependency information considerably.

Definition at line 67 of file msvc_helper-win32.cc.

Referenced by Parse().

string CLParser::Parse ( const string &  output)

Parse the full output of cl, returning the output (if any) that should printed.

Definition at line 84 of file msvc_helper-win32.cc.

References FilterInputFilename(), FilterShowIncludes(), includes_, IsSystemInclude(), and IncludesNormalize::Normalize().

Referenced by Builder::ExtractDeps(), MSVCHelperMain(), and TEST().

Member Data Documentation

set<string> CLParser::includes_

Definition at line 46 of file msvc_helper.h.

Referenced by Builder::ExtractDeps(), Parse(), and TEST().


The documentation for this struct was generated from the following files: