class MacroDirective

Declaration

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

Description

Encapsulates changes to the "macros namespace" (the location where the macro name became active, the location where it was undefined, etc.). MacroDirectives, associated with an identifier, are used to model the macro history. Usually a macro definition (MacroInfo) is where a macro name becomes active (MacroDirective) but #pragma push_macro / pop_macro can create additional DefMacroDirectives for the same MacroInfo.

Declared at: clang/include/clang/Lex/MacroInfo.h:314

Member Variables

protected clang::MacroDirective* Previous = nullptr
Previous macro directive for the same identifier, or nullptr.
protected clang::SourceLocation Loc
protected unsigned int MDKind
MacroDirective kind.
protected unsigned int IsFromPCH
True if the macro directive was loaded from a PCH file.
protected unsigned int IsPublic
Whether the macro has public visibility (when described in a module).

Method Overview

Methods

MacroDirective(clang::MacroDirective::Kind K,
               clang::SourceLocation Loc)

Declared at: clang/include/clang/Lex/MacroInfo.h:340

Parameters

clang::MacroDirective::Kind K
clang::SourceLocation Loc

static bool classof(const clang::MacroDirective*)

Declared at: clang/include/clang/Lex/MacroInfo.h:426

Parameters

const clang::MacroDirective*

void dump() const

Declared at: clang/include/clang/Lex/MacroInfo.h:424

const clang::MacroDirective::DefInfo
findDirectiveAtLoc(
    clang::SourceLocation L,
    const clang::SourceManager& SM) const

Description

Find macro definition active in the specified source location. If this macro was not defined there, return NULL.

Declared at: clang/include/clang/Lex/MacroInfo.h:421

Parameters

clang::SourceLocation L
const clang::SourceManager& SM

clang::MacroDirective::DefInfo getDefinition()

Description

Traverses the macro directives history and returns the next macro definition directive along with info about its undefined location (if there is one) and if it is public or private.

Declared at: clang/include/clang/Lex/MacroInfo.h:403

const clang::MacroDirective::DefInfo
getDefinition() const

Declared at: clang/include/clang/Lex/MacroInfo.h:404

clang::MacroDirective::Kind getKind() const

Declared at: clang/include/clang/Lex/MacroInfo.h:344

clang::SourceLocation getLocation() const

Declared at: clang/include/clang/Lex/MacroInfo.h:346

const clang::MacroInfo* getMacroInfo() const

Declared at: clang/include/clang/Lex/MacroInfo.h:414

clang::MacroInfo* getMacroInfo()

Declared at: clang/include/clang/Lex/MacroInfo.h:417

const clang::MacroDirective* getPrevious() const

Description

Get previous definition of the macro with the same name.

Declared at: clang/include/clang/Lex/MacroInfo.h:352

clang::MacroDirective* getPrevious()

Description

Get previous definition of the macro with the same name.

Declared at: clang/include/clang/Lex/MacroInfo.h:355

bool isDefined() const

Declared at: clang/include/clang/Lex/MacroInfo.h:408

bool isFromPCH() const

Description

Return true if the macro directive was loaded from a PCH file.

Declared at: clang/include/clang/Lex/MacroInfo.h:358

void setIsFromPCH()

Declared at: clang/include/clang/Lex/MacroInfo.h:360

void setPrevious(clang::MacroDirective* Prev)

Description

Set previous definition of the macro with the same name.

Declared at: clang/include/clang/Lex/MacroInfo.h:349

Parameters

clang::MacroDirective* Prev