clang-tools
3.9.0
|
This class overrides the PPCallbacks class for tracking preprocessor activity by means of its callback functions. More...
#include <PPCallbacksTracker.h>
Public Member Functions | |
PPCallbacksTracker (llvm::SmallSet< std::string, 4 > &Ignore, std::vector< CallbackCall > &CallbackCalls, clang::Preprocessor &PP) | |
Note that all of the arguments are references, and owned by the caller. More... | |
~PPCallbacksTracker () override | |
void | FileChanged (clang::SourceLocation Loc, clang::PPCallbacks::FileChangeReason Reason, clang::SrcMgr::CharacteristicKind FileType, clang::FileID PrevFID=clang::FileID()) override |
void | FileSkipped (const clang::FileEntry &SkippedFile, const clang::Token &FilenameTok, clang::SrcMgr::CharacteristicKind FileType) override |
bool | FileNotFound (llvm::StringRef FileName, llvm::SmallVectorImpl< char > &RecoveryPath) override |
void | InclusionDirective (clang::SourceLocation HashLoc, const clang::Token &IncludeTok, llvm::StringRef FileName, bool IsAngled, clang::CharSourceRange FilenameRange, const clang::FileEntry *File, llvm::StringRef SearchPath, llvm::StringRef RelativePath, const clang::Module *Imported) override |
void | moduleImport (clang::SourceLocation ImportLoc, clang::ModuleIdPath Path, const clang::Module *Imported) override |
void | EndOfMainFile () override |
void | Ident (clang::SourceLocation Loc, llvm::StringRef str) override |
void | PragmaDirective (clang::SourceLocation Loc, clang::PragmaIntroducerKind Introducer) override |
void | PragmaComment (clang::SourceLocation Loc, const clang::IdentifierInfo *Kind, llvm::StringRef Str) override |
void | PragmaDetectMismatch (clang::SourceLocation Loc, llvm::StringRef Name, llvm::StringRef Value) override |
void | PragmaDebug (clang::SourceLocation Loc, llvm::StringRef DebugType) override |
void | PragmaMessage (clang::SourceLocation Loc, llvm::StringRef Namespace, clang::PPCallbacks::PragmaMessageKind Kind, llvm::StringRef Str) override |
void | PragmaDiagnosticPush (clang::SourceLocation Loc, llvm::StringRef Namespace) override |
void | PragmaDiagnosticPop (clang::SourceLocation Loc, llvm::StringRef Namespace) override |
void | PragmaDiagnostic (clang::SourceLocation Loc, llvm::StringRef Namespace, clang::diag::Severity mapping, llvm::StringRef Str) override |
void | PragmaOpenCLExtension (clang::SourceLocation NameLoc, const clang::IdentifierInfo *Name, clang::SourceLocation StateLoc, unsigned State) override |
void | PragmaWarning (clang::SourceLocation Loc, llvm::StringRef WarningSpec, llvm::ArrayRef< int > Ids) override |
void | PragmaWarningPush (clang::SourceLocation Loc, int Level) override |
void | PragmaWarningPop (clang::SourceLocation Loc) override |
void | MacroExpands (const clang::Token &MacroNameTok, const clang::MacroDefinition &MD, clang::SourceRange Range, const clang::MacroArgs *Args) override |
void | MacroDefined (const clang::Token &MacroNameTok, const clang::MacroDirective *MD) override |
void | MacroUndefined (const clang::Token &MacroNameTok, const clang::MacroDefinition &MD) override |
void | Defined (const clang::Token &MacroNameTok, const clang::MacroDefinition &MD, clang::SourceRange Range) override |
void | SourceRangeSkipped (clang::SourceRange Range) override |
void | If (clang::SourceLocation Loc, clang::SourceRange ConditionRange, ConditionValueKind ConditionValue) override |
void | Elif (clang::SourceLocation Loc, clang::SourceRange ConditionRange, ConditionValueKind ConditionValue, clang::SourceLocation IfLoc) override |
void | Ifdef (clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDefinition &MD) override |
void | Ifndef (clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDefinition &MD) override |
void | Else (clang::SourceLocation Loc, clang::SourceLocation IfLoc) override |
void | Endif (clang::SourceLocation Loc, clang::SourceLocation IfLoc) override |
void | beginCallback (const char *Name) |
Start a new callback. More... | |
void | append (const char *Str) |
Append a string to the top trace item. More... | |
void | appendArgument (const char *Name, bool Value) |
Append a bool argument to the top trace item. More... | |
void | appendArgument (const char *Name, int Value) |
Append an int argument to the top trace item. More... | |
void | appendArgument (const char *Name, const char *Value) |
Append a string argument to the top trace item. More... | |
void | appendArgument (const char *Name, llvm::StringRef Value) |
Append a string reference object argument to the top trace item. More... | |
void | appendArgument (const char *Name, const std::string &Value) |
Append a string object argument to the top trace item. More... | |
void | appendArgument (const char *Name, const clang::Token &Value) |
Append a token argument to the top trace item. More... | |
void | appendArgument (const char *Name, int Value, const char *const Strings[]) |
Append an enum argument to the top trace item. More... | |
void | appendArgument (const char *Name, clang::FileID Value) |
Append a FileID argument to the top trace item. More... | |
void | appendArgument (const char *Name, const clang::FileEntry *Value) |
Append a FileEntry argument to the top trace item. More... | |
void | appendArgument (const char *Name, clang::SourceLocation Value) |
Append a SourceLocation argument to the top trace item. More... | |
void | appendArgument (const char *Name, clang::SourceRange Value) |
Append a SourceRange argument to the top trace item. More... | |
void | appendArgument (const char *Name, clang::CharSourceRange Value) |
Append a CharSourceRange argument to the top trace item. More... | |
void | appendArgument (const char *Name, clang::ModuleIdPath Value) |
Append a ModuleIdPath argument to the top trace item. More... | |
void | appendArgument (const char *Name, const clang::IdentifierInfo *Value) |
Append an IdentifierInfo argument to the top trace item. More... | |
void | appendArgument (const char *Name, const clang::MacroDirective *Value) |
Append a MacroDirective argument to the top trace item. More... | |
void | appendArgument (const char *Name, const clang::MacroDefinition &Value) |
Append a MacroDefinition argument to the top trace item. More... | |
void | appendArgument (const char *Name, const clang::MacroArgs *Value) |
Append a MacroArgs argument to the top trace item. More... | |
void | appendArgument (const char *Name, const clang::Module *Value) |
Append a Module argument to the top trace item. More... | |
void | appendQuotedArgument (const char *Name, const std::string &Value) |
Append a double-quoted argument to the top trace item. More... | |
void | appendFilePathArgument (const char *Name, llvm::StringRef Value) |
Append a double-quoted file path argument to the top trace item. More... | |
llvm::StringRef | getSourceString (clang::CharSourceRange Range) |
Get the raw source string of the range. More... | |
Public Attributes | |
std::vector< CallbackCall > & | CallbackCalls |
Callback trace information. More... | |
llvm::SmallSet< std::string, 4 > & | Ignore |
Names of callbacks to ignore. More... | |
bool | DisableTrace |
Inhibit trace while this is set. More... | |
clang::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 overidden 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 68 of file PPCallbacksTracker.h.
PPCallbacksTracker::PPCallbacksTracker | ( | llvm::SmallSet< std::string, 4 > & | Ignore, |
std::vector< CallbackCall > & | CallbackCalls, | ||
clang::Preprocessor & | PP | ||
) |
Note that all of the arguments are references, and owned by the caller.
Ignore | - Set of names of callbacks to ignore. |
CallbackCalls | - Trace buffer. |
PP | - The preprocessor. Needed for getting some argument strings. |
Definition at line 92 of file PPCallbacksTracker.cpp.
|
override |
Definition at line 97 of file PPCallbacksTracker.cpp.
void PPCallbacksTracker::append | ( | const char * | Str | ) |
Append a string to the top trace item.
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
bool | Value | ||
) |
Append a bool argument to the top trace item.
Definition at line 418 of file PPCallbacksTracker.cpp.
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(), PragmaMessage(), PragmaOpenCLExtension(), PragmaWarning(), PragmaWarningPop(), PragmaWarningPush(), and SourceRangeSkipped().
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
int | Value | ||
) |
Append an int argument to the top trace item.
Definition at line 423 of file PPCallbacksTracker.cpp.
References appendArgument().
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const char * | Value | ||
) |
Append a string argument to the top trace item.
Definition at line 431 of file PPCallbacksTracker.cpp.
References CallbackCalls, and DisableTrace.
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
llvm::StringRef | Value | ||
) |
Append a string reference object argument to the top trace item.
Definition at line 438 of file PPCallbacksTracker.cpp.
References appendArgument().
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const std::string & | Value | ||
) |
Append a string object argument to the top trace item.
Definition at line 444 of file PPCallbacksTracker.cpp.
References appendArgument().
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const clang::Token & | Value | ||
) |
Append a token argument to the top trace item.
Definition at line 450 of file PPCallbacksTracker.cpp.
References appendArgument(), and PP.
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
int | Value, | ||
const char *const | Strings[] | ||
) |
Append an enum argument to the top trace item.
Definition at line 456 of file PPCallbacksTracker.cpp.
References appendArgument().
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
clang::FileID | Value | ||
) |
Append a FileID argument to the top trace item.
Definition at line 462 of file PPCallbacksTracker.cpp.
References appendArgument(), appendFilePathArgument(), and PP.
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const clang::FileEntry * | Value | ||
) |
Append a FileEntry argument to the top trace item.
Definition at line 477 of file PPCallbacksTracker.cpp.
References appendArgument(), and appendFilePathArgument().
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
clang::SourceLocation | Value | ||
) |
Append a SourceLocation argument to the top trace item.
Definition at line 487 of file PPCallbacksTracker.cpp.
References appendArgument(), getSourceLocationString(), and PP.
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
clang::SourceRange | Value | ||
) |
Append a SourceRange argument to the top trace item.
Definition at line 497 of file PPCallbacksTracker.cpp.
References appendArgument(), DisableTrace, getSourceLocationString(), and PP.
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
clang::CharSourceRange | Value | ||
) |
Append a CharSourceRange argument to the top trace item.
Definition at line 513 of file PPCallbacksTracker.cpp.
References appendArgument(), and getSourceString().
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
clang::ModuleIdPath | Value | ||
) |
Append a ModuleIdPath argument to the top trace item.
Definition at line 523 of file PPCallbacksTracker.cpp.
References appendArgument(), DisableTrace, getSourceLocationString(), and PP.
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const clang::IdentifierInfo * | Value | ||
) |
Append an IdentifierInfo argument to the top trace item.
Definition at line 542 of file PPCallbacksTracker.cpp.
References appendArgument().
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const clang::MacroDirective * | Value | ||
) |
Append a MacroDirective argument to the top trace item.
Definition at line 552 of file PPCallbacksTracker.cpp.
References appendArgument(), and MacroDirectiveKindStrings.
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const clang::MacroDefinition & | Value | ||
) |
Append a MacroDefinition argument to the top trace item.
Definition at line 562 of file PPCallbacksTracker.cpp.
References appendArgument().
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const clang::MacroArgs * | Value | ||
) |
Append a MacroArgs argument to the top trace item.
Definition at line 581 of file PPCallbacksTracker.cpp.
References appendArgument(), and PP.
void PPCallbacksTracker::appendArgument | ( | const char * | Name, |
const clang::Module * | Value | ||
) |
Append a Module argument to the top trace item.
Definition at line 620 of file PPCallbacksTracker.cpp.
References appendArgument().
void PPCallbacksTracker::appendFilePathArgument | ( | const char * | Name, |
llvm::StringRef | Value | ||
) |
Append a double-quoted file path argument to the top trace item.
Definition at line 639 of file PPCallbacksTracker.cpp.
References appendQuotedArgument(), and Path.
Referenced by appendArgument(), FileNotFound(), and InclusionDirective().
void PPCallbacksTracker::appendQuotedArgument | ( | const char * | Name, |
const std::string & | Value | ||
) |
Append a double-quoted argument to the top trace item.
Definition at line 630 of file PPCallbacksTracker.cpp.
References appendArgument().
Referenced by appendFilePathArgument().
void PPCallbacksTracker::beginCallback | ( | const char * | Name | ) |
Start a new callback.
Definition at line 410 of file PPCallbacksTracker.cpp.
References CallbackCalls, DisableTrace, and Ignore.
Referenced by Defined(), Elif(), Else(), Endif(), EndOfMainFile(), FileChanged(), FileNotFound(), FileSkipped(), Ident(), If(), Ifdef(), Ifndef(), InclusionDirective(), MacroDefined(), MacroExpands(), MacroUndefined(), moduleImport(), PragmaComment(), PragmaDebug(), PragmaDetectMismatch(), PragmaDiagnostic(), PragmaDiagnosticPop(), PragmaDiagnosticPush(), PragmaDirective(), PragmaMessage(), PragmaOpenCLExtension(), PragmaWarning(), PragmaWarningPop(), PragmaWarningPush(), and SourceRangeSkipped().
|
override |
Definition at line 334 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 360 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and ConditionValueKindStrings.
|
override |
Definition at line 392 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 400 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 167 of file PPCallbacksTracker.cpp.
References beginCallback().
|
override |
Definition at line 102 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), CharacteristicKindStrings, and FileChangeReasonStrings.
|
override |
Definition at line 127 of file PPCallbacksTracker.cpp.
References appendFilePathArgument(), and beginCallback().
|
override |
Definition at line 115 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and CharacteristicKindStrings.
llvm::StringRef PPCallbacksTracker::getSourceString | ( | clang::CharSourceRange | Range | ) |
Get the raw source string of the range.
Definition at line 649 of file PPCallbacksTracker.cpp.
References PP.
Referenced by appendArgument().
|
override |
Definition at line 170 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 350 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and ConditionValueKindStrings.
|
override |
Definition at line 372 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 382 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 137 of file PPCallbacksTracker.cpp.
References appendArgument(), appendFilePathArgument(), and beginCallback().
|
override |
Definition at line 317 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 304 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 325 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 156 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 186 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 207 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 197 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 244 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and MappingStrings.
|
override |
Definition at line 236 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 227 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 178 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and PragmaIntroducerKindStrings.
|
override |
Definition at line 215 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and PragmaMessageKindStrings.
|
override |
Definition at line 257 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 268 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 296 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 288 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 344 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
std::vector<CallbackCall>& 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 229 of file PPCallbacksTracker.h.
Referenced by appendArgument(), and beginCallback().
bool PPCallbacksTracker::DisableTrace |
Inhibit trace while this is set.
Definition at line 235 of file PPCallbacksTracker.h.
Referenced by appendArgument(), and beginCallback().
llvm::SmallSet<std::string, 4>& PPCallbacksTracker::Ignore |
Names of callbacks to ignore.
Definition at line 232 of file PPCallbacksTracker.h.
Referenced by beginCallback().
clang::Preprocessor& PPCallbacksTracker::PP |
Definition at line 237 of file PPCallbacksTracker.h.
Referenced by appendArgument(), and getSourceString().