aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Serialization/ASTBitCodes.h
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-08-20 16:04:27 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-08-20 16:04:27 +0000
commit5d26768e2661faa7ce0b55ffff4be8b3969fbbf5 (patch)
tree7d3df9e026a4e019d9821a82a382ab48ed6a403a /include/clang/Serialization/ASTBitCodes.h
parenteb3f04e60fa17dba27344ed89fd1b9134bb6839c (diff)
Introduce the mechanism for building an AST on-disk hash table for name lookup inside a DeclContext but don't use it yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111635 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Serialization/ASTBitCodes.h')
-rw-r--r--include/clang/Serialization/ASTBitCodes.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index 3156a36040..4a3fc59e2e 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -20,6 +20,7 @@
#include "clang/AST/Type.h"
#include "llvm/Bitcode/BitCodes.h"
#include "llvm/System/DataTypes.h"
+#include "llvm/ADT/DenseMap.h"
namespace clang {
namespace serialization {
@@ -81,6 +82,36 @@ namespace clang {
}
};
+ /// A structure for putting "fast"-unqualified QualTypes into a
+ /// DenseMap. This uses the standard pointer hash function.
+ struct UnsafeQualTypeDenseMapInfo {
+ static inline bool isEqual(QualType A, QualType B) { return A == B; }
+ static inline QualType getEmptyKey() {
+ return QualType::getFromOpaquePtr((void*) 1);
+ }
+ static inline QualType getTombstoneKey() {
+ return QualType::getFromOpaquePtr((void*) 2);
+ }
+ static inline unsigned getHashValue(QualType T) {
+ assert(!T.getLocalFastQualifiers() &&
+ "hash invalid for types with fast quals");
+ uintptr_t v = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
+ return (unsigned(v) >> 4) ^ (unsigned(v) >> 9);
+ }
+ };
+
+ /// \brief Map that provides the ID numbers of each type within the
+ /// output stream, plus those deserialized from a chained PCH.
+ ///
+ /// The ID numbers of types are consecutive (in order of discovery)
+ /// and start at 1. 0 is reserved for NULL. When types are actually
+ /// stored in the stream, the ID number is shifted by 2 bits to
+ /// allow for the const/volatile qualifiers.
+ ///
+ /// Keys in the map never have const/volatile qualifiers.
+ typedef llvm::DenseMap<QualType, TypeIdx, UnsafeQualTypeDenseMapInfo>
+ TypeIdxMap;
+
/// \brief An ID number that refers to an identifier in an AST
/// file.
typedef uint32_t IdentID;