[cfe-commits] r140062 - in /cfe/trunk: include/clang/Lex/PreprocessingRecord.h lib/Frontend/ASTUnit.cpp lib/Lex/PreprocessingRecord.cpp lib/Serialization/ASTWriter.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Sep 19 13:40:42 PDT 2011
Author: akirtzidis
Date: Mon Sep 19 15:40:42 2011
New Revision: 140062
URL: http://llvm.org/viewvc/llvm-project?rev=140062&view=rev
Log:
Introduce local_begin()/local_end() methods in PreprocessingRecord which
return iterators for local, non-loaded, preprocessed entities.
Modified:
cfe/trunk/include/clang/Lex/PreprocessingRecord.h
cfe/trunk/lib/Frontend/ASTUnit.cpp
cfe/trunk/lib/Lex/PreprocessingRecord.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
Modified: cfe/trunk/include/clang/Lex/PreprocessingRecord.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PreprocessingRecord.h?rev=140062&r1=140061&r2=140062&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/PreprocessingRecord.h (original)
+++ cfe/trunk/include/clang/Lex/PreprocessingRecord.h Mon Sep 19 15:40:42 2011
@@ -483,9 +483,26 @@
}
};
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.
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=140062&r1=140061&r2=140062&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Sep 19 15:40:42 2011
@@ -1534,7 +1534,7 @@
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() {
Modified: cfe/trunk/lib/Lex/PreprocessingRecord.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PreprocessingRecord.cpp?rev=140062&r1=140061&r2=140062&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PreprocessingRecord.cpp (original)
+++ cfe/trunk/lib/Lex/PreprocessingRecord.cpp Mon Sep 19 15:40:42 2011
@@ -44,18 +44,6 @@
{
}
-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>
Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=140062&r1=140061&r2=140062&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Mon Sep 19 15:40:42 2011
@@ -1711,7 +1711,7 @@
}
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 @@
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();
More information about the cfe-commits
mailing list