clang 20.0.0git
Public Member Functions | List of all members
clang::PragmaHandler Class Referenceabstract

PragmaHandler - Instances of this interface defined to handle the various pragmas that the language front-end uses. More...

#include "clang/Lex/Pragma.h"

Inheritance diagram for clang::PragmaHandler:
Inheritance graph
[legend]

Public Member Functions

 PragmaHandler ()=default
 
 PragmaHandler (StringRef name)
 
virtual ~PragmaHandler ()
 
StringRef getName () const
 
virtual void HandlePragma (Preprocessor &PP, PragmaIntroducer Introducer, Token &FirstToken)=0
 
virtual PragmaNamespacegetIfNamespace ()
 getIfNamespace - If this is a namespace, return it.
 

Detailed Description

PragmaHandler - Instances of this interface defined to handle the various pragmas that the language front-end uses.

Each handler optionally has a name (e.g. "pack") and the HandlePragma method is invoked when a pragma with that identifier is found. If a handler does not match any of the declared pragmas the handler with a null identifier is invoked, if it exists.

Note that the PragmaNamespace class can be used to subdivide pragmas, e.g. we treat "\#pragma STDC" and "\#pragma GCC" as namespaces that contain other pragmas.

Definition at line 65 of file Pragma.h.

Constructor & Destructor Documentation

◆ PragmaHandler() [1/2]

clang::PragmaHandler::PragmaHandler ( )
default

◆ PragmaHandler() [2/2]

clang::PragmaHandler::PragmaHandler ( StringRef  name)
inlineexplicit

Definition at line 70 of file Pragma.h.

◆ ~PragmaHandler()

PragmaHandler::~PragmaHandler ( )
virtualdefault

Member Function Documentation

◆ getIfNamespace()

virtual PragmaNamespace * clang::PragmaHandler::getIfNamespace ( )
inlinevirtual

getIfNamespace - If this is a namespace, return it.

This is equivalent to using a dynamic_cast, but doesn't require RTTI.

Reimplemented in clang::PragmaNamespace.

Definition at line 79 of file Pragma.h.

Referenced by clang::Preprocessor::RemovePragmaHandler().

◆ getName()

StringRef clang::PragmaHandler::getName ( ) const
inline

◆ HandlePragma()

virtual void clang::PragmaHandler::HandlePragma ( Preprocessor PP,
PragmaIntroducer  Introducer,
Token FirstToken 
)
pure virtual

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