clang API Documentation

Classes | Public Member Functions | Friends
clang::PreprocessingRecord Class Reference

A record of the steps taken while preprocessing a source file, including the various preprocessing directives processed, macros expanded, etc. More...

#include <PreprocessingRecord.h>

Inheritance diagram for clang::PreprocessingRecord:
Inheritance graph
[legend]
Collaboration diagram for clang::PreprocessingRecord:
Collaboration graph
[legend]

List of all members.

Classes

class  CondDirectiveLoc
class  iterator

Public Member Functions

 PreprocessingRecord (SourceManager &SM, bool RecordConditionalDirectives)
 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
SourceManagergetSourceManager () 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, iteratorgetPreprocessedEntitiesInRange (SourceRange R)
 Returns a pair of [Begin, End) iterators of preprocessed entities that source range.
bool isEntityInFileID (iterator PPEI, FileID FID)
 Returns true if the preprocessed entity that.
PPEntityID addPreprocessedEntity (PreprocessedEntity *Entity)
 Add a new preprocessed entity to this record.
bool isRecordingConditionalDirectives () const
 Returns true if this PreprocessingRecord is keeping track of conditional directives locations.
bool rangeIntersectsConditionalDirective (SourceRange Range) const
 Returns true if the given range intersects with a conditional directive. if a if/#endif block is fully contained within the range, this function will return false.
bool areInDifferentConditionalDirectiveRegion (SourceLocation LHS, SourceLocation RHS) const
 Returns true if the given locations are in different regions, separated by conditional directive blocks.
void SetExternalSource (ExternalPreprocessingRecordSource &Source)
 Set the external source for preprocessed entities.
ExternalPreprocessingRecordSourcegetExternalSource () const
 Retrieve the external source for preprocessed entities.
MacroDefinitionfindMacroDefinition (const MacroInfo *MI)
 Retrieve the macro definition that corresponds to the given MacroInfo.

Friends

class iterator
class ASTReader
class ASTWriter

Detailed Description

A record of the steps taken while preprocessing a source file, including the various preprocessing directives processed, macros expanded, etc.

Definition at line 287 of file PreprocessingRecord.h.


Constructor & Destructor Documentation

PreprocessingRecord::PreprocessingRecord ( SourceManager SM,
bool  RecordConditionalDirectives 
)

Construct a new preprocessing record.

Definition at line 40 of file PreprocessingRecord.cpp.


Member Function Documentation

PreprocessingRecord::PPEntityID PreprocessingRecord::addPreprocessedEntity ( PreprocessedEntity Entity)
void* clang::PreprocessingRecord::Allocate ( unsigned  Size,
unsigned  Align = 8 
) [inline]

Allocate memory in the preprocessing record.

Definition at line 395 of file PreprocessingRecord.h.

Referenced by clang::InclusionDirective::InclusionDirective().

bool clang::PreprocessingRecord::areInDifferentConditionalDirectiveRegion ( SourceLocation  LHS,
SourceLocation  RHS 
) const [inline]

Returns true if the given locations are in different regions, separated by conditional directive blocks.

Definition at line 574 of file PreprocessingRecord.h.

Referenced by clang::edit::Commit::insertFromRange().

iterator clang::PreprocessingRecord::begin ( ) [inline]

Begin iterator for all preprocessed entities.

Definition at line 523 of file PreprocessingRecord.h.

void clang::PreprocessingRecord::Deallocate ( void *  Ptr) [inline]

Deallocate memory in the preprocessing record.

Definition at line 400 of file PreprocessingRecord.h.

Referenced by operator delete().

iterator clang::PreprocessingRecord::end ( ) [inline]

End iterator for all preprocessed entities.

Definition at line 528 of file PreprocessingRecord.h.

MacroDefinition * PreprocessingRecord::findMacroDefinition ( const MacroInfo MI)

Retrieve the macro definition that corresponds to the given MacroInfo.

Definition at line 348 of file PreprocessingRecord.cpp.

References clang::PreprocessedEntity::isInvalid().

ExternalPreprocessingRecordSource* clang::PreprocessingRecord::getExternalSource ( ) const [inline]

Retrieve the external source for preprocessed entities.

Definition at line 583 of file PreprocessingRecord.h.

std::pair< PreprocessingRecord::iterator, PreprocessingRecord::iterator > PreprocessingRecord::getPreprocessedEntitiesInRange ( SourceRange  Range)

Returns a pair of [Begin, End) iterators of preprocessed entities that source range.

  • R encompasses.
Parameters:
Rthe range to look for preprocessed entities.
  • R encompasses.

Definition at line 53 of file PreprocessingRecord.cpp.

References clang::SourceRange::isInvalid(), iterator, and Range.

SourceManager& clang::PreprocessingRecord::getSourceManager ( ) const [inline]

Definition at line 404 of file PreprocessingRecord.h.

size_t PreprocessingRecord::getTotalMemory ( ) const

Definition at line 514 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.

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

See also:
getPreprocessedEntitiesInRange.

Definition at line 94 of file PreprocessingRecord.cpp.

References clang::FileID::isInvalid(), isPreprocessedEntityIfInFileID(), and clang::ExternalPreprocessingRecordSource::isPreprocessedEntityInFileID().

bool clang::PreprocessingRecord::isRecordingConditionalDirectives ( ) const [inline]

Returns true if this PreprocessingRecord is keeping track of conditional directives locations.

Definition at line 563 of file PreprocessingRecord.h.

iterator clang::PreprocessingRecord::local_begin ( ) [inline]

Begin iterator for local, non-loaded, preprocessed entities.

Definition at line 533 of file PreprocessingRecord.h.

iterator clang::PreprocessingRecord::local_end ( ) [inline]

End iterator for local, non-loaded, preprocessed entities.

Definition at line 538 of file PreprocessingRecord.h.

bool PreprocessingRecord::rangeIntersectsConditionalDirective ( SourceRange  Range) const

Returns true if the given range intersects with a conditional directive. if a if/#endif block is fully contained within the range, this function will return false.

Definition at line 425 of file PreprocessingRecord.cpp.

References clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::SourceManager::isBeforeInTranslationUnit(), and clang::SourceRange::isInvalid().

void PreprocessingRecord::SetExternalSource ( ExternalPreprocessingRecordSource Source)

Set the external source for preprocessed entities.

Definition at line 301 of file PreprocessingRecord.cpp.


Friends And Related Function Documentation

friend class ASTReader [friend]

Definition at line 622 of file PreprocessingRecord.h.

friend class ASTWriter [friend]

Definition at line 623 of file PreprocessingRecord.h.

friend class iterator [friend]

Definition at line 520 of file PreprocessingRecord.h.

Referenced by getPreprocessedEntitiesInRange().


Member Data Documentation

Definition at line 615 of file PreprocessingRecord.h.

Referenced by getPreprocessedEntitiesInRange().

std::pair<PPEntityID, PPEntityID> clang::PreprocessingRecord::Result

Definition at line 616 of file PreprocessingRecord.h.


The documentation for this class was generated from the following files: