clang 22.0.0git
clang::PPCallbacks Class Reference

This interface provides a way to observe the actions of the preprocessor as it does its thing. More...

#include "clang/Lex/PPCallbacks.h"

Inheritance diagram for clang::PPCallbacks:
[legend]

Public Types

enum  FileChangeReason { EnterFile , ExitFile , SystemHeaderPragma , RenameFile }
enum class  LexedFileChangeReason { EnterFile , ExitFile }
enum  PragmaMessageKind { PMK_Message , PMK_Warning , PMK_Error }
 Determines the kind of #pragma invoking a call to PragmaMessage. More...
enum  PragmaWarningSpecifier {
  PWS_Default , PWS_Disable , PWS_Error , PWS_Once ,
  PWS_Suppress , PWS_Level1 , PWS_Level2 , PWS_Level3 ,
  PWS_Level4
}
 Callback invoked when a #pragma warning directive is read. More...
enum  ConditionValueKind { CVK_NotEvaluated , CVK_False , CVK_True }

Public Member Functions

virtual ~PPCallbacks ()
virtual void FileChanged (SourceLocation Loc, FileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID=FileID())
 Callback invoked whenever a source file is entered or exited.
virtual void LexedFileChanged (FileID FID, LexedFileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID, SourceLocation Loc)
 Callback invoked whenever the Lexer moves to a different file for lexing.
virtual void FileSkipped (const FileEntryRef &SkippedFile, const Token &FilenameTok, SrcMgr::CharacteristicKind FileType)
 Callback invoked whenever a source file is skipped as the result of header guard optimization.
virtual bool EmbedFileNotFound (StringRef FileName)
 Callback invoked whenever the preprocessor cannot find a file for an embed directive.
virtual void EmbedDirective (SourceLocation HashLoc, StringRef FileName, bool IsAngled, OptionalFileEntryRef File, const LexEmbedParametersResult &Params)
 Callback invoked whenever an embed directive has been processed, regardless of whether the embed will actually find a file.
virtual bool FileNotFound (StringRef FileName)
 Callback invoked whenever the preprocessor cannot find a file for an inclusion directive.
virtual void InclusionDirective (SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, StringRef SearchPath, StringRef RelativePath, const Module *SuggestedModule, bool ModuleImported, SrcMgr::CharacteristicKind FileType)
 Callback invoked whenever an inclusion directive of any kind (#include, #import, etc.) has been processed, regardless of whether the inclusion will actually result in an inclusion.
virtual void EnteredSubmodule (Module *M, SourceLocation ImportLoc, bool ForPragma)
 Callback invoked whenever a submodule was entered.
virtual void LeftSubmodule (Module *M, SourceLocation ImportLoc, bool ForPragma)
 Callback invoked whenever a submodule was left.
virtual void moduleImport (SourceLocation ImportLoc, ModuleIdPath Path, const Module *Imported)
 Callback invoked whenever there was an explicit module-import syntax.
virtual void EndOfMainFile ()
 Callback invoked when the end of the main file is reached.
virtual void Ident (SourceLocation Loc, StringRef str)
 Callback invoked when a #ident or #sccs directive is read.
virtual void PragmaDirective (SourceLocation Loc, PragmaIntroducerKind Introducer)
 Callback invoked when start reading any pragma directive.
virtual void PragmaComment (SourceLocation Loc, const IdentifierInfo *Kind, StringRef Str)
 Callback invoked when a #pragma comment directive is read.
virtual void PragmaMark (SourceLocation Loc, StringRef Trivia)
 Callback invoked when a #pragma mark comment is read.
virtual void PragmaDetectMismatch (SourceLocation Loc, StringRef Name, StringRef Value)
 Callback invoked when a #pragma detect_mismatch directive is read.
virtual void PragmaDebug (SourceLocation Loc, StringRef DebugType)
 Callback invoked when a #pragma clang __debug directive is read.
virtual void PragmaMessage (SourceLocation Loc, StringRef Namespace, PragmaMessageKind Kind, StringRef Str)
 Callback invoked when a #pragma message directive is read.
virtual void PragmaDiagnosticPush (SourceLocation Loc, StringRef Namespace)
 Callback invoked when a #pragma gcc diagnostic push directive is read.
virtual void PragmaDiagnosticPop (SourceLocation Loc, StringRef Namespace)
 Callback invoked when a #pragma gcc diagnostic pop directive is read.
virtual void PragmaDiagnostic (SourceLocation Loc, StringRef Namespace, diag::Severity mapping, StringRef Str)
 Callback invoked when a #pragma gcc diagnostic directive is read.
virtual void PragmaOpenCLExtension (SourceLocation NameLoc, const IdentifierInfo *Name, SourceLocation StateLoc, unsigned State)
 Called when an OpenCL extension is either disabled or enabled with a pragma.
virtual void PragmaWarning (SourceLocation Loc, PragmaWarningSpecifier WarningSpec, ArrayRef< int > Ids)
virtual void PragmaWarningPush (SourceLocation Loc, int Level)
 Callback invoked when a #pragma warning(push) directive is read.
virtual void PragmaWarningPop (SourceLocation Loc)
 Callback invoked when a #pragma warning(pop) directive is read.
virtual void PragmaExecCharsetPush (SourceLocation Loc, StringRef Str)
 Callback invoked when a #pragma execution_character_set(push) directive is read.
virtual void PragmaExecCharsetPop (SourceLocation Loc)
 Callback invoked when a #pragma execution_character_set(pop) directive is read.
virtual void PragmaAssumeNonNullBegin (SourceLocation Loc)
 Callback invoked when a #pragma clang assume_nonnull begin directive is read.
virtual void PragmaAssumeNonNullEnd (SourceLocation Loc)
 Callback invoked when a #pragma clang assume_nonnull end directive is read.
virtual void MacroExpands (const Token &MacroNameTok, const MacroDefinition &MD, SourceRange Range, const MacroArgs *Args)
 Called by Preprocessor::HandleMacroExpandedIdentifier when a macro invocation is found.
virtual void MacroDefined (const Token &MacroNameTok, const MacroDirective *MD)
 Hook called whenever a macro definition is seen.
virtual void MacroUndefined (const Token &MacroNameTok, const MacroDefinition &MD, const MacroDirective *Undef)
 Hook called whenever a macro #undef is seen.
virtual void Defined (const Token &MacroNameTok, const MacroDefinition &MD, SourceRange Range)
 Hook called whenever the 'defined' operator is seen.
virtual void HasEmbed (SourceLocation Loc, StringRef FileName, bool IsAngled, OptionalFileEntryRef File)
 Hook called when a '__has_embed' directive is read.
virtual void HasInclude (SourceLocation Loc, StringRef FileName, bool IsAngled, OptionalFileEntryRef File, SrcMgr::CharacteristicKind FileType)
 Hook called when a '__has_include' or '__has_include_next' directive is read.
virtual void SourceRangeSkipped (SourceRange Range, SourceLocation EndifLoc)
 Hook called when a source range is skipped.
virtual void If (SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue)
 Hook called whenever an #if is seen.
virtual void Elif (SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue, SourceLocation IfLoc)
 Hook called whenever an #elif is seen.
virtual void Ifdef (SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD)
 Hook called whenever an #ifdef is seen.
virtual void Elifdef (SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD)
 Hook called whenever an #elifdef branch is taken.
virtual void Elifdef (SourceLocation Loc, SourceRange ConditionRange, SourceLocation IfLoc)
 Hook called whenever an #elifdef is skipped.
virtual void Ifndef (SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD)
 Hook called whenever an #ifndef is seen.
virtual void Elifndef (SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD)
 Hook called whenever an #elifndef branch is taken.
virtual void Elifndef (SourceLocation Loc, SourceRange ConditionRange, SourceLocation IfLoc)
 Hook called whenever an #elifndef is skipped.
virtual void Else (SourceLocation Loc, SourceLocation IfLoc)
 Hook called whenever an #else is seen.
virtual void Endif (SourceLocation Loc, SourceLocation IfLoc)
 Hook called whenever an #endif is seen.

Detailed Description

This interface provides a way to observe the actions of the preprocessor as it does its thing.

Clients can define their hooks here to implement preprocessor level tools.

Definition at line 37 of file PPCallbacks.h.

Member Enumeration Documentation

◆ ConditionValueKind

Enumerator
CVK_NotEvaluated 
CVK_False 
CVK_True 

Definition at line 385 of file PPCallbacks.h.

◆ FileChangeReason

Enumerator
EnterFile 
ExitFile 
SystemHeaderPragma 
RenameFile 

Definition at line 41 of file PPCallbacks.h.

◆ LexedFileChangeReason

Enumerator
EnterFile 
ExitFile 

Definition at line 55 of file PPCallbacks.h.

◆ PragmaMessageKind

Determines the kind of #pragma invoking a call to PragmaMessage.

Enumerator
PMK_Message 

#pragma message has been invoked.

PMK_Warning 

#pragma GCC warning has been invoked.

PMK_Error 

#pragma GCC error has been invoked.

Definition at line 255 of file PPCallbacks.h.

◆ PragmaWarningSpecifier

Callback invoked when a #pragma warning directive is read.

Enumerator
PWS_Default 
PWS_Disable 
PWS_Error 
PWS_Once 
PWS_Suppress 
PWS_Level1 
PWS_Level2 
PWS_Level3 
PWS_Level4 

Definition at line 299 of file PPCallbacks.h.

Constructor & Destructor Documentation

◆ ~PPCallbacks()

PPCallbacks::~PPCallbacks ( )
virtualdefault

Member Function Documentation

◆ Defined()

virtual void clang::PPCallbacks::Defined ( const Token & MacroNameTok,
const MacroDefinition & MD,
SourceRange Range )
inlinevirtual

Hook called whenever the 'defined' operator is seen.

Parameters
MDThe MacroDirective if the name was a macro, null otherwise.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 362 of file PPCallbacks.h.

◆ Elif()

virtual void clang::PPCallbacks::Elif ( SourceLocation Loc,
SourceRange ConditionRange,
ConditionValueKind ConditionValue,
SourceLocation IfLoc )
inlinevirtual

Hook called whenever an #elif is seen.

Parameters
Locthe source location of the directive.
ConditionRangeThe SourceRange of the expression being tested.
ConditionValueThe evaluated value of the condition.
IfLocthe source location of the #if/#ifdef/#ifndef directive.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 405 of file PPCallbacks.h.

◆ Elifdef() [1/2]

virtual void clang::PPCallbacks::Elifdef ( SourceLocation Loc,
const Token & MacroNameTok,
const MacroDefinition & MD )
inlinevirtual

Hook called whenever an #elifdef branch is taken.

Parameters
Locthe source location of the directive.
MacroNameTokInformation on the token being tested.
MDThe MacroDefinition if the name was a macro, null otherwise.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 421 of file PPCallbacks.h.

Referenced by clang::PreprocessingRecord::ASTWriter.

◆ Elifdef() [2/2]

virtual void clang::PPCallbacks::Elifdef ( SourceLocation Loc,
SourceRange ConditionRange,
SourceLocation IfLoc )
inlinevirtual

Hook called whenever an #elifdef is skipped.

Parameters
Locthe source location of the directive.
ConditionRangeThe SourceRange of the expression being tested.
IfLocthe source location of the #if/#ifdef/#ifndef directive.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 429 of file PPCallbacks.h.

◆ Elifndef() [1/2]

virtual void clang::PPCallbacks::Elifndef ( SourceLocation Loc,
const Token & MacroNameTok,
const MacroDefinition & MD )
inlinevirtual

Hook called whenever an #elifndef branch is taken.

Parameters
Locthe source location of the directive.
MacroNameTokInformation on the token being tested.
MDThe MacroDefinition if the name was a macro, null otherwise.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 445 of file PPCallbacks.h.

Referenced by clang::PreprocessingRecord::ASTWriter.

◆ Elifndef() [2/2]

virtual void clang::PPCallbacks::Elifndef ( SourceLocation Loc,
SourceRange ConditionRange,
SourceLocation IfLoc )
inlinevirtual

Hook called whenever an #elifndef is skipped.

Parameters
Locthe source location of the directive.
ConditionRangeThe SourceRange of the expression being tested.
IfLocthe source location of the #if/#ifdef/#ifndef directive.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 453 of file PPCallbacks.h.

◆ Else()

virtual void clang::PPCallbacks::Else ( SourceLocation Loc,
SourceLocation IfLoc )
inlinevirtual

Hook called whenever an #else is seen.

Parameters
Locthe source location of the directive.
IfLocthe source location of the #if/#ifdef/#ifndef directive.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 460 of file PPCallbacks.h.

◆ EmbedDirective()

virtual void clang::PPCallbacks::EmbedDirective ( SourceLocation HashLoc,
StringRef FileName,
bool IsAngled,
OptionalFileEntryRef File,
const LexEmbedParametersResult & Params )
inlinevirtual

Callback invoked whenever an embed directive has been processed, regardless of whether the embed will actually find a file.

Parameters
HashLocThe location of the '#' that starts the embed directive.
FileNameThe name of the file being included, as written in the source code.
IsAngledWhether the file name was enclosed in angle brackets; otherwise, it was enclosed in quotes.
FileThe actual file that may be included by this embed directive.
ParamsThe parameters used by the directive.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 112 of file PPCallbacks.h.

References clang::File, and clang::FileName.

◆ EmbedFileNotFound()

virtual bool clang::PPCallbacks::EmbedFileNotFound ( StringRef FileName)
inlinevirtual

Callback invoked whenever the preprocessor cannot find a file for an embed directive.

Parameters
FileNameThe name of the file being included, as written in the source code.
Returns
true to indicate that the preprocessor should skip this file and not issue any diagnostic.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 96 of file PPCallbacks.h.

References clang::FileName.

◆ Endif()

virtual void clang::PPCallbacks::Endif ( SourceLocation Loc,
SourceLocation IfLoc )
inlinevirtual

Hook called whenever an #endif is seen.

Parameters
Locthe source location of the directive.
IfLocthe source location of the #if/#ifdef/#ifndef directive.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 466 of file PPCallbacks.h.

◆ EndOfMainFile()

virtual void clang::PPCallbacks::EndOfMainFile ( )
inlinevirtual

Callback invoked when the end of the main file is reached.

No subsequent callbacks will be made.

Reimplemented in clang::NoTrivialPPDirectiveTracer, clang::PPChainedCallbacks, and clang::tooling::dependencies::ModuleDepCollectorPP.

Definition at line 218 of file PPCallbacks.h.

◆ EnteredSubmodule()

virtual void clang::PPCallbacks::EnteredSubmodule ( Module * M,
SourceLocation ImportLoc,
bool ForPragma )
inlinevirtual

Callback invoked whenever a submodule was entered.

Parameters
MThe submodule we have entered.
ImportLocThe location of import directive token.
ForPragmaIf entering from pragma directive.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 186 of file PPCallbacks.h.

◆ FileChanged()

virtual void clang::PPCallbacks::FileChanged ( SourceLocation Loc,
FileChangeReason Reason,
SrcMgr::CharacteristicKind FileType,
FileID PrevFID = FileID() )
inlinevirtual

Callback invoked whenever a source file is entered or exited.

Parameters
LocIndicates the new location.
PrevFIDthe file that was exited if Reason is ExitFile or the the file before the new one entered for Reason EnterFile.

Reimplemented in clang::MacroPPCallbacks, clang::PPChainedCallbacks, and clang::sema::SemaPPCallbacks.

Definition at line 50 of file PPCallbacks.h.

◆ FileNotFound()

virtual bool clang::PPCallbacks::FileNotFound ( StringRef FileName)
inlinevirtual

Callback invoked whenever the preprocessor cannot find a file for an inclusion directive.

Parameters
FileNameThe name of the file being included, as written in the source code.
Returns
true to indicate that the preprocessor should skip this file and not issue any diagnostic.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 124 of file PPCallbacks.h.

References clang::FileName.

◆ FileSkipped()

virtual void clang::PPCallbacks::FileSkipped ( const FileEntryRef & SkippedFile,
const Token & FilenameTok,
SrcMgr::CharacteristicKind FileType )
inlinevirtual

Callback invoked whenever a source file is skipped as the result of header guard optimization.

Parameters
SkippedFileThe file that is skipped instead of entering #include
FilenameTokThe file name token in #include "FileName" directive or macro expanded file name token from #include MACRO(PARAMS) directive. Note that FilenameTok contains corresponding quotes/angles symbols.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 84 of file PPCallbacks.h.

◆ HasEmbed()

virtual void clang::PPCallbacks::HasEmbed ( SourceLocation Loc,
StringRef FileName,
bool IsAngled,
OptionalFileEntryRef File )
inlinevirtual

Hook called when a '__has_embed' directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 367 of file PPCallbacks.h.

References clang::File, and clang::FileName.

◆ HasInclude()

void PPCallbacks::HasInclude ( SourceLocation Loc,
StringRef FileName,
bool IsAngled,
OptionalFileEntryRef File,
SrcMgr::CharacteristicKind FileType )
virtual

Hook called when a '__has_include' or '__has_include_next' directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 16 of file PPCallbacks.cpp.

References clang::File, and clang::FileName.

◆ Ident()

virtual void clang::PPCallbacks::Ident ( SourceLocation Loc,
StringRef str )
inlinevirtual

Callback invoked when a #ident or #sccs directive is read.

Parameters
LocThe location of the directive.
strThe text of the directive.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 225 of file PPCallbacks.h.

◆ If()

virtual void clang::PPCallbacks::If ( SourceLocation Loc,
SourceRange ConditionRange,
ConditionValueKind ConditionValue )
inlinevirtual

Hook called whenever an #if is seen.

Parameters
Locthe source location of the directive.
ConditionRangeThe SourceRange of the expression being tested.
ConditionValueThe evaluated value of the condition.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 395 of file PPCallbacks.h.

◆ Ifdef()

virtual void clang::PPCallbacks::Ifdef ( SourceLocation Loc,
const Token & MacroNameTok,
const MacroDefinition & MD )
inlinevirtual

Hook called whenever an #ifdef is seen.

Parameters
Locthe source location of the directive.
MacroNameTokInformation on the token being tested.
MDThe MacroDefinition if the name was a macro, null otherwise.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 413 of file PPCallbacks.h.

◆ Ifndef()

virtual void clang::PPCallbacks::Ifndef ( SourceLocation Loc,
const Token & MacroNameTok,
const MacroDefinition & MD )
inlinevirtual

Hook called whenever an #ifndef is seen.

Parameters
Locthe source location of the directive.
MacroNameTokInformation on the token being tested.
MDThe MacroDefiniton if the name was a macro, null otherwise.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 437 of file PPCallbacks.h.

◆ InclusionDirective()

virtual void clang::PPCallbacks::InclusionDirective ( SourceLocation HashLoc,
const Token & IncludeTok,
StringRef FileName,
bool IsAngled,
CharSourceRange FilenameRange,
OptionalFileEntryRef File,
StringRef SearchPath,
StringRef RelativePath,
const Module * SuggestedModule,
bool ModuleImported,
SrcMgr::CharacteristicKind FileType )
inlinevirtual

Callback invoked whenever an inclusion directive of any kind (#include, #import, etc.) has been processed, regardless of whether the inclusion will actually result in an inclusion.

Parameters
HashLocThe location of the '#' that starts the inclusion directive.
IncludeTokThe token that indicates the kind of inclusion directive, e.g., 'include' or 'import'.
FileNameThe name of the file being included, as written in the source code.
IsAngledWhether the file name was enclosed in angle brackets; otherwise, it was enclosed in quotes.
FilenameRangeThe character range of the quotes or angle brackets for the written file name.
FileThe actual file that may be included by this inclusion directive.
SearchPathContains the search path which was used to find the file in the file system. If the file was found via an absolute include path, SearchPath will be empty. For framework includes, the SearchPath and RelativePath will be split up. For example, if an include of "Some/Some.h" is found via the framework path "path/to/Frameworks/Some.framework/Headers/Some.h", SearchPath will be "path/to/Frameworks/Some.framework/Headers" and RelativePath will be "Some.h".
RelativePathThe path relative to SearchPath, at which the include file was found. This is equal to FileName except for framework includes.
SuggestedModuleThe module suggested for this header, if any.
ModuleImportedWhether this include was translated into import of SuggestedModule.
FileTypeThe characteristic kind, indicates whether a file or directory holds normal user code, system code, or system code which is implicitly 'extern "C"' in C++ mode.

Reimplemented in clang::MacroPPCallbacks, clang::NoTrivialPPDirectiveTracer, clang::PPChainedCallbacks, and clang::tooling::dependencies::ModuleDepCollectorPP.

Definition at line 169 of file PPCallbacks.h.

References clang::File, and clang::FileName.

◆ LeftSubmodule()

virtual void clang::PPCallbacks::LeftSubmodule ( Module * M,
SourceLocation ImportLoc,
bool ForPragma )
inlinevirtual

Callback invoked whenever a submodule was left.

Parameters
MThe submodule we have left.
ImportLocThe location of import directive token.
ForPragmaIf entering from pragma directive.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 197 of file PPCallbacks.h.

◆ LexedFileChanged()

virtual void clang::PPCallbacks::LexedFileChanged ( FileID FID,
LexedFileChangeReason Reason,
SrcMgr::CharacteristicKind FileType,
FileID PrevFID,
SourceLocation Loc )
inlinevirtual

Callback invoked whenever the Lexer moves to a different file for lexing.

Unlike FileChanged line number directives and other related pragmas do not trigger callbacks to LexedFileChanged.

Parameters
FIDThe FileID that the Lexer moved to.
ReasonWhether the Lexer entered a new file or exited one.
FileTypeThe CharacteristicKind of the file the Lexer moved to.
PrevFIDThe FileID the Lexer was using before the change.
LocThe location where the Lexer entered a new file from or the location that the Lexer moved into after exiting a file.

Reimplemented in clang::NoTrivialPPDirectiveTracer, clang::PPChainedCallbacks, and clang::tooling::dependencies::ModuleDepCollectorPP.

Definition at line 72 of file PPCallbacks.h.

◆ MacroDefined()

virtual void clang::PPCallbacks::MacroDefined ( const Token & MacroNameTok,
const MacroDirective * MD )
inlinevirtual

Hook called whenever a macro definition is seen.

Reimplemented in clang::MacroPPCallbacks, clang::NoTrivialPPDirectiveTracer, clang::PPChainedCallbacks, and InjectRootSignatureCallback.

Definition at line 345 of file PPCallbacks.h.

◆ MacroExpands()

virtual void clang::PPCallbacks::MacroExpands ( const Token & MacroNameTok,
const MacroDefinition & MD,
SourceRange Range,
const MacroArgs * Args )
inlinevirtual

Called by Preprocessor::HandleMacroExpandedIdentifier when a macro invocation is found.

Reimplemented in clang::detail::MacroExpansionRangeRecorder, clang::NoTrivialPPDirectiveTracer, clang::PPChainedCallbacks, and TokenCollector::CollectPPExpansions.

Definition at line 340 of file PPCallbacks.h.

◆ MacroUndefined()

virtual void clang::PPCallbacks::MacroUndefined ( const Token & MacroNameTok,
const MacroDefinition & MD,
const MacroDirective * Undef )
inlinevirtual

Hook called whenever a macro #undef is seen.

Parameters
MacroNameTokThe active Token
MDA MacroDefinition for the named macro.
UndefNew MacroDirective if the macro was defined, null otherwise.

MD is released immediately following this callback.

Reimplemented in clang::MacroPPCallbacks, clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 355 of file PPCallbacks.h.

◆ moduleImport()

virtual void clang::PPCallbacks::moduleImport ( SourceLocation ImportLoc,
ModuleIdPath Path,
const Module * Imported )
inlinevirtual

Callback invoked whenever there was an explicit module-import syntax.

Parameters
ImportLocThe location of import directive token.
PathThe identifiers (and their locations) of the module "path", e.g., "std.vector" would be split into "std" and "vector".
ImportedThe imported module; can be null if importing failed.

Reimplemented in clang::NoTrivialPPDirectiveTracer, clang::PPChainedCallbacks, and clang::tooling::dependencies::ModuleDepCollectorPP.

Definition at line 210 of file PPCallbacks.h.

◆ PragmaAssumeNonNullBegin()

virtual void clang::PPCallbacks::PragmaAssumeNonNullBegin ( SourceLocation Loc)
inlinevirtual

Callback invoked when a #pragma clang assume_nonnull begin directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 332 of file PPCallbacks.h.

◆ PragmaAssumeNonNullEnd()

virtual void clang::PPCallbacks::PragmaAssumeNonNullEnd ( SourceLocation Loc)
inlinevirtual

Callback invoked when a #pragma clang assume_nonnull end directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 336 of file PPCallbacks.h.

◆ PragmaComment()

virtual void clang::PPCallbacks::PragmaComment ( SourceLocation Loc,
const IdentifierInfo * Kind,
StringRef Str )
inlinevirtual

Callback invoked when a #pragma comment directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 234 of file PPCallbacks.h.

◆ PragmaDebug()

virtual void clang::PPCallbacks::PragmaDebug ( SourceLocation Loc,
StringRef DebugType )
inlinevirtual

Callback invoked when a #pragma clang __debug directive is read.

Parameters
LocThe location of the debug directive.
DebugTypeThe identifier following __debug.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 251 of file PPCallbacks.h.

◆ PragmaDetectMismatch()

virtual void clang::PPCallbacks::PragmaDetectMismatch ( SourceLocation Loc,
StringRef Name,
StringRef Value )
inlinevirtual

Callback invoked when a #pragma detect_mismatch directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 244 of file PPCallbacks.h.

◆ PragmaDiagnostic()

virtual void clang::PPCallbacks::PragmaDiagnostic ( SourceLocation Loc,
StringRef Namespace,
diag::Severity mapping,
StringRef Str )
inlinevirtual

Callback invoked when a #pragma gcc diagnostic directive is read.

Reimplemented in clang::PPChainedCallbacks, and clang::sema::SemaPPCallbacks.

Definition at line 288 of file PPCallbacks.h.

◆ PragmaDiagnosticPop()

virtual void clang::PPCallbacks::PragmaDiagnosticPop ( SourceLocation Loc,
StringRef Namespace )
inlinevirtual

Callback invoked when a #pragma gcc diagnostic pop directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 283 of file PPCallbacks.h.

◆ PragmaDiagnosticPush()

virtual void clang::PPCallbacks::PragmaDiagnosticPush ( SourceLocation Loc,
StringRef Namespace )
inlinevirtual

Callback invoked when a #pragma gcc diagnostic push directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 277 of file PPCallbacks.h.

◆ PragmaDirective()

virtual void clang::PPCallbacks::PragmaDirective ( SourceLocation Loc,
PragmaIntroducerKind Introducer )
inlinevirtual

Callback invoked when start reading any pragma directive.

Reimplemented in clang::NoTrivialPPDirectiveTracer, and clang::PPChainedCallbacks.

Definition at line 229 of file PPCallbacks.h.

◆ PragmaExecCharsetPop()

virtual void clang::PPCallbacks::PragmaExecCharsetPop ( SourceLocation Loc)
inlinevirtual

Callback invoked when a #pragma execution_character_set(pop) directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 328 of file PPCallbacks.h.

◆ PragmaExecCharsetPush()

virtual void clang::PPCallbacks::PragmaExecCharsetPush ( SourceLocation Loc,
StringRef Str )
inlinevirtual

Callback invoked when a #pragma execution_character_set(push) directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 324 of file PPCallbacks.h.

◆ PragmaMark()

virtual void clang::PPCallbacks::PragmaMark ( SourceLocation Loc,
StringRef Trivia )
inlinevirtual

Callback invoked when a #pragma mark comment is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 239 of file PPCallbacks.h.

◆ PragmaMessage()

virtual void clang::PPCallbacks::PragmaMessage ( SourceLocation Loc,
StringRef Namespace,
PragmaMessageKind Kind,
StringRef Str )
inlinevirtual

Callback invoked when a #pragma message directive is read.

Parameters
LocThe location of the message directive.
NamespaceThe namespace of the message directive.
KindThe type of the message directive.
StrThe text of the message directive.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 271 of file PPCallbacks.h.

◆ PragmaOpenCLExtension()

virtual void clang::PPCallbacks::PragmaOpenCLExtension ( SourceLocation NameLoc,
const IdentifierInfo * Name,
SourceLocation StateLoc,
unsigned State )
inlinevirtual

Called when an OpenCL extension is either disabled or enabled with a pragma.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 293 of file PPCallbacks.h.

◆ PragmaWarning()

virtual void clang::PPCallbacks::PragmaWarning ( SourceLocation Loc,
PragmaWarningSpecifier WarningSpec,
ArrayRef< int > Ids )
inlinevirtual

Reimplemented in clang::PPChainedCallbacks.

Definition at line 310 of file PPCallbacks.h.

◆ PragmaWarningPop()

virtual void clang::PPCallbacks::PragmaWarningPop ( SourceLocation Loc)
inlinevirtual

Callback invoked when a #pragma warning(pop) directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 319 of file PPCallbacks.h.

◆ PragmaWarningPush()

virtual void clang::PPCallbacks::PragmaWarningPush ( SourceLocation Loc,
int Level )
inlinevirtual

Callback invoked when a #pragma warning(push) directive is read.

Reimplemented in clang::PPChainedCallbacks.

Definition at line 315 of file PPCallbacks.h.

◆ SourceRangeSkipped()

virtual void clang::PPCallbacks::SourceRangeSkipped ( SourceRange Range,
SourceLocation EndifLoc )
inlinevirtual

Hook called when a source range is skipped.

Parameters
RangeThe SourceRange that was skipped. The range begins at the #if/#else directive and ends after the #endif/#else directive.
EndifLocThe end location of the 'endif' token, which may precede the range skipped by the directive (e.g excluding comments after an 'endif').

Reimplemented in clang::CoverageSourceInfo, and clang::PPChainedCallbacks.

Definition at line 382 of file PPCallbacks.h.


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