clang API Documentation
A record of the steps taken while preprocessing a source file, including the various preprocessing directives processed, macros expanded, etc. More...
#include <PreprocessingRecord.h>
Classes | |
class | iterator |
class | PPEntityID |
Global (loaded or local) ID for a preprocessed entity. Negative values are used to indicate preprocessed entities loaded from the external source while non-negative values are used to indicate preprocessed entities introduced by the current preprocessor. Value -1 corresponds to element 0 in the loaded entities vector, value -2 corresponds to element 1 in the loaded entities vector, etc. Value 0 is an invalid value, the index to local entities is 1-based, value 1 corresponds to element 0 in the local entities vector, value 2 corresponds to element 1 in the local entities vector, etc. | |
Public Member Functions | |
PreprocessingRecord (SourceManager &SM) | |
Construct a new preprocessing record. | |
void * | Allocate (unsigned Size, unsigned Align=8) |
Allocate memory in the preprocessing record. | |
void | Deallocate (void *Ptr) |
Deallocate memory in the preprocessing record. | |
size_t | getTotalMemory () const |
SourceManager & | getSourceManager () const |
iterator | begin () |
Begin iterator for all preprocessed entities. | |
iterator | end () |
End iterator for all preprocessed entities. | |
iterator | local_begin () |
Begin iterator for local, non-loaded, preprocessed entities. | |
iterator | local_end () |
End iterator for local, non-loaded, preprocessed entities. | |
std::pair< iterator, iterator > | getIteratorsForLoadedRange (unsigned start, unsigned count) |
begin/end iterator pair for the given range of loaded preprocessed entities. | |
std::pair< iterator, iterator > | getPreprocessedEntitiesInRange (SourceRange R) |
Returns a pair of [Begin, End) iterators of preprocessed entities that source range R encompasses. | |
bool | isEntityInFileID (iterator PPEI, FileID FID) |
Returns true if the preprocessed entity that PPEI iterator points to is coming from the file FID . | |
PPEntityID | addPreprocessedEntity (PreprocessedEntity *Entity) |
Add a new preprocessed entity to this record. | |
void | SetExternalSource (ExternalPreprocessingRecordSource &Source) |
Set the external source for preprocessed entities. | |
ExternalPreprocessingRecordSource * | getExternalSource () const |
Retrieve the external source for preprocessed entities. | |
MacroDefinition * | findMacroDefinition (const MacroInfo *MI) |
Retrieve the macro definition that corresponds to the given MacroInfo . | |
const std::vector< SourceRange > & | getSkippedRanges () const |
Retrieve all ranges that got skipped while preprocessing. | |
Friends | |
class | iterator |
class | ASTReader |
class | ASTWriter |
A record of the steps taken while preprocessing a source file, including the various preprocessing directives processed, macros expanded, etc.
Definition at line 290 of file PreprocessingRecord.h.
PreprocessingRecord::PreprocessingRecord | ( | SourceManager & | SM | ) | [explicit] |
Construct a new preprocessing record.
Definition at line 41 of file PreprocessingRecord.cpp.
PreprocessingRecord::PPEntityID PreprocessingRecord::addPreprocessedEntity | ( | PreprocessedEntity * | Entity | ) |
Add a new preprocessed entity to this record.
Definition at line 247 of file PreprocessingRecord.cpp.
References clang::SourceRange::getBegin(), clang::PreprocessedEntity::getSourceRange(), and clang::SourceManager::isBeforeInTranslationUnit().
void* clang::PreprocessingRecord::Allocate | ( | unsigned | Size, |
unsigned | Align = 8 |
||
) | [inline] |
Allocate memory in the preprocessing record.
Definition at line 370 of file PreprocessingRecord.h.
Referenced by clang::InclusionDirective::InclusionDirective().
iterator clang::PreprocessingRecord::begin | ( | ) | [inline] |
Begin iterator for all preprocessed entities.
Definition at line 502 of file PreprocessingRecord.h.
void clang::PreprocessingRecord::Deallocate | ( | void * | Ptr | ) | [inline] |
Deallocate memory in the preprocessing record.
Definition at line 375 of file PreprocessingRecord.h.
Referenced by operator delete().
iterator clang::PreprocessingRecord::end | ( | ) | [inline] |
End iterator for all preprocessed entities.
Definition at line 507 of file PreprocessingRecord.h.
MacroDefinition * PreprocessingRecord::findMacroDefinition | ( | const MacroInfo * | MI | ) |
Retrieve the macro definition that corresponds to the given MacroInfo
.
Definition at line 360 of file PreprocessingRecord.cpp.
ExternalPreprocessingRecordSource* clang::PreprocessingRecord::getExternalSource | ( | ) | const [inline] |
Retrieve the external source for preprocessed entities.
Definition at line 555 of file PreprocessingRecord.h.
std::pair<iterator, iterator> clang::PreprocessingRecord::getIteratorsForLoadedRange | ( | unsigned | start, |
unsigned | count | ||
) | [inline] |
begin/end iterator pair for the given range of loaded preprocessed entities.
Definition at line 524 of file PreprocessingRecord.h.
std::pair< PreprocessingRecord::iterator, PreprocessingRecord::iterator > PreprocessingRecord::getPreprocessedEntitiesInRange | ( | SourceRange | R | ) |
Returns a pair of [Begin, End) iterators 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 49 of file PreprocessingRecord.cpp.
References clang::SourceRange::isInvalid(), iterator, and Range.
const std::vector<SourceRange>& clang::PreprocessingRecord::getSkippedRanges | ( | ) | const [inline] |
Retrieve all ranges that got skipped while preprocessing.
Definition at line 564 of file PreprocessingRecord.h.
SourceManager& clang::PreprocessingRecord::getSourceManager | ( | ) | const [inline] |
Definition at line 379 of file PreprocessingRecord.h.
References SourceMgr.
size_t PreprocessingRecord::getTotalMemory | ( | ) | const |
Definition at line 485 of file PreprocessingRecord.cpp.
bool PreprocessingRecord::isEntityInFileID | ( | iterator | PPEI, |
FileID | FID | ||
) |
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 89 of file PreprocessingRecord.cpp.
References clang::FileID::isInvalid(), isPreprocessedEntityIfInFileID(), and clang::ExternalPreprocessingRecordSource::isPreprocessedEntityInFileID().
iterator clang::PreprocessingRecord::local_begin | ( | ) | [inline] |
Begin iterator for local, non-loaded, preprocessed entities.
Definition at line 512 of file PreprocessingRecord.h.
iterator clang::PreprocessingRecord::local_end | ( | ) | [inline] |
End iterator for local, non-loaded, preprocessed entities.
Definition at line 517 of file PreprocessingRecord.h.
void PreprocessingRecord::SetExternalSource | ( | ExternalPreprocessingRecordSource & | Source | ) |
Set the external source for preprocessed entities.
Definition at line 308 of file PreprocessingRecord.cpp.
friend class ASTReader [friend] |
Definition at line 601 of file PreprocessingRecord.h.
friend class ASTWriter [friend] |
Definition at line 602 of file PreprocessingRecord.h.
friend class iterator [friend] |
Definition at line 499 of file PreprocessingRecord.h.
Referenced by getPreprocessedEntitiesInRange().
Definition at line 595 of file PreprocessingRecord.h.
Referenced by getPreprocessedEntitiesInRange().
std::pair<int, int> clang::PreprocessingRecord::Result |
Definition at line 596 of file PreprocessingRecord.h.