clang  6.0.0svn
Public Member Functions | List of all members
clang::VariadicMacroScopeGuard Class Reference

An RAII class that tracks when the Preprocessor starts and stops lexing the definition of a (ISO C/C++) variadic macro. More...

#include "clang/Lex/VariadicMacroSupport.h"

Public Member Functions

 VariadicMacroScopeGuard (const Preprocessor &P)
 
void enterScope ()
 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. More...
 
void exitScope ()
 Client code should call this function as soon as the Preprocessor has either completed lexing the macro's definition tokens, or an error occured and the context is being exited. More...
 
 ~VariadicMacroScopeGuard ()
 

Detailed 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).

Definition at line 31 of file VariadicMacroSupport.h.

Constructor & Destructor Documentation

◆ VariadicMacroScopeGuard()

clang::VariadicMacroScopeGuard::VariadicMacroScopeGuard ( const Preprocessor P)
inline

Definition at line 37 of file VariadicMacroSupport.h.

References clang::IdentifierInfo::isPoisoned().

◆ ~VariadicMacroScopeGuard()

clang::VariadicMacroScopeGuard::~VariadicMacroScopeGuard ( )
inline

Definition at line 66 of file VariadicMacroSupport.h.

References exitScope().

Member Function Documentation

◆ enterScope()

void clang::VariadicMacroScopeGuard::enterScope ( )
inline

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.

Definition at line 50 of file VariadicMacroSupport.h.

References clang::IdentifierInfo::setIsPoisoned().

Referenced by isConfigurationPattern().

◆ exitScope()

void clang::VariadicMacroScopeGuard::exitScope ( )
inline

Client code should call this function as soon as the Preprocessor has either completed lexing the macro's definition tokens, or an error occured and the context is being exited.

This function is idempotent (might be explicitly called, and then reinvoked via the destructor).

Definition at line 60 of file VariadicMacroSupport.h.

References clang::IdentifierInfo::setIsPoisoned().

Referenced by ~VariadicMacroScopeGuard().


The documentation for this class was generated from the following file: