mirror of
https://github.com/intel/llvm.git
synced 2026-02-05 04:46:27 +08:00
Make sure to deallocate the identifier lookup tables and selector tables
when destroying an ASTReader. Plugs a leak that shows up in libclang. llvm-svn: 111488
This commit is contained in:
@@ -198,6 +198,7 @@ private:
|
||||
/// \brief Information that is needed for every file in the chain.
|
||||
struct PerFileData {
|
||||
PerFileData();
|
||||
~PerFileData();
|
||||
|
||||
/// \brief The AST stat cache installed for this file, if any.
|
||||
///
|
||||
|
||||
@@ -448,15 +448,6 @@ ASTReader::~ASTReader() {
|
||||
delete Chain[e - i - 1];
|
||||
}
|
||||
|
||||
ASTReader::PerFileData::PerFileData()
|
||||
: StatCache(0), LocalNumSLocEntries(0), LocalNumTypes(0), TypeOffsets(0),
|
||||
LocalNumDecls(0), DeclOffsets(0), LocalNumIdentifiers(0),
|
||||
IdentifierOffsets(0), IdentifierTableData(0), IdentifierLookupTable(0),
|
||||
LocalNumMacroDefinitions(0), MacroDefinitionOffsets(0),
|
||||
NumPreallocatedPreprocessingEntities(0), SelectorLookupTable(0),
|
||||
SelectorLookupTableData(0), SelectorOffsets(0), LocalNumSelectors(0)
|
||||
{}
|
||||
|
||||
void
|
||||
ASTReader::setDeserializationListener(ASTDeserializationListener *Listener) {
|
||||
DeserializationListener = Listener;
|
||||
@@ -3838,3 +3829,18 @@ void ASTReader::FinishedDeserializing() {
|
||||
}
|
||||
--NumCurrentElementsDeserializing;
|
||||
}
|
||||
|
||||
ASTReader::PerFileData::PerFileData()
|
||||
: StatCache(0), LocalNumSLocEntries(0), LocalNumTypes(0), TypeOffsets(0),
|
||||
LocalNumDecls(0), DeclOffsets(0), LocalNumIdentifiers(0),
|
||||
IdentifierOffsets(0), IdentifierTableData(0), IdentifierLookupTable(0),
|
||||
LocalNumMacroDefinitions(0), MacroDefinitionOffsets(0),
|
||||
NumPreallocatedPreprocessingEntities(0), SelectorLookupTable(0),
|
||||
SelectorLookupTableData(0), SelectorOffsets(0), LocalNumSelectors(0)
|
||||
{}
|
||||
|
||||
ASTReader::PerFileData::~PerFileData() {
|
||||
delete static_cast<ASTIdentifierLookupTable *>(IdentifierLookupTable);
|
||||
delete static_cast<ASTSelectorLookupTable *>(SelectorLookupTable);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user