aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-19 20:40:48 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-19 20:40:48 +0000
commit92ddef1bf843e1e18c040d69f48a6bf0bc7c776a (patch)
tree13be5d9d6b1809b8d7636181fce03dd5c20086ab /lib/Serialization
parentb6441ef9b7285bd1aa77b05b10f473f7a3f413e7 (diff)
In libclang, when visiting preprocessed entities in a source range, use
PreprocessingRecord's getPreprocessedEntitiesInRange. Also remove all the stuff that were added in ASTUnit that are unnecessary now that we do a binary search for preprocessed entities and deserialize only what is necessary. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140063 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization')
-rw-r--r--lib/Serialization/ASTReader.cpp10
-rw-r--r--lib/Serialization/ASTWriter.cpp17
-rw-r--r--lib/Serialization/GeneratePCH.cpp7
3 files changed, 1 insertions, 33 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 02d7eeaa8d..25b86876b3 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -2999,16 +2999,6 @@ std::pair<unsigned, unsigned>
return std::make_pair(BeginID, EndID);
}
-PreprocessedEntity *ASTReader::ReadPreprocessedEntityAtOffset(uint64_t Offset) {
- RecordLocation Loc = getLocalBitOffset(Offset);
-
- // Keep track of where we are in the stream, then jump back there
- // after reading this entity.
- SavedStreamPosition SavedPosition(Loc.F->PreprocessorDetailCursor);
- Loc.F->PreprocessorDetailCursor.JumpToBit(Loc.Offset);
- return LoadPreprocessedEntity(*Loc.F);
-}
-
namespace {
/// \brief Visitor used to search for information about a header file.
class HeaderFileInfoVisitor {
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index ac961c78f9..2aa1e6c4e3 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "clang/Serialization/ASTWriter.h"
-#include "clang/Serialization/ASTSerializationListener.h"
#include "ASTCommon.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/IdentifierResolver.h"
@@ -1743,7 +1742,6 @@ void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
+ NUM_PREDEF_PP_ENTITY_IDS;
unsigned NextPreprocessorEntityID = FirstPreprocessorEntityID;
RecordData Record;
- uint64_t BitsInChain = Chain? Chain->TotalModulesSizeInBits : 0;
for (PreprocessingRecord::iterator E = PPRec.local_begin(),
EEnd = PPRec.local_end();
E != EEnd;
@@ -1757,11 +1755,6 @@ void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
// Record this macro definition's ID.
MacroDefinitions[MD] = NextPreprocessorEntityID;
- // Notify the serialization listener that we're serializing this entity.
- if (SerializationListener)
- SerializationListener->SerializedPreprocessedEntity(*E,
- BitsInChain + Stream.GetCurrentBitNo());
-
Record.push_back(NextPreprocessorEntityID);
AddSourceLocation(MD->getSourceRange().getBegin(), Record);
AddSourceLocation(MD->getSourceRange().getEnd(), Record);
@@ -1771,11 +1764,6 @@ void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
continue;
}
- // Notify the serialization listener that we're serializing this entity.
- if (SerializationListener)
- SerializationListener->SerializedPreprocessedEntity(*E,
- BitsInChain + Stream.GetCurrentBitNo());
-
if (MacroExpansion *ME = dyn_cast<MacroExpansion>(*E)) {
Record.push_back(NextPreprocessorEntityID);
AddSourceLocation(ME->getSourceRange().getBegin(), Record);
@@ -2719,8 +2707,7 @@ void ASTWriter::SetSelectorOffset(Selector Sel, uint32_t Offset) {
}
ASTWriter::ASTWriter(llvm::BitstreamWriter &Stream)
- : Stream(Stream), Context(0), Chain(0), SerializationListener(0),
- WritingAST(false),
+ : Stream(Stream), Context(0), Chain(0), WritingAST(false),
FirstDeclID(NUM_PREDEF_DECL_IDS), NextDeclID(FirstDeclID),
FirstTypeID(NUM_PREDEF_TYPE_IDS), NextTypeID(FirstTypeID),
FirstIdentID(NUM_PREDEF_IDENT_IDS), NextIdentID(FirstIdentID),
@@ -4045,5 +4032,3 @@ void ASTWriter::AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
ChainedObjCCategoriesData Data = { IFD, CatD, 0, 0 };
LocalChainedObjCCategories.push_back(Data);
}
-
-ASTSerializationListener::~ASTSerializationListener() { }
diff --git a/lib/Serialization/GeneratePCH.cpp b/lib/Serialization/GeneratePCH.cpp
index 25fac8b7a8..a2534db82c 100644
--- a/lib/Serialization/GeneratePCH.cpp
+++ b/lib/Serialization/GeneratePCH.cpp
@@ -46,9 +46,6 @@ PCHGenerator::~PCHGenerator() {
void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) {
if (PP.getDiagnostics().hasErrorOccurred())
return;
-
- // Set up the serialization listener.
- Writer.SetSerializationListener(GetASTSerializationListener());
// Emit the PCH file
assert(SemaPtr && "No Sema?");
@@ -68,10 +65,6 @@ ASTMutationListener *PCHGenerator::GetASTMutationListener() {
return &Writer;
}
-ASTSerializationListener *PCHGenerator::GetASTSerializationListener() {
- return 0;
-}
-
ASTDeserializationListener *PCHGenerator::GetASTDeserializationListener() {
return &Writer;
}