forked from OSchip/llvm-project
Revert C++11ification in r203534 and r203536. Apparently our toolchains aren't
ready for this yet. llvm-svn: 203548
This commit is contained in:
parent
9140dd2fe7
commit
52e3fbaee8
|
@ -44,20 +44,13 @@ enum ModuleKind {
|
|||
MK_MainFile ///< File is a PCH file treated as the actual main file.
|
||||
};
|
||||
|
||||
/// A custom deleter for DeclContextInfo::NameLookupTableData, to allow
|
||||
/// an incomplete type to be used there.
|
||||
struct NameLookupTableDataDeleter {
|
||||
void operator()(
|
||||
OnDiskChainedHashTable<reader::ASTDeclContextNameLookupTrait> *Ptr) const;
|
||||
};
|
||||
|
||||
/// \brief Information about the contents of a DeclContext.
|
||||
struct DeclContextInfo {
|
||||
DeclContextInfo();
|
||||
DeclContextInfo()
|
||||
: NameLookupTableData(), LexicalDecls(), NumLexicalDecls() {}
|
||||
|
||||
/// An ASTDeclContextNameLookupTable.
|
||||
std::unique_ptr<OnDiskChainedHashTable<reader::ASTDeclContextNameLookupTrait>,
|
||||
NameLookupTableDataDeleter> NameLookupTableData;
|
||||
OnDiskChainedHashTable<reader::ASTDeclContextNameLookupTrait>
|
||||
*NameLookupTableData; // an ASTDeclContextNameLookupTable.
|
||||
const KindDeclIDPair *LexicalDecls;
|
||||
unsigned NumLexicalDecls;
|
||||
};
|
||||
|
|
|
@ -457,14 +457,6 @@ ASTReader::setDeserializationListener(ASTDeserializationListener *Listener) {
|
|||
}
|
||||
|
||||
|
||||
DeclContextInfo::DeclContextInfo()
|
||||
: NameLookupTableData(), LexicalDecls(), NumLexicalDecls() {}
|
||||
|
||||
void NameLookupTableDataDeleter::
|
||||
operator()(ASTDeclContextNameLookupTable *Ptr) const {
|
||||
delete Ptr;
|
||||
}
|
||||
|
||||
|
||||
unsigned ASTSelectorLookupTrait::ComputeHash(Selector Sel) {
|
||||
return serialization::ComputeHash(Sel);
|
||||
|
@ -844,10 +836,11 @@ bool ASTReader::ReadDeclContextStorage(ModuleFile &M,
|
|||
Error("Expected visible lookup table block");
|
||||
return true;
|
||||
}
|
||||
Info.NameLookupTableData.reset(ASTDeclContextNameLookupTable::Create(
|
||||
(const unsigned char *)Blob.data() + Record[0],
|
||||
(const unsigned char *)Blob.data(),
|
||||
ASTDeclContextNameLookupTrait(*this, M)));
|
||||
Info.NameLookupTableData
|
||||
= ASTDeclContextNameLookupTable::Create(
|
||||
(const unsigned char *)Blob.data() + Record[0],
|
||||
(const unsigned char *)Blob.data(),
|
||||
ASTDeclContextNameLookupTrait(*this, M));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -2500,12 +2493,14 @@ bool ASTReader::ReadASTBlock(ModuleFile &F) {
|
|||
ASTDeclContextNameLookupTrait(*this, F));
|
||||
if (ID == PREDEF_DECL_TRANSLATION_UNIT_ID) { // Is it the TU?
|
||||
DeclContext *TU = Context.getTranslationUnitDecl();
|
||||
F.DeclContextInfos[TU].NameLookupTableData.reset(Table);
|
||||
F.DeclContextInfos[TU].NameLookupTableData = Table;
|
||||
TU->setHasExternalVisibleStorage(true);
|
||||
} else if (Decl *D = DeclsLoaded[ID - NUM_PREDEF_DECL_IDS]) {
|
||||
auto *DC = cast<DeclContext>(D);
|
||||
DC->getPrimaryContext()->setHasExternalVisibleStorage(true);
|
||||
F.DeclContextInfos[DC].NameLookupTableData.reset(Table);
|
||||
auto *&LookupTable = F.DeclContextInfos[DC].NameLookupTableData;
|
||||
delete LookupTable;
|
||||
LookupTable = Table;
|
||||
} else
|
||||
PendingVisibleUpdates[ID].push_back(std::make_pair(Table, &F));
|
||||
break;
|
||||
|
@ -6089,7 +6084,7 @@ namespace {
|
|||
return false;
|
||||
|
||||
// Look for this name within this module.
|
||||
const auto &LookupTable =
|
||||
ASTDeclContextNameLookupTable *LookupTable =
|
||||
Info->second.NameLookupTableData;
|
||||
ASTDeclContextNameLookupTable::iterator Pos
|
||||
= LookupTable->find(This->Name);
|
||||
|
@ -6219,7 +6214,7 @@ namespace {
|
|||
if (!FoundInfo)
|
||||
return false;
|
||||
|
||||
const auto &LookupTable =
|
||||
ASTDeclContextNameLookupTable *LookupTable =
|
||||
Info->second.NameLookupTableData;
|
||||
bool FoundAnything = false;
|
||||
for (ASTDeclContextNameLookupTable::data_iterator
|
||||
|
|
|
@ -2609,9 +2609,11 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) {
|
|||
// There are updates. This means the context has external visible
|
||||
// storage, even if the original stored version didn't.
|
||||
LookupDC->setHasExternalVisibleStorage(true);
|
||||
for (const auto &Update : I->second)
|
||||
Update.second->DeclContextInfos[DC].NameLookupTableData.reset(
|
||||
Update.first);
|
||||
for (const auto &Update : I->second) {
|
||||
DeclContextInfo &Info = Update.second->DeclContextInfos[DC];
|
||||
delete Info.NameLookupTableData;
|
||||
Info.NameLookupTableData = Update.first;
|
||||
}
|
||||
PendingVisibleUpdates.erase(I);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,13 @@ ModuleFile::ModuleFile(ModuleKind Kind, unsigned Generation)
|
|||
{}
|
||||
|
||||
ModuleFile::~ModuleFile() {
|
||||
for (DeclContextInfosMap::iterator I = DeclContextInfos.begin(),
|
||||
E = DeclContextInfos.end();
|
||||
I != E; ++I) {
|
||||
if (I->second.NameLookupTableData)
|
||||
delete I->second.NameLookupTableData;
|
||||
}
|
||||
|
||||
delete static_cast<ASTIdentifierLookupTable *>(IdentifierLookupTable);
|
||||
delete static_cast<HeaderFileInfoLookupTable *>(HeaderFileInfoTable);
|
||||
delete static_cast<ASTSelectorLookupTable *>(SelectorLookupTable);
|
||||
|
|
Loading…
Reference in New Issue