clang API Documentation

Public Member Functions
clang::PPChainedCallbacks Class Reference

Simple wrapper class for chaining callbacks. More...

#include <PPCallbacks.h>

Inheritance diagram for clang::PPChainedCallbacks:
Inheritance graph
[legend]
Collaboration diagram for clang::PPChainedCallbacks:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PPChainedCallbacks (std::unique_ptr< PPCallbacks > _First, std::unique_ptr< PPCallbacks > _Second)
void FileChanged (SourceLocation Loc, FileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID) override
 Callback invoked whenever a source file is entered or exited.
void FileSkipped (const FileEntry &ParentFile, const Token &FilenameTok, SrcMgr::CharacteristicKind FileType) override
 Callback invoked whenever a source file is skipped as the result of header guard optimization.
bool FileNotFound (StringRef FileName, SmallVectorImpl< char > &RecoveryPath) override
 Callback invoked whenever an inclusion directive results in a file-not-found error.
void InclusionDirective (SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, const FileEntry *File, StringRef SearchPath, StringRef RelativePath, const Module *Imported) override
 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.
void moduleImport (SourceLocation ImportLoc, ModuleIdPath Path, const Module *Imported) override
 Callback invoked whenever there was an explicit module-import syntax.
void EndOfMainFile () override
 Callback invoked when the end of the main file is reached.
void Ident (SourceLocation Loc, const std::string &str) override
 Callback invoked when a #ident or #sccs directive is read.
void PragmaComment (SourceLocation Loc, const IdentifierInfo *Kind, const std::string &Str) override
 Callback invoked when a #pragma comment directive is read.
void PragmaDetectMismatch (SourceLocation Loc, const std::string &Name, const std::string &Value) override
 Callback invoked when a #pragma detect_mismatch directive is read.
void PragmaMessage (SourceLocation Loc, StringRef Namespace, PragmaMessageKind Kind, StringRef Str) override
 Callback invoked when a #pragma message directive is read.
void PragmaDiagnosticPush (SourceLocation Loc, StringRef Namespace) override
 Callback invoked when a #pragma gcc dianostic push directive is read.
void PragmaDiagnosticPop (SourceLocation Loc, StringRef Namespace) override
 Callback invoked when a #pragma gcc dianostic pop directive is read.
void PragmaDiagnostic (SourceLocation Loc, StringRef Namespace, diag::Severity mapping, StringRef Str) override
 Callback invoked when a #pragma gcc dianostic directive is read.
void PragmaOpenCLExtension (SourceLocation NameLoc, const IdentifierInfo *Name, SourceLocation StateLoc, unsigned State) override
 Called when an OpenCL extension is either disabled or enabled with a pragma.
void PragmaWarning (SourceLocation Loc, StringRef WarningSpec, ArrayRef< int > Ids) override
 Callback invoked when a #pragma warning directive is read.
void PragmaWarningPush (SourceLocation Loc, int Level) override
 Callback invoked when a #pragma warning(push) directive is read.
void PragmaWarningPop (SourceLocation Loc) override
 Callback invoked when a #pragma warning(pop) directive is read.
void MacroExpands (const Token &MacroNameTok, const MacroDirective *MD, SourceRange Range, const MacroArgs *Args) override
 Called by Preprocessor::HandleMacroExpandedIdentifier when a macro invocation is found.
void MacroDefined (const Token &MacroNameTok, const MacroDirective *MD) override
 Hook called whenever a macro definition is seen.
void MacroUndefined (const Token &MacroNameTok, const MacroDirective *MD) override
 Hook called whenever a macro #undef is seen.
void Defined (const Token &MacroNameTok, const MacroDirective *MD, SourceRange Range) override
 Hook called whenever the 'defined' operator is seen.
void SourceRangeSkipped (SourceRange Range) override
 Hook called when a source range is skipped.
void If (SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue) override
 Hook called whenever an #if is seen.
void Elif (SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue, SourceLocation IfLoc) override
 Hook called whenever an #elif is seen.
void Ifdef (SourceLocation Loc, const Token &MacroNameTok, const MacroDirective *MD) override
 Hook called whenever an #ifdef is seen.
void Ifndef (SourceLocation Loc, const Token &MacroNameTok, const MacroDirective *MD) override
 Hook called whenever an #ifndef is seen.
void Else (SourceLocation Loc, SourceLocation IfLoc) override
 Hook called whenever an #else is seen.
void Endif (SourceLocation Loc, SourceLocation IfLoc) override
 Hook called whenever an #endif is seen.

Detailed Description

Simple wrapper class for chaining callbacks.

Definition at line 323 of file PPCallbacks.h.


Constructor & Destructor Documentation

clang::PPChainedCallbacks::PPChainedCallbacks ( std::unique_ptr< PPCallbacks _First,
std::unique_ptr< PPCallbacks _Second 
) [inline]

Definition at line 328 of file PPCallbacks.h.


Member Function Documentation

void clang::PPChainedCallbacks::Defined ( const Token MacroNameTok,
const MacroDirective MD,
SourceRange  Range 
) [inline, override, virtual]

Hook called whenever the 'defined' operator is seen.

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

Reimplemented from clang::PPCallbacks.

Definition at line 454 of file PPCallbacks.h.

void clang::PPChainedCallbacks::Elif ( SourceLocation  Loc,
SourceRange  ConditionRange,
ConditionValueKind  ConditionValue,
SourceLocation  IfLoc 
) [inline, override, virtual]

Hook called whenever an #elif is seen.

Reimplemented from clang::PPCallbacks.

Definition at line 473 of file PPCallbacks.h.

void clang::PPChainedCallbacks::Else ( SourceLocation  Loc,
SourceLocation  IfLoc 
) [inline, override, virtual]

Hook called whenever an #else is seen.

Reimplemented from clang::PPCallbacks.

Definition at line 494 of file PPCallbacks.h.

void clang::PPChainedCallbacks::Endif ( SourceLocation  Loc,
SourceLocation  IfLoc 
) [inline, override, virtual]

Hook called whenever an #endif is seen.

Reimplemented from clang::PPCallbacks.

Definition at line 500 of file PPCallbacks.h.

void clang::PPChainedCallbacks::EndOfMainFile ( ) [inline, override, virtual]

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

No subsequent callbacks will be made.

Reimplemented from clang::PPCallbacks.

Definition at line 371 of file PPCallbacks.h.

void clang::PPChainedCallbacks::FileChanged ( SourceLocation  Loc,
FileChangeReason  Reason,
SrcMgr::CharacteristicKind  FileType,
FileID  PrevFID 
) [inline, override, virtual]

Callback invoked whenever a source file is entered or exited.

Parameters:
LocIndicates the new location.
PrevFIDthe file that was exited if Reason is ExitFile.

Reimplemented from clang::PPCallbacks.

Definition at line 332 of file PPCallbacks.h.

bool clang::PPChainedCallbacks::FileNotFound ( StringRef  FileName,
SmallVectorImpl< char > &  RecoveryPath 
) [inline, override, virtual]

Callback invoked whenever an inclusion directive results in a file-not-found error.

Parameters:
FileNameThe name of the file being included, as written in the source code.
RecoveryPathIf this client indicates that it can recover from this missing file, the client should set this as an additional header search patch.
Returns:
true to indicate that the preprocessor should attempt to recover by adding RecoveryPath as a header search path.

Reimplemented from clang::PPCallbacks.

Definition at line 346 of file PPCallbacks.h.

void clang::PPChainedCallbacks::FileSkipped ( const FileEntry ParentFile,
const Token FilenameTok,
SrcMgr::CharacteristicKind  FileType 
) [inline, override, virtual]

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

Parameters:
ParentFileThe file that #included the skipped file.
FilenameTokThe token in ParentFile that indicates the skipped file.

Reimplemented from clang::PPCallbacks.

Definition at line 339 of file PPCallbacks.h.

void clang::PPChainedCallbacks::Ident ( SourceLocation  Loc,
const std::string &  str 
) [inline, override, virtual]

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

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

Reimplemented from clang::PPCallbacks.

Definition at line 376 of file PPCallbacks.h.

void clang::PPChainedCallbacks::If ( SourceLocation  Loc,
SourceRange  ConditionRange,
ConditionValueKind  ConditionValue 
) [inline, override, virtual]

Hook called whenever an #if is seen.

Reimplemented from clang::PPCallbacks.

Definition at line 466 of file PPCallbacks.h.

void clang::PPChainedCallbacks::Ifdef ( SourceLocation  Loc,
const Token MacroNameTok,
const MacroDirective MD 
) [inline, override, virtual]

Hook called whenever an #ifdef is seen.

Reimplemented from clang::PPCallbacks.

Definition at line 480 of file PPCallbacks.h.

void clang::PPChainedCallbacks::Ifndef ( SourceLocation  Loc,
const Token MacroNameTok,
const MacroDirective MD 
) [inline, override, virtual]

Hook called whenever an #ifndef is seen.

Reimplemented from clang::PPCallbacks.

Definition at line 487 of file PPCallbacks.h.

void clang::PPChainedCallbacks::InclusionDirective ( SourceLocation  HashLoc,
const Token IncludeTok,
StringRef  FileName,
bool  IsAngled,
CharSourceRange  FilenameRange,
const FileEntry File,
StringRef  SearchPath,
StringRef  RelativePath,
const Module Imported 
) [inline, override, virtual]

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.
ImportedThe module, whenever an inclusion directive was automatically turned into a module import or null otherwise.

Reimplemented from clang::PPCallbacks.

Definition at line 352 of file PPCallbacks.h.

void clang::PPChainedCallbacks::MacroDefined ( const Token MacroNameTok,
const MacroDirective MD 
) [inline, override, virtual]

Hook called whenever a macro definition is seen.

Reimplemented from clang::PPCallbacks.

Definition at line 443 of file PPCallbacks.h.

void clang::PPChainedCallbacks::MacroExpands ( const Token MacroNameTok,
const MacroDirective MD,
SourceRange  Range,
const MacroArgs Args 
) [inline, override, virtual]

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

Reimplemented from clang::PPCallbacks.

Definition at line 437 of file PPCallbacks.h.

void clang::PPChainedCallbacks::MacroUndefined ( const Token MacroNameTok,
const MacroDirective MD 
) [inline, override, virtual]

Hook called whenever a macro #undef is seen.

MD is released immediately following this callback.

Reimplemented from clang::PPCallbacks.

Definition at line 448 of file PPCallbacks.h.

void clang::PPChainedCallbacks::moduleImport ( SourceLocation  ImportLoc,
ModuleIdPath  Path,
const Module Imported 
) [inline, override, virtual]

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 from clang::PPCallbacks.

Definition at line 365 of file PPCallbacks.h.

void clang::PPChainedCallbacks::PragmaComment ( SourceLocation  Loc,
const IdentifierInfo Kind,
const std::string &  Str 
) [inline, override, virtual]

Callback invoked when a #pragma comment directive is read.

Reimplemented from clang::PPCallbacks.

Definition at line 381 of file PPCallbacks.h.

void clang::PPChainedCallbacks::PragmaDetectMismatch ( SourceLocation  Loc,
const std::string &  Name,
const std::string &  Value 
) [inline, override, virtual]

Callback invoked when a #pragma detect_mismatch directive is read.

Reimplemented from clang::PPCallbacks.

Definition at line 387 of file PPCallbacks.h.

void clang::PPChainedCallbacks::PragmaDiagnostic ( SourceLocation  Loc,
StringRef  Namespace,
diag::Severity  mapping,
StringRef  Str 
) [inline, override, virtual]

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

Reimplemented from clang::PPCallbacks.

Definition at line 409 of file PPCallbacks.h.

void clang::PPChainedCallbacks::PragmaDiagnosticPop ( SourceLocation  Loc,
StringRef  Namespace 
) [inline, override, virtual]

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

Reimplemented from clang::PPCallbacks.

Definition at line 404 of file PPCallbacks.h.

void clang::PPChainedCallbacks::PragmaDiagnosticPush ( SourceLocation  Loc,
StringRef  Namespace 
) [inline, override, virtual]

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

Reimplemented from clang::PPCallbacks.

Definition at line 399 of file PPCallbacks.h.

void clang::PPChainedCallbacks::PragmaMessage ( SourceLocation  Loc,
StringRef  Namespace,
PragmaMessageKind  Kind,
StringRef  Str 
) [inline, override, virtual]

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 from clang::PPCallbacks.

Definition at line 393 of file PPCallbacks.h.

void clang::PPChainedCallbacks::PragmaOpenCLExtension ( SourceLocation  NameLoc,
const IdentifierInfo Name,
SourceLocation  StateLoc,
unsigned  State 
) [inline, override, virtual]

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

Reimplemented from clang::PPCallbacks.

Definition at line 415 of file PPCallbacks.h.

void clang::PPChainedCallbacks::PragmaWarning ( SourceLocation  Loc,
StringRef  WarningSpec,
ArrayRef< int >  Ids 
) [inline, override, virtual]

Callback invoked when a #pragma warning directive is read.

Reimplemented from clang::PPCallbacks.

Definition at line 421 of file PPCallbacks.h.

void clang::PPChainedCallbacks::PragmaWarningPop ( SourceLocation  Loc) [inline, override, virtual]

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

Reimplemented from clang::PPCallbacks.

Definition at line 432 of file PPCallbacks.h.

void clang::PPChainedCallbacks::PragmaWarningPush ( SourceLocation  Loc,
int  Level 
) [inline, override, virtual]

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

Reimplemented from clang::PPCallbacks.

Definition at line 427 of file PPCallbacks.h.

void clang::PPChainedCallbacks::SourceRangeSkipped ( SourceRange  Range) [inline, override, virtual]

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.

Reimplemented from clang::PPCallbacks.

Definition at line 460 of file PPCallbacks.h.


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