aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Serialization
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-27 18:47:35 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-27 18:47:35 +0000
commit9d31fa75bc05fe4cb903a7701550f22cfb73ea8b (patch)
treed619c60dff63d9cf0defdfefd208d549e8b129a3 /include/clang/Serialization
parent1872b3153a388b3a548c9f699cbc348128059be9 (diff)
[PCH] Pull the location out of the serialized declarations and put it in the array
of decl bit offsets. This allows us to easily get at the location of a decl without deserializing it. It increases size of Cocoa PCH by only 0.2%. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143123 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Serialization')
-rw-r--r--include/clang/Serialization/ASTBitCodes.h16
-rw-r--r--include/clang/Serialization/ASTReader.h3
-rw-r--r--include/clang/Serialization/ASTWriter.h2
-rw-r--r--include/clang/Serialization/Module.h2
4 files changed, 20 insertions, 3 deletions
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index 485b8fe3bb..9301a833ba 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -156,6 +156,22 @@ namespace clang {
BitOffset(BitOffset) { }
};
+ /// \brief Source range/offset of a preprocessed entity.
+ struct DeclOffset {
+ /// \brief Raw source location.
+ unsigned Loc;
+ /// \brief Offset in the AST file.
+ uint32_t BitOffset;
+
+ DeclOffset() : Loc(0), BitOffset(0) { }
+ DeclOffset(SourceLocation Loc, uint32_t BitOffset)
+ : Loc(Loc.getRawEncoding()),
+ BitOffset(BitOffset) { }
+ void setLocation(SourceLocation L) {
+ Loc = L.getRawEncoding();
+ }
+ };
+
/// \brief The number of predefined preprocessed entity IDs.
const unsigned int NUM_PREDEF_PP_ENTITY_IDS = 1;
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 6470fd634e..a463a280d3 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -679,7 +679,8 @@ private:
RecordLocation TypeCursorForIndex(unsigned Index);
void LoadedDecl(unsigned Index, Decl *D);
Decl *ReadDeclRecord(serialization::DeclID ID);
- RecordLocation DeclCursorForID(serialization::DeclID ID);
+ RecordLocation DeclCursorForID(serialization::DeclID ID,
+ unsigned &RawLocation);
void loadDeclUpdateRecords(serialization::DeclID ID, Decl *D);
void loadObjCChainedCategories(serialization::GlobalDeclID ID,
ObjCInterfaceDecl *D);
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index 44d8825829..184897fba9 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -142,7 +142,7 @@ private:
/// \brief Offset of each declaration in the bitstream, indexed by
/// the declaration's ID.
- std::vector<uint32_t> DeclOffsets;
+ std::vector<serialization::DeclOffset> DeclOffsets;
/// \brief The first ID number we can use for our own types.
serialization::TypeID FirstTypeID;
diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h
index 42b5a58e08..5c0cc9d296 100644
--- a/include/clang/Serialization/Module.h
+++ b/include/clang/Serialization/Module.h
@@ -241,7 +241,7 @@ public:
/// \brief Offset of each declaration within the bitstream, indexed
/// by the declaration ID (-1).
- const uint32_t *DeclOffsets;
+ const DeclOffset *DeclOffsets;
/// \brief Base declaration ID for declarations local to this module.
serialization::DeclID BaseDeclID;