clang
6.0.0
|
A record of the steps taken while preprocessing a source file, including the various preprocessing directives processed, macros expanded, etc. More...
#include "clang/Lex/PreprocessingRecord.h"
Classes | |
class | iterator |
Iteration over the preprocessed entities. More... | |
Public Member Functions | |
PreprocessingRecord (SourceManager &SM) | |
Construct a new preprocessing record. More... | |
void * | Allocate (unsigned Size, unsigned Align=8) |
Allocate memory in the preprocessing record. More... | |
void | Deallocate (void *Ptr) |
Deallocate memory in the preprocessing record. More... | |
size_t | getTotalMemory () const |
SourceManager & | getSourceManager () const |
iterator | begin () |
Begin iterator for all preprocessed entities. More... | |
iterator | end () |
End iterator for all preprocessed entities. More... | |
iterator | local_begin () |
Begin iterator for local, non-loaded, preprocessed entities. More... | |
iterator | local_end () |
End iterator for local, non-loaded, preprocessed entities. More... | |
llvm::iterator_range< iterator > | getIteratorsForLoadedRange (unsigned start, unsigned count) |
iterator range for the given range of loaded preprocessed entities. More... | |
llvm::iterator_range< iterator > | getPreprocessedEntitiesInRange (SourceRange R) |
Returns a range of preprocessed entities that source range R encompasses. More... | |
bool | isEntityInFileID (iterator PPEI, FileID FID) |
Returns true if the preprocessed entity that PPEI iterator points to is coming from the file FID . More... | |
PPEntityID | addPreprocessedEntity (PreprocessedEntity *Entity) |
Add a new preprocessed entity to this record. More... | |
void | SetExternalSource (ExternalPreprocessingRecordSource &Source) |
Set the external source for preprocessed entities. More... | |
ExternalPreprocessingRecordSource * | getExternalSource () const |
Retrieve the external source for preprocessed entities. More... | |
MacroDefinitionRecord * | findMacroDefinition (const MacroInfo *MI) |
Retrieve the macro definition that corresponds to the given MacroInfo . More... | |
const std::vector< SourceRange > & | getSkippedRanges () const |
Retrieve all ranges that got skipped while preprocessing. More... | |
![]() | |
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. More... | |
virtual void | FileSkipped (const FileEntry &SkippedFile, const Token &FilenameTok, SrcMgr::CharacteristicKind FileType) |
Callback invoked whenever a source file is skipped as the result of header guard optimization. More... | |
virtual bool | FileNotFound (StringRef FileName, SmallVectorImpl< char > &RecoveryPath) |
Callback invoked whenever an inclusion directive results in a file-not-found error. More... | |
virtual void | moduleImport (SourceLocation ImportLoc, ModuleIdPath Path, const Module *Imported) |
Callback invoked whenever there was an explicit module-import syntax. More... | |
virtual void | EndOfMainFile () |
Callback invoked when the end of the main file is reached. More... | |
virtual void | Ident (SourceLocation Loc, StringRef str) |
Callback invoked when a #ident or #sccs directive is read. More... | |
virtual void | PragmaDirective (SourceLocation Loc, PragmaIntroducerKind Introducer) |
Callback invoked when start reading any pragma directive. More... | |
virtual void | PragmaComment (SourceLocation Loc, const IdentifierInfo *Kind, StringRef Str) |
Callback invoked when a #pragma comment directive is read. More... | |
virtual void | PragmaDetectMismatch (SourceLocation Loc, StringRef Name, StringRef Value) |
Callback invoked when a #pragma detect_mismatch directive is read. More... | |
virtual void | PragmaDebug (SourceLocation Loc, StringRef DebugType) |
Callback invoked when a #pragma clang __debug directive is read. More... | |
virtual void | PragmaMessage (SourceLocation Loc, StringRef Namespace, PragmaMessageKind Kind, StringRef Str) |
Callback invoked when a #pragma message directive is read. More... | |
virtual void | PragmaDiagnosticPush (SourceLocation Loc, StringRef Namespace) |
Callback invoked when a #pragma gcc diagnostic push directive is read. More... | |
virtual void | PragmaDiagnosticPop (SourceLocation Loc, StringRef Namespace) |
Callback invoked when a #pragma gcc diagnostic pop directive is read. More... | |
virtual void | PragmaDiagnostic (SourceLocation Loc, StringRef Namespace, diag::Severity mapping, StringRef Str) |
Callback invoked when a #pragma gcc diagnostic directive is read. More... | |
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. More... | |
virtual void | PragmaWarning (SourceLocation Loc, StringRef WarningSpec, ArrayRef< int > Ids) |
Callback invoked when a #pragma warning directive is read. More... | |
virtual void | PragmaWarningPush (SourceLocation Loc, int Level) |
Callback invoked when a #pragma warning(push) directive is read. More... | |
virtual void | PragmaWarningPop (SourceLocation Loc) |
Callback invoked when a #pragma warning(pop) directive is read. More... | |
virtual void | PragmaAssumeNonNullBegin (SourceLocation Loc) |
Callback invoked when a #pragma clang assume_nonnull begin directive is read. More... | |
virtual void | PragmaAssumeNonNullEnd (SourceLocation Loc) |
Callback invoked when a #pragma clang assume_nonnull end directive is read. More... | |
virtual void | If (SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue) |
Hook called whenever an #if is seen. More... | |
virtual void | Elif (SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind ConditionValue, SourceLocation IfLoc) |
Hook called whenever an #elif is seen. More... | |
virtual void | Else (SourceLocation Loc, SourceLocation IfLoc) |
Hook called whenever an #else is seen. More... | |
virtual void | Endif (SourceLocation Loc, SourceLocation IfLoc) |
Hook called whenever an #endif is seen. More... | |
Friends | |
class | ASTReader |
class | ASTWriter |
Additional Inherited Members | |
![]() | |
enum | FileChangeReason { EnterFile, ExitFile, SystemHeaderPragma, RenameFile } |
enum | PragmaMessageKind { PMK_Message, PMK_Warning, PMK_Error } |
Determines the kind of #pragma invoking a call to PragmaMessage. More... | |
enum | ConditionValueKind { CVK_NotEvaluated, CVK_False, CVK_True } |
A record of the steps taken while preprocessing a source file, including the various preprocessing directives processed, macros expanded, etc.
Definition at line 305 of file PreprocessingRecord.h.
|
explicit |
Construct a new preprocessing record.
Definition at line 55 of file PreprocessingRecord.cpp.
PreprocessingRecord::PPEntityID PreprocessingRecord::addPreprocessedEntity | ( | PreprocessedEntity * | Entity | ) |
Add a new preprocessed entity to this record.
Definition at line 256 of file PreprocessingRecord.cpp.
References Begin, clang::SourceRange::getBegin(), and clang::PreprocessedEntity::getSourceRange().
Referenced by findMacroDefinition().
|
inline |
Allocate memory in the preprocessing record.
Definition at line 388 of file PreprocessingRecord.h.
|
inline |
Begin iterator for all preprocessed entities.
Definition at line 440 of file PreprocessingRecord.h.
|
inline |
Deallocate memory in the preprocessing record.
Definition at line 393 of file PreprocessingRecord.h.
|
inline |
End iterator for all preprocessed entities.
Definition at line 445 of file PreprocessingRecord.h.
MacroDefinitionRecord * PreprocessingRecord::findMacroDefinition | ( | const MacroInfo * | MI | ) |
Retrieve the macro definition that corresponds to the given MacroInfo
.
Definition at line 371 of file PreprocessingRecord.cpp.
References addPreprocessedEntity(), clang::MacroDefinition::forAllDefinitions(), clang::SourceRange::getBegin(), clang::MacroInfo::getDefinitionEndLoc(), clang::MacroInfo::getDefinitionLoc(), clang::Token::getIdentifierInfo(), clang::Token::getLocation(), clang::MacroDirective::getMacroInfo(), clang::MacroDefinition::getMacroInfo(), Id, clang::MacroInfo::isBuiltinMacro(), clang::SourceLocation::isMacroID(), and Range.
|
inline |
Retrieve the external source for preprocessed entities.
Definition at line 493 of file PreprocessingRecord.h.
|
inline |
iterator range for the given range of loaded preprocessed entities.
Definition at line 461 of file PreprocessingRecord.h.
llvm::iterator_range< PreprocessingRecord::iterator > PreprocessingRecord::getPreprocessedEntitiesInRange | ( | SourceRange | Range | ) |
Returns a range of preprocessed entities that source range R
encompasses.
Returns a pair of [Begin, End) iterators of preprocessed entities that source range Range
encompasses.
R | the range to look for preprocessed entities. |
Definition at line 60 of file PreprocessingRecord.cpp.
References clang::SourceRange::isInvalid(), and Range.
|
inline |
Retrieve all ranges that got skipped while preprocessing.
Definition at line 502 of file PreprocessingRecord.h.
|
inline |
Definition at line 397 of file PreprocessingRecord.h.
size_t PreprocessingRecord::getTotalMemory | ( | ) | const |
Definition at line 496 of file PreprocessingRecord.cpp.
Returns true if the preprocessed entity that PPEI
iterator points to is coming from the file FID
.
Returns true if the preprocessed entity that.
Can be used to avoid implicit deserializations of preallocated preprocessed entities if we only care about entities of a specific file and not from files #included in the range given at
Can be used to avoid implicit deserializations of preallocated preprocessed entities if we only care about entities of a specific file and not from files #included in the range given at
Definition at line 98 of file PreprocessingRecord.cpp.
References Begin, distance(), End, clang::ExternalPreprocessingRecordSource::findPreprocessedEntitiesInRange(), clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::PreprocessedEntity::getSourceRange(), clang::SourceManager::isBeforeInTranslationUnit(), clang::FileID::isInvalid(), clang::SourceRange::isInvalid(), clang::SourceManager::isLocalSourceLocation(), isPreprocessedEntityIfInFileID(), clang::ExternalPreprocessingRecordSource::isPreprocessedEntityInFileID(), clang::SourceRange::isValid(), Range, and SM.
|
inline |
Begin iterator for local, non-loaded, preprocessed entities.
Definition at line 450 of file PreprocessingRecord.h.
|
inline |
End iterator for local, non-loaded, preprocessed entities.
Definition at line 455 of file PreprocessingRecord.h.
void PreprocessingRecord::SetExternalSource | ( | ExternalPreprocessingRecordSource & | Source | ) |
Set the external source for preprocessed entities.
Definition at line 318 of file PreprocessingRecord.cpp.
References clang::PreprocessedEntity::InvalidKind, and Result.
|
friend |
Definition at line 507 of file PreprocessingRecord.h.
|
friend |
Definition at line 508 of file PreprocessingRecord.h.
SourceRange clang::PreprocessingRecord::Range |
Definition at line 539 of file PreprocessingRecord.h.
Referenced by findMacroDefinition(), getPreprocessedEntitiesInRange(), and isEntityInFileID().
std::pair<int, int> clang::PreprocessingRecord::Result |
Definition at line 540 of file PreprocessingRecord.h.
Referenced by SetExternalSource().