forked from OSchip/llvm-project
Introduce local_begin()/local_end() methods in PreprocessingRecord which
return iterators for local, non-loaded, preprocessed entities. llvm-svn: 140062
This commit is contained in:
parent
27bf76d6d2
commit
7f44836998
|
@ -483,9 +483,26 @@ namespace clang {
|
|||
}
|
||||
};
|
||||
friend class iterator;
|
||||
|
||||
iterator begin(bool OnlyLocalEntities = false);
|
||||
iterator end(bool OnlyLocalEntities = false);
|
||||
|
||||
/// \brief Begin iterator for all preprocessed entities.
|
||||
iterator begin() {
|
||||
return iterator(this, -(int)LoadedPreprocessedEntities.size());
|
||||
}
|
||||
|
||||
/// \brief End iterator for all preprocessed entities.
|
||||
iterator end() {
|
||||
return iterator(this, PreprocessedEntities.size());
|
||||
}
|
||||
|
||||
/// \brief Begin iterator for local, non-loaded, preprocessed entities.
|
||||
iterator local_begin() {
|
||||
return iterator(this, 0);
|
||||
}
|
||||
|
||||
/// \brief End iterator for local, non-loaded, preprocessed entities.
|
||||
iterator local_end() {
|
||||
return iterator(this, PreprocessedEntities.size());
|
||||
}
|
||||
|
||||
/// \brief Returns a pair of [Begin, End) iterators of preprocessed entities
|
||||
/// that source range \arg R encompasses.
|
||||
|
|
|
@ -1534,7 +1534,7 @@ void ASTUnit::RealizePreprocessedEntitiesFromPreamble() {
|
|||
return;
|
||||
|
||||
PreprocessedEntities.insert(PreprocessedEntities.end(),
|
||||
PPRec->begin(true), PPRec->end(true));
|
||||
PPRec->local_begin(), PPRec->local_end());
|
||||
}
|
||||
|
||||
ASTUnit::pp_entity_iterator ASTUnit::pp_entity_begin() {
|
||||
|
|
|
@ -44,18 +44,6 @@ PreprocessingRecord::PreprocessingRecord(SourceManager &SM,
|
|||
{
|
||||
}
|
||||
|
||||
PreprocessingRecord::iterator
|
||||
PreprocessingRecord::begin(bool OnlyLocalEntities) {
|
||||
if (OnlyLocalEntities)
|
||||
return iterator(this, 0);
|
||||
|
||||
return iterator(this, -(int)LoadedPreprocessedEntities.size());
|
||||
}
|
||||
|
||||
PreprocessingRecord::iterator PreprocessingRecord::end(bool OnlyLocalEntities) {
|
||||
return iterator(this, PreprocessedEntities.size());
|
||||
}
|
||||
|
||||
/// \brief Returns a pair of [Begin, End) iterators of preprocessed entities
|
||||
/// that source range \arg R encompasses.
|
||||
std::pair<PreprocessingRecord::iterator, PreprocessingRecord::iterator>
|
||||
|
|
|
@ -1711,7 +1711,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP, bool IsModule) {
|
|||
}
|
||||
|
||||
void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
|
||||
if (PPRec.begin(Chain) == PPRec.end(Chain))
|
||||
if (PPRec.local_begin() == PPRec.local_end())
|
||||
return;
|
||||
|
||||
SmallVector<PPEntityOffset, 64> PreprocessedEntityOffsets;
|
||||
|
@ -1744,8 +1744,8 @@ void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
|
|||
unsigned NextPreprocessorEntityID = FirstPreprocessorEntityID;
|
||||
RecordData Record;
|
||||
uint64_t BitsInChain = Chain? Chain->TotalModulesSizeInBits : 0;
|
||||
for (PreprocessingRecord::iterator E = PPRec.begin(Chain),
|
||||
EEnd = PPRec.end(Chain);
|
||||
for (PreprocessingRecord::iterator E = PPRec.local_begin(),
|
||||
EEnd = PPRec.local_end();
|
||||
E != EEnd;
|
||||
(void)++E, ++NumPreprocessingRecords, ++NextPreprocessorEntityID) {
|
||||
Record.clear();
|
||||
|
|
Loading…
Reference in New Issue