clang-tools
3.8.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 94 of file PPCallbacksTracker.cpp.
|
override |
Definition at line 99 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 420 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 425 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 433 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 440 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 446 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 452 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 458 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 464 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 479 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 489 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 499 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 515 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 525 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 544 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 554 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 564 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 583 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 622 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 641 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 632 of file PPCallbacksTracker.cpp.
References appendArgument().
Referenced by appendFilePathArgument().
void PPCallbacksTracker::beginCallback | ( | const char * | Name | ) |
Start a new callback.
Definition at line 412 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 336 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 362 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and ConditionValueKindStrings.
|
override |
Definition at line 394 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 402 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 169 of file PPCallbacksTracker.cpp.
References beginCallback().
|
override |
Definition at line 104 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), CharacteristicKindStrings, and FileChangeReasonStrings.
|
override |
Definition at line 129 of file PPCallbacksTracker.cpp.
References appendFilePathArgument(), and beginCallback().
|
override |
Definition at line 117 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 651 of file PPCallbacksTracker.cpp.
References PP.
Referenced by appendArgument().
|
override |
Definition at line 172 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 352 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and ConditionValueKindStrings.
|
override |
Definition at line 374 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 384 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 139 of file PPCallbacksTracker.cpp.
References appendArgument(), appendFilePathArgument(), and beginCallback().
|
override |
Definition at line 319 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 306 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 327 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 158 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 188 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 209 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 199 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 246 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and MappingStrings.
|
override |
Definition at line 238 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 229 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 180 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and PragmaIntroducerKindStrings.
|
override |
Definition at line 217 of file PPCallbacksTracker.cpp.
References appendArgument(), beginCallback(), and PragmaMessageKindStrings.
|
override |
Definition at line 259 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 270 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 298 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 290 of file PPCallbacksTracker.cpp.
References appendArgument(), and beginCallback().
|
override |
Definition at line 346 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().