class VariadicMacroScopeGuard

Declaration

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

Description

An RAII class that tracks when the Preprocessor starts and stops lexing the definition of a (ISO C/C++) variadic macro. As an example, this is useful for unpoisoning and repoisoning certain identifiers (such as __VA_ARGS__) that are only allowed in this context. Also, being a friend of the Preprocessor class allows it to access PP's cached identifiers directly (as opposed to performing a lookup each time).

Declared at: clang/include/clang/Lex/VariadicMacroSupport.h:30

Member Variables

private const clang::Preprocessor& PP
private clang::IdentifierInfo* const Ident__VA_ARGS__
private clang::IdentifierInfo* const Ident__VA_OPT__

Method Overview

Methods

VariadicMacroScopeGuard(
    const clang::Preprocessor& P)

Declared at: clang/include/clang/Lex/VariadicMacroSupport.h:36

Parameters

const clang::Preprocessor& P

void enterScope()

Description

Client code should call this function just before the Preprocessor is about to Lex tokens from the definition of a variadic (ISO C/C++) macro.

Declared at: clang/include/clang/Lex/VariadicMacroSupport.h:47

void exitScope()

Description

Client code should call this function as soon as the Preprocessor has either completed lexing the macro's definition tokens, or an error occurred and the context is being exited. This function is idempotent (might be explicitly called, and then reinvoked via the destructor).

Declared at: clang/include/clang/Lex/VariadicMacroSupport.h:56

~VariadicMacroScopeGuard()

Declared at: clang/include/clang/Lex/VariadicMacroSupport.h:61