namespace reader {
class ASTIdentifierLookupTrait;
+ /// \brief The on-disk hash table used for the DeclContext's Name lookup table.
+ typedef OnDiskChainedHashTable<ASTDeclContextNameLookupTrait>
+ ASTDeclContextNameLookupTable;
}
} // end namespace serialization
// TU, and when we read those update records, the actual context will not
// be available yet (unless it's the TU), so have this pending map using the
// ID as a key. It will be realized when the context is actually loaded.
- typedef SmallVector<std::pair<void *, ModuleFile*>, 1> DeclContextVisibleUpdates;
+ typedef
+ SmallVector<std::pair<serialization::reader::ASTDeclContextNameLookupTable *,
+ ModuleFile*>, 1> DeclContextVisibleUpdates;
typedef llvm::DenseMap<serialization::DeclID, DeclContextVisibleUpdates>
DeclContextVisibleUpdatesPending;
class DeclContext;
class Module;
-
+template<typename Info> class OnDiskChainedHashTable;
+
namespace serialization {
+namespace reader {
+ class ASTDeclContextNameLookupTrait;
+}
+
/// \brief Specifies the kind of module that has been loaded.
enum ModuleKind {
MK_Module, ///< File is a module proper.
DeclContextInfo()
: NameLookupTableData(), LexicalDecls(), NumLexicalDecls() {}
- void *NameLookupTableData; // an ASTDeclContextNameLookupTable.
+ OnDiskChainedHashTable<reader::ASTDeclContextNameLookupTrait>
+ *NameLookupTableData; // an ASTDeclContextNameLookupTable.
const KindDeclIDPair *LexicalDecls;
unsigned NumLexicalDecls;
};
case UPDATE_VISIBLE: {
unsigned Idx = 0;
serialization::DeclID ID = ReadDeclID(F, Record, Idx);
- void *Table = ASTDeclContextNameLookupTable::Create(
+ ASTDeclContextNameLookupTable *Table =
+ ASTDeclContextNameLookupTable::Create(
(const unsigned char *)BlobStart + Record[Idx++],
(const unsigned char *)BlobStart,
ASTDeclContextNameLookupTrait(*this, F));
// Look for this name within this module.
ASTDeclContextNameLookupTable *LookupTable =
- (ASTDeclContextNameLookupTable*)Info->second.NameLookupTableData;
+ Info->second.NameLookupTableData;
ASTDeclContextNameLookupTable::iterator Pos
= LookupTable->find(This->Name);
if (Pos == LookupTable->end())
// Look for this name within this module.
ASTDeclContextNameLookupTable *LookupTable =
- (ASTDeclContextNameLookupTable*)Info->second.NameLookupTableData;
+ Info->second.NameLookupTableData;
for (ASTDeclContextNameLookupTable::key_iterator
I = LookupTable->key_begin(),
E = LookupTable->key_end(); I != E; ++I) {
for (DeclContextVisibleUpdates::iterator J = I->second.begin(),
F = I->second.end();
J != F; ++J)
- delete static_cast<ASTDeclContextNameLookupTable*>(J->first);
+ delete J->first;
}
}
//===----------------------------------------------------------------------===//
#include "ASTCommon.h"
+#include "ASTReaderInternals.h"
#include "clang/Serialization/ASTReader.h"
#include "clang/Sema/IdentifierResolver.h"
#include "clang/Sema/Sema.h"
DeclContextVisibleUpdates &U = I->second;
for (DeclContextVisibleUpdates::iterator UI = U.begin(), UE = U.end();
UI != UE; ++UI) {
- UI->second->DeclContextInfos[DC].NameLookupTableData = UI->first;
+ DeclContextInfo &Info = UI->second->DeclContextInfos[DC];
+ delete Info.NameLookupTableData;
+ Info.NameLookupTableData = UI->first;
}
PendingVisibleUpdates.erase(I);
}
unsigned DataLen);
};
-/// \brief The on-disk hash table used for the DeclContext's Name lookup table.
-typedef OnDiskChainedHashTable<ASTDeclContextNameLookupTrait>
- ASTDeclContextNameLookupTable;
-
/// \brief Class that performs lookup for an identifier stored in an AST file.
class ASTIdentifierLookupTrait {
ASTReader &Reader;
E = DeclContextInfos.end();
I != E; ++I) {
if (I->second.NameLookupTableData)
- delete static_cast<ASTDeclContextNameLookupTable*>(
- I->second.NameLookupTableData);
+ delete I->second.NameLookupTableData;
}
delete static_cast<ASTIdentifierLookupTable *>(IdentifierLookupTable);