clang-tools 17.0.0git
|
This class overrides the PPCallbacks class for tracking preprocessor activity by means of its callback functions. More...
#include <PPCallbacksTracker.h>
Public Member Functions | |
PPCallbacksTracker (const FilterType &Filters, std::vector< CallbackCall > &CallbackCalls, Preprocessor &PP) | |
Note that all of the arguments are references, and owned by the caller. | |
~PPCallbacksTracker () override | |
void | FileChanged (SourceLocation Loc, PPCallbacks::FileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID=FileID()) override |
void | FileSkipped (const FileEntryRef &SkippedFile, const Token &FilenameTok, SrcMgr::CharacteristicKind FileType) override |
void | InclusionDirective (SourceLocation HashLoc, const Token &IncludeTok, llvm::StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File, llvm::StringRef SearchPath, llvm::StringRef RelativePath, const Module *Imported, SrcMgr::CharacteristicKind FileType) override |
void | moduleImport (SourceLocation ImportLoc, ModuleIdPath Path, const Module *Imported) override |
void | EndOfMainFile () override |
void | Ident (SourceLocation Loc, llvm::StringRef str) override |
void | PragmaDirective (SourceLocation Loc, PragmaIntroducerKind Introducer) override |
void | PragmaComment (SourceLocation Loc, const IdentifierInfo *Kind, llvm::StringRef Str) override |
void | PragmaDetectMismatch (SourceLocation Loc, llvm::StringRef Name, llvm::StringRef Value) override |
void | PragmaDebug (SourceLocation Loc, llvm::StringRef DebugType) override |
void | PragmaMessage (SourceLocation Loc, llvm::StringRef Namespace, PPCallbacks::PragmaMessageKind Kind, llvm::StringRef Str) override |
void | PragmaDiagnosticPush (SourceLocation Loc, llvm::StringRef Namespace) override |
void | PragmaDiagnosticPop (SourceLocation Loc, llvm::StringRef Namespace) override |
void | PragmaDiagnostic (SourceLocation Loc, llvm::StringRef Namespace, diag::Severity mapping, llvm::StringRef Str) override |
void | PragmaOpenCLExtension (SourceLocation NameLoc, const IdentifierInfo *Name, SourceLocation StateLoc, unsigned State) override |
void | PragmaWarning (SourceLocation Loc, PragmaWarningSpecifier WarningSpec, llvm::ArrayRef< int > Ids) override |
void | PragmaWarningPush (SourceLocation Loc, int Level) override |
void | PragmaWarningPop (SourceLocation Loc) override |
void | PragmaExecCharsetPush (SourceLocation Loc, StringRef Str) override |
void | PragmaExecCharsetPop (SourceLocation Loc) override |
void | MacroExpands (const Token &MacroNameTok, const MacroDefinition &MD, SourceRange Range, const MacroArgs *Args) override |
void | MacroDefined (const Token &MacroNameTok, const MacroDirective *MD) override |
void | MacroUndefined (const Token &MacroNameTok, const MacroDefinition &MD, const MacroDirective *Undef) override |
void | Defined (const Token &MacroNameTok, const MacroDefinition &MD, SourceRange Range) override |
void | SourceRangeSkipped (SourceRange Range, SourceLocation EndifLoc) override |
void | If (SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue) override |
void | Elif (SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue, SourceLocation IfLoc) override |
void | Ifdef (SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD) override |
void | Ifndef (SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD) override |
void | Else (SourceLocation Loc, SourceLocation IfLoc) override |
void | Endif (SourceLocation Loc, SourceLocation IfLoc) override |
void | beginCallback (const char *Name) |
Start a new callback. | |
void | append (const char *Str) |
Append a string to the top trace item. | |
void | appendArgument (const char *Name, bool Value) |
Append a bool argument to the top trace item. | |
void | appendArgument (const char *Name, int Value) |
Append an int argument to the top trace item. | |
void | appendArgument (const char *Name, const char *Value) |
Append a string argument to the top trace item. | |
void | appendArgument (const char *Name, llvm::StringRef Value) |
Append a string reference object argument to the top trace item. | |
void | appendArgument (const char *Name, const std::string &Value) |
Append a string object argument to the top trace item. | |
void | appendArgument (const char *Name, const Token &Value) |
Append a token argument to the top trace item. | |
void | appendArgument (const char *Name, int Value, const char *const Strings[]) |
Append an enum argument to the top trace item. | |
void | appendArgument (const char *Name, FileID Value) |
Append a FileID argument to the top trace item. | |
void | appendArgument (const char *Name, OptionalFileEntryRef Value) |
Append a FileEntryRef argument to the top trace item. | |
void | appendArgument (const char *Name, FileEntryRef Value) |
void | appendArgument (const char *Name, SourceLocation Value) |
Append a SourceLocation argument to the top trace item. | |
void | appendArgument (const char *Name, SourceRange Value) |
Append a SourceRange argument to the top trace item. | |
void | appendArgument (const char *Name, CharSourceRange Value) |
Append a CharSourceRange argument to the top trace item. | |
void | appendArgument (const char *Name, ModuleIdPath Value) |
Append a ModuleIdPath argument to the top trace item. | |
void | appendArgument (const char *Name, const IdentifierInfo *Value) |
Append an IdentifierInfo argument to the top trace item. | |
void | appendArgument (const char *Name, const MacroDirective *Value) |
Append a MacroDirective argument to the top trace item. | |
void | appendArgument (const char *Name, const MacroDefinition &Value) |
Append a MacroDefinition argument to the top trace item. | |
void | appendArgument (const char *Name, const MacroArgs *Value) |
Append a MacroArgs argument to the top trace item. | |
void | appendArgument (const char *Name, const Module *Value) |
Append a Module argument to the top trace item. | |
void | appendQuotedArgument (const char *Name, const std::string &Value) |
Append a double-quoted argument to the top trace item. | |
void | appendFilePathArgument (const char *Name, llvm::StringRef Value) |
Append a double-quoted file path argument to the top trace item. | |
llvm::StringRef | getSourceString (CharSourceRange Range) |
Get the raw source string of the range. | |
Public Attributes | |
std::vector< CallbackCall > & | CallbackCalls |
Callback trace information. | |
const FilterType & | Filters |
llvm::StringMap< bool > | CallbackIsEnabled |
bool | DisableTrace |
Inhibit trace while this is set. | |
Preprocessor & | PP |
This class overrides the PPCallbacks class for tracking preprocessor activity by means of its callback functions.
This object is given a vector for storing the trace information, built up of CallbackCall and subordinate Argument objects for representing the callback calls and their arguments. It's a reference so the vector can exist beyond the lifetime of this object, because it's deleted by the preprocessor automatically in its destructor.
This class supports a mechanism for inhibiting trace output for specific callbacks by name, for the purpose of eliminating output for callbacks of no interest that might clutter the output.
Following the constructor and destructor function declarations, the overridden callback functions are defined. The remaining functions are helpers for recording the trace data, to reduce the coupling between it and the recorded data structure.
Definition at line 74 of file PPCallbacksTracker.h.
clang::pp_trace::PPCallbacksTracker::PPCallbacksTracker | ( | const FilterType & | Filters, |
std::vector< CallbackCall > & | CallbackCalls, | ||
Preprocessor & | PP | ||
) |
Note that all of the arguments are references, and owned by the caller.
Filters | - List of (Glob,Enabled) pairs used to filter callbacks. |
CallbackCalls | - Trace buffer. |
PP | - The preprocessor. Needed for getting some argument strings. |
Definition at line 99 of file PPCallbacksTracker.cpp.
|
override |
Definition at line 104 of file PPCallbacksTracker.cpp.
void clang::pp_trace::PPCallbacksTracker::append | ( | const char * | Str | ) |
Append a string to the top trace item.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
bool | Value | ||
) |
Append a bool argument to the top trace item.
Definition at line 431 of file PPCallbacksTracker.cpp.
References appendArgument(), and Name.
Referenced by appendArgument(), appendQuotedArgument(), Defined(), Elif(), Else(), Endif(), FileChanged(), FileSkipped(), Ident(), If(), Ifdef(), Ifndef(), InclusionDirective(), MacroDefined(), MacroExpands(), MacroUndefined(), moduleImport(), PragmaComment(), PragmaDebug(), PragmaDetectMismatch(), PragmaDiagnostic(), PragmaDiagnosticPop(), PragmaDiagnosticPush(), PragmaDirective(), PragmaExecCharsetPop(), PragmaExecCharsetPush(), PragmaMessage(), PragmaOpenCLExtension(), PragmaWarning(), PragmaWarningPop(), PragmaWarningPush(), and SourceRangeSkipped().
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
CharSourceRange | Value | ||
) |
Append a CharSourceRange argument to the top trace item.
Definition at line 527 of file PPCallbacksTracker.cpp.
References appendArgument(), getSourceString(), and Name.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const char * | Value | ||
) |
Append a string argument to the top trace item.
Definition at line 444 of file PPCallbacksTracker.cpp.
References CallbackCalls, DisableTrace, and Name.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const IdentifierInfo * | Value | ||
) |
Append an IdentifierInfo argument to the top trace item.
Definition at line 555 of file PPCallbacksTracker.cpp.
References appendArgument(), and Name.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const MacroArgs * | Value | ||
) |
Append a MacroArgs argument to the top trace item.
Definition at line 594 of file PPCallbacksTracker.cpp.
References appendArgument(), Name, and PP.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const MacroDefinition & | Value | ||
) |
Append a MacroDefinition argument to the top trace item.
Definition at line 575 of file PPCallbacksTracker.cpp.
References appendArgument(), and Name.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const MacroDirective * | Value | ||
) |
Append a MacroDirective argument to the top trace item.
Definition at line 565 of file PPCallbacksTracker.cpp.
References appendArgument(), clang::pp_trace::MacroDirectiveKindStrings, and Name.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const Module * | Value | ||
) |
Append a Module argument to the top trace item.
Definition at line 631 of file PPCallbacksTracker.cpp.
References appendArgument(), and Name.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const std::string & | Value | ||
) |
Append a string object argument to the top trace item.
Definition at line 457 of file PPCallbacksTracker.cpp.
References appendArgument(), and Name.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const Token & | Value | ||
) |
Append a token argument to the top trace item.
Definition at line 463 of file PPCallbacksTracker.cpp.
References appendArgument(), Name, and PP.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
FileEntryRef | Value | ||
) |
Definition at line 497 of file PPCallbacksTracker.cpp.
References appendFilePathArgument(), and Name.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
FileID | Value | ||
) |
Append a FileID argument to the top trace item.
Definition at line 474 of file PPCallbacksTracker.cpp.
References appendArgument(), appendFilePathArgument(), Name, and PP.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
int | Value | ||
) |
Append an int argument to the top trace item.
Definition at line 436 of file PPCallbacksTracker.cpp.
References appendArgument(), and Name.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
int | Value, | ||
const char *const | Strings[] | ||
) |
Append an enum argument to the top trace item.
Definition at line 468 of file PPCallbacksTracker.cpp.
References appendArgument(), Name, and Strings.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
llvm::StringRef | Value | ||
) |
Append a string reference object argument to the top trace item.
Definition at line 451 of file PPCallbacksTracker.cpp.
References appendArgument(), and Name.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
ModuleIdPath | Value | ||
) |
Append a ModuleIdPath argument to the top trace item.
Definition at line 537 of file PPCallbacksTracker.cpp.
References appendArgument(), DisableTrace, E, clang::pp_trace::getSourceLocationString(), Name, and PP.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
OptionalFileEntryRef | Value | ||
) |
Append a FileEntryRef argument to the top trace item.
Definition at line 488 of file PPCallbacksTracker.cpp.
References appendArgument(), and Name.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
SourceLocation | Value | ||
) |
Append a SourceLocation argument to the top trace item.
Definition at line 502 of file PPCallbacksTracker.cpp.
References appendArgument(), clang::pp_trace::getSourceLocationString(), Name, and PP.
void clang::pp_trace::PPCallbacksTracker::appendArgument | ( | const char * | Name, |
SourceRange | Value | ||
) |
Append a SourceRange argument to the top trace item.
Definition at line 512 of file PPCallbacksTracker.cpp.
References appendArgument(), DisableTrace, clang::pp_trace::getSourceLocationString(), Name, and PP.
void clang::pp_trace::PPCallbacksTracker::appendFilePathArgument | ( | const char * | Name, |
llvm::StringRef | Value | ||
) |
Append a double-quoted file path argument to the top trace item.
Definition at line 649 of file PPCallbacksTracker.cpp.
References appendQuotedArgument(), Name, and Path.
Referenced by appendArgument(), and InclusionDirective().
void clang::pp_trace::PPCallbacksTracker::appendQuotedArgument | ( | const char * | Name, |
const std::string & | Value | ||
) |
Append a double-quoted argument to the top trace item.
Definition at line 640 of file PPCallbacksTracker.cpp.
References appendArgument(), and Name.
Referenced by appendFilePathArgument().
void clang::pp_trace::PPCallbacksTracker::beginCallback | ( | const char * | Name | ) |
Start a new callback.
Definition at line 416 of file PPCallbacksTracker.cpp.
References CallbackCalls, CallbackIsEnabled, DisableTrace, Filters, and Name.
Referenced by Defined(), Elif(), Else(), Endif(), EndOfMainFile(), FileChanged(), FileSkipped(), Ident(), If(), Ifdef(), Ifndef(), InclusionDirective(), MacroDefined(), MacroExpands(), MacroUndefined(), moduleImport(), PragmaComment(), PragmaDebug(), PragmaDetectMismatch(), PragmaDiagnostic(), PragmaDiagnosticPop(), PragmaDiagnosticPush(), PragmaDirective(), PragmaExecCharsetPop(), PragmaExecCharsetPush(), PragmaMessage(), PragmaOpenCLExtension(), PragmaWarning(), PragmaWarningPop(), PragmaWarningPush(), and SourceRangeSkipped().
|
override |
Definition at line 345 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Range.
|
override |
Definition at line 371 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), ConditionValue, clang::pp_trace::ConditionValueKindStrings, and Loc.
|
override |
Definition at line 400 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 407 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 164 of file PPCallbacksTracker.cpp.
References beginCallback().
|
override |
Definition at line 109 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), clang::pp_trace::CharacteristicKindStrings, clang::pp_trace::FileChangeReasonStrings, and Loc.
|
override |
Definition at line 122 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and clang::pp_trace::CharacteristicKindStrings.
llvm::StringRef clang::pp_trace::PPCallbacksTracker::getSourceString | ( | CharSourceRange | Range | ) |
Get the raw source string of the range.
Definition at line 658 of file PPCallbacksTracker.cpp.
Referenced by appendArgument().
|
override |
Definition at line 167 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 362 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), ConditionValue, clang::pp_trace::ConditionValueKindStrings, and Loc.
|
override |
Definition at line 382 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 391 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 134 of file PPCallbacksTracker.cpp.
References appendArgument(), appendFilePathArgument(), beginCallback(), FileName, and IsAngled.
|
override |
Definition at line 328 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 316 of file PPCallbacksTracker.cpp.
References appendArgument(), Args, beginCallback(), and Range.
|
override |
Definition at line 336 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 153 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Path.
|
override |
Definition at line 182 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), Kind, and Loc.
|
override |
Definition at line 203 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 193 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), Loc, and Name.
|
override |
Definition at line 241 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), Loc, and clang::pp_trace::MappingStrings.
|
override |
Definition at line 233 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 224 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 174 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), Loc, and clang::pp_trace::PragmaIntroducerKindStrings.
|
override |
Definition at line 309 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 300 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 211 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), Kind, Loc, and clang::pp_trace::PragmaMessageKindStrings.
|
override |
Definition at line 254 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Name.
|
override |
Definition at line 266 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), Loc, and clang::pp_trace::PragmaWarningSpecifierStrings.
|
override |
Definition at line 293 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 286 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Loc.
|
override |
Definition at line 355 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and Range.
std::vector<CallbackCall>& clang::pp_trace::PPCallbacksTracker::CallbackCalls |
Callback trace information.
We use a reference so the trace will be preserved for the caller after this object is destructed.
Definition at line 223 of file PPCallbacksTracker.h.
Referenced by appendArgument(), and beginCallback().
llvm::StringMap<bool> clang::pp_trace::PPCallbacksTracker::CallbackIsEnabled |
Definition at line 229 of file PPCallbacksTracker.h.
Referenced by beginCallback().
bool clang::pp_trace::PPCallbacksTracker::DisableTrace |
Inhibit trace while this is set.
Definition at line 232 of file PPCallbacksTracker.h.
Referenced by appendArgument(), and beginCallback().
const FilterType& clang::pp_trace::PPCallbacksTracker::Filters |
Definition at line 226 of file PPCallbacksTracker.h.
Referenced by beginCallback().
Preprocessor& clang::pp_trace::PPCallbacksTracker::PP |
Definition at line 234 of file PPCallbacksTracker.h.
Referenced by appendArgument(), and getSourceString().