struct MacroExpansion

Declaration

struct MacroExpansion { /* full declaration omitted */ };

Description

Contains information on the token's role in a macro expansion. Given the following definitions: A(X) = [ X ] B(X) = < X > C(X) = X Consider the macro call: A({B(C(C(x)))}) -> [{ <x >}] In this case, the tokens of the unexpanded macro call will have the following relevant entries in their macro context (note that formatting the unexpanded macro call happens *after* formatting the expanded macro call): A( { B( C( C(x) ) ) } ) Role: NN U NN NN NNUN N N U N (N=None, U=UnexpandedArg) [ { < x > } ] Role: H E H E H E H (H=Hidden, E=ExpandedArg) ExpandedFrom[0]: A A A A A A A ExpandedFrom[1]: B B B ExpandedFrom[2]: C ExpandedFrom[3]: C StartOfExpansion: 1 0 1 2 0 0 0 EndOfExpansion: 0 0 0 2 1 0 1

Declared at: clang/lib/Format/FormatToken.h:200

Member Variables

public clang::format::MacroRole Role
The token's role in the macro expansion. When formatting an expanded macro, all tokens that are part of macro arguments will be MR_ExpandedArg, while all tokens that are not visible in the macro call will be MR_Hidden. When formatting an unexpanded macro call, all tokens that are part of macro arguments will be MR_UnexpandedArg.
public llvm::SmallVector<FormatToken*, 1> ExpandedFrom
The stack of macro call identifier tokens this token was expanded from.
public unsigned int StartOfExpansion = 0
The number of expansions of which this macro is the first entry.
public unsigned int EndOfExpansion = 0
The number of currently open expansions in \c ExpandedFrom this macro is the last token in.

Method Overview

Methods

ΒΆMacroExpansion(clang::format::MacroRole Role)

Declared at: clang/lib/Format/FormatToken.h:201

Parameters

clang::format::MacroRole Role