r203548 - Revert C++11ification in r203534 and r203536. Apparently our toolchains aren't
Richard Smith
richard-llvm at metafoo.co.uk
Tue Mar 11 00:17:35 PDT 2014
Author: rsmith
Date: Tue Mar 11 02:17:35 2014
New Revision: 203548
URL: http://llvm.org/viewvc/llvm-project?rev=203548&view=rev
Log:
Revert C++11ification in r203534 and r203536. Apparently our toolchains aren't
ready for this yet.
Modified:
cfe/trunk/include/clang/Serialization/Module.h
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/Module.cpp
Modified: cfe/trunk/include/clang/Serialization/Module.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/Module.h?rev=203548&r1=203547&r2=203548&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/Module.h (original)
+++ cfe/trunk/include/clang/Serialization/Module.h Tue Mar 11 02:17:35 2014
@@ -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;
};
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=203548&r1=203547&r2=203548&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Tue Mar 11 02:17:35 2014
@@ -457,14 +457,6 @@ ASTReader::setDeserializationListener(AS
}
-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(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
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
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=203548&r1=203547&r2=203548&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Tue Mar 11 02:17:35 2014
@@ -2609,9 +2609,11 @@ Decl *ASTReader::ReadDeclRecord(DeclID I
// 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);
}
}
Modified: cfe/trunk/lib/Serialization/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/Module.cpp?rev=203548&r1=203547&r2=203548&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/Module.cpp (original)
+++ cfe/trunk/lib/Serialization/Module.cpp Tue Mar 11 02:17:35 2014
@@ -45,6 +45,13 @@ ModuleFile::ModuleFile(ModuleKind Kind,
{}
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);
More information about the cfe-commits
mailing list