class ModuleMapParser

Declaration

class ModuleMapParser { /* full declaration omitted */ };

Declared at: clang/lib/Lex/ModuleMap.cpp:1435

Member Variables

private clang::Lexer& L
private clang::SourceManager& SourceMgr
private const clang::TargetInfo* Target
Default target information, used only for string literal parsing.
private clang::DiagnosticsEngine& Diags
private clang::ModuleMap& Map
private const clang::FileEntry* ModuleMapFile
The current module map file.
private clang::SourceLocation CurrModuleDeclLoc
Source location of most recent parsed module declaration
private const clang::DirectoryEntry* Directory
The directory that file names in this module map file should be resolved relative to.
private bool IsSystem
Whether this module map is in a system header directory.
private bool HadError = false
Whether an error occurred.
private llvm::BumpPtrAllocator StringData
Stores string data for the various string literals referenced during parsing.
private clang::MMToken Tok
The current token.
private clang::Module* ActiveModule = nullptr
The active module.
private llvm::SmallPtrSet<Module*, 2> UsesRequiresExcludedHack
On older Darwin SDK versions, 'requires excluded' is used to mark the contents of the Darwin.C.excluded (assert.h) and Tcl.Private modules as non-modular headers. For backwards compatibility, we continue to support this idiom for just these modules, and map the headers to 'textual' to match the original intent.

Method Overview

Methods

ModuleMapParser(
    clang::Lexer& L,
    clang::SourceManager& SourceMgr,
    const clang::TargetInfo* Target,
    clang::DiagnosticsEngine& Diags,
    clang::ModuleMap& Map,
    const clang::FileEntry* ModuleMapFile,
    const clang::DirectoryEntry* Directory,
    bool IsSystem)

Declared at: clang/lib/Lex/ModuleMap.cpp:1517

Parameters

clang::Lexer& L
clang::SourceManager& SourceMgr
const clang::TargetInfo* Target
clang::DiagnosticsEngine& Diags
clang::ModuleMap& Map
const clang::FileEntry* ModuleMapFile
const clang::DirectoryEntry* Directory
bool IsSystem

clang::SourceLocation consumeToken()

Description

Consume the current token and return its location.

Declared at: clang/lib/Lex/ModuleMap.cpp:1483

void diagnosePrivateModules(
    clang::SourceLocation ExplicitLoc,
    clang::SourceLocation FrameworkLoc)

Description

Private modules are canonicalized as Foo_Private. Clang provides extra module map search logic to find the appropriate private module when PCH is used with implicit module maps. Warn when private modules are written in other ways (FooPrivate and Foo.Private), providing notes and fixits.

Declared at: clang/lib/Lex/ModuleMap.cpp:1509

Parameters

clang::SourceLocation ExplicitLoc
clang::SourceLocation FrameworkLoc

clang::SourceLocation getLocation()

Declared at: clang/lib/Lex/ModuleMap.cpp:1531

void parseConfigMacros()

Description

Parse a configuration macro declaration. module-declaration: 'config_macros' attributes[opt] config-macro-list? config-macro-list: identifier (',' identifier)?

Declared at: clang/lib/Lex/ModuleMap.cpp:1501

void parseConflict()

Description

Parse a conflict declaration. module-declaration: 'conflict' module-id ',' string-literal

Declared at: clang/lib/Lex/ModuleMap.cpp:1502

void parseExportAsDecl()

Description

Parse a module export_as declaration. export-as-declaration: 'export_as' identifier

Declared at: clang/lib/Lex/ModuleMap.cpp:1498

void parseExportDecl()

Description

Parse a module export declaration. export-declaration: 'export' wildcard-module-id wildcard-module-id: identifier '*' identifier '.' wildcard-module-id

Declared at: clang/lib/Lex/ModuleMap.cpp:1497

void parseExternModuleDecl()

Description

Parse an extern module declaration. extern module-declaration: 'extern' 'module' module-id string-literal

Declared at: clang/lib/Lex/ModuleMap.cpp:1493

void parseHeaderDecl(
    MMToken::TokenKind,
    clang::SourceLocation LeadingLoc)

Description

Parse a header declaration. header-declaration: 'textual'[opt] 'header' string-literal 'private' 'textual'[opt] 'header' string-literal 'exclude' 'header' string-literal 'umbrella' 'header' string-literal FIXME: Support 'private textual header'.

Declared at: clang/lib/Lex/ModuleMap.cpp:1495

Parameters

MMToken::TokenKind
clang::SourceLocation LeadingLoc

void parseInferredModuleDecl(bool Framework,
                             bool Explicit)

Description

Parse an inferred module declaration (wildcard modules). module-declaration: 'explicit'[opt] 'framework'[opt] 'module' * attributes[opt] { inferred-module-member* } inferred-module-member: 'export' '*' 'exclude' identifier

Declared at: clang/lib/Lex/ModuleMap.cpp:1503

Parameters

bool Framework
bool Explicit

void parseLinkDecl()

Description

Parse a link declaration. module-declaration: 'link' 'framework'[opt] string-literal

Declared at: clang/lib/Lex/ModuleMap.cpp:1500

void parseModuleDecl()

Description

Parse a module declaration. module-declaration: 'extern' 'module' module-id string-literal 'explicit'[opt] 'framework'[opt] 'module' module-id attributes[opt] { module-member* } module-member: requires-declaration header-declaration submodule-declaration export-declaration export-as-declaration link-declaration submodule-declaration: module-declaration inferred-submodule-declaration

Declared at: clang/lib/Lex/ModuleMap.cpp:1492

bool parseModuleId(
    clang::ModuleMapParser::ModuleId& Id)

Description

Parse a module-id. module-id: identifier identifier '.' module-id

Declared at: clang/lib/Lex/ModuleMap.cpp:1491

Parameters

clang::ModuleMapParser::ModuleId& Id

Returns

true if an error occurred, false otherwise.

bool parseModuleMapFile()

Description

Parse a module map file. module-map-file: module-declaration*

Declared at: clang/lib/Lex/ModuleMap.cpp:1528

bool parseOptionalAttributes(
    clang::ModuleMapParser::Attributes& Attrs)

Description

Parse optional attributes. attributes: attribute attributes attribute attribute: [ identifier ]

Declared at: clang/lib/Lex/ModuleMap.cpp:1514

Parameters

clang::ModuleMapParser::Attributes& Attrs
Will be filled in with the parsed attributes.

Returns

true if an error occurred, false otherwise.

void parseRequiresDecl()

Description

Parse a requires declaration. requires-declaration: 'requires' feature-list feature-list: feature ',' feature-list feature feature: '!'[opt] identifier

Declared at: clang/lib/Lex/ModuleMap.cpp:1494

void parseUmbrellaDirDecl(
    clang::SourceLocation UmbrellaLoc)

Description

Parse an umbrella directory declaration. umbrella-dir-declaration: umbrella string-literal

Declared at: clang/lib/Lex/ModuleMap.cpp:1496

Parameters

clang::SourceLocation UmbrellaLoc

void parseUseDecl()

Description

Parse a module use declaration. use-declaration: 'use' wildcard-module-id

Declared at: clang/lib/Lex/ModuleMap.cpp:1499

void skipUntil(MMToken::TokenKind K)

Description

Skip tokens until we reach the a token with the given kind (or the end of the file).

Declared at: clang/lib/Lex/ModuleMap.cpp:1487

Parameters

MMToken::TokenKind K

bool terminatedByDirective()

Declared at: clang/lib/Lex/ModuleMap.cpp:1530