aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Serialization/ASTBitCodes.h18
-rw-r--r--include/clang/Serialization/ASTReader.h8
-rw-r--r--include/clang/Serialization/ASTWriter.h13
-rw-r--r--include/clang/Serialization/Module.h12
4 files changed, 32 insertions, 19 deletions
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index 5d9e86cb08..32ac64e47b 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -367,9 +367,10 @@ namespace clang {
/// declarations.
TU_UPDATE_LEXICAL = 28,
- /// \brief Record code for the array describing the first/last local
- /// redeclarations of each entity.
- LOCAL_REDECLARATIONS = 29,
+ /// \brief Record code for the array describing the locations (in the
+ /// LOCAL_REDECLARATIONS record) of the redeclaration chains, indexed by
+ /// the first known ID.
+ LOCAL_REDECLARATIONS_MAP = 29,
/// \brief Record code for declarations that Sema keeps references of.
SEMA_DECL_REFS = 30,
@@ -455,7 +456,13 @@ namespace clang {
IMPORTED_MODULES = 51,
/// \brief Record code for the set of merged declarations in an AST file.
- MERGED_DECLARATIONS = 52
+ MERGED_DECLARATIONS = 52,
+
+ /// \brief Record code for the array of redeclaration chains.
+ ///
+ /// This array can only be interpreted properly using the local
+ /// redeclarations map.
+ LOCAL_REDECLARATIONS = 53
};
/// \brief Record types used within a source manager block.
@@ -1194,8 +1201,7 @@ namespace clang {
/// \brief Describes the redeclarations of a declaration.
struct LocalRedeclarationsInfo {
DeclID FirstID; // The ID of the first declaration
- DeclID FirstLocalID; // The ID of the first local declaration
- DeclID LastLocalID; // The ID of the last local declaration
+ unsigned Offset; // Offset into the array of redeclaration chains.
friend bool operator<(const LocalRedeclarationsInfo &X,
const LocalRedeclarationsInfo &Y) {
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 4a704d0c35..e7bdf50ae1 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -660,10 +660,10 @@ private:
/// Objective-C protocols.
std::deque<Decl *> InterestingDecls;
- /// \brief We delay loading of the previous declaration chain to avoid
- /// deeply nested calls when there are many redeclarations.
- std::deque<std::pair<Decl *, serialization::DeclID> > PendingPreviousDecls;
-
+ /// \brief The set of redeclarable declaraations that have been deserialized
+ /// since the last time the declaration chains were linked.
+ llvm::SmallPtrSet<Decl *, 16> RedeclsDeserialized;
+
/// \brief The list of redeclaration chains that still need to be
/// reconstructed.
///
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index f0af06f86e..c97c9f42c8 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -25,6 +25,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/Bitcode/BitstreamWriter.h"
#include <map>
#include <queue>
@@ -312,11 +313,12 @@ private:
/// serialized again. In this case, it is registered here, so that the reader
/// knows to read the updated version.
SmallVector<ReplacedDeclInfo, 16> ReplacedDecls;
-
- /// \brief The list of local redeclarations of entities that were
- /// first declared non-locally.
- SmallVector<serialization::LocalRedeclarationsInfo, 2> LocalRedeclarations;
-
+
+ /// \brief The set of declarations that may have redeclaration chains that
+ /// need to be serialized.
+ llvm::SetVector<Decl *, llvm::SmallVector<Decl *, 4>,
+ llvm::SmallPtrSet<Decl *, 4> > Redeclarations;
+
/// \brief Statements that we've encountered while serializing a
/// declaration or type.
SmallVector<Stmt *, 16> StmtsToEmit;
@@ -415,6 +417,7 @@ private:
void WriteDeclContextVisibleUpdate(const DeclContext *DC);
void WriteFPPragmaOptions(const FPOptions &Opts);
void WriteOpenCLExtensions(Sema &SemaRef);
+ void WriteRedeclarations();
void WriteMergedDecls();
unsigned DeclParmVarAbbrev;
diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h
index cbac5cd148..ad2c98e695 100644
--- a/include/clang/Serialization/Module.h
+++ b/include/clang/Serialization/Module.h
@@ -295,12 +295,16 @@ public:
/// \brief Array of file-level DeclIDs sorted by file.
const serialization::DeclID *FileSortedDecls;
- /// \brief Array of redeclaration information within this module file,
- /// sorted by the first declaration ID.
- const serialization::LocalRedeclarationsInfo *RedeclarationsInfo;
+ /// \brief Array of redeclaration chain location information within this
+ /// module file, sorted by the first declaration ID.
+ const serialization::LocalRedeclarationsInfo *RedeclarationsMap;
/// \brief The number of redeclaration info entries in RedeclarationsInfo.
- unsigned LocalNumRedeclarationsInfos;
+ unsigned LocalNumRedeclarationsInMap;
+
+ /// \brief The redeclaration chains for declarations local to this
+ /// module file.
+ SmallVector<uint64_t, 1> RedeclarationChains;
// === Types ===