[cfe-commits] r135720 - in /cfe/trunk: include/clang/Serialization/ASTReader.h lib/Serialization/ASTReader.cpp lib/Serialization/ASTReaderDecl.cpp
Douglas Gregor
dgregor at apple.com
Thu Jul 21 16:29:11 PDT 2011
Author: dgregor
Date: Thu Jul 21 18:29:11 2011
New Revision: 135720
URL: http://llvm.org/viewvc/llvm-project?rev=135720&view=rev
Log:
Clean up the rest of the local -> global declaration ID mappings
within the ASTReader (I hope).
Modified:
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=135720&r1=135719&r2=135720&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Thu Jul 21 18:29:11 2011
@@ -514,6 +514,7 @@
/// \brief Information about the contents of a DeclContext.
struct DeclContextInfo {
+ PerFileData *F;
void *NameLookupTableData; // a ASTDeclContextNameLookupTable.
const serialization::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=135720&r1=135719&r2=135720&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu Jul 21 18:29:11 2011
@@ -719,7 +719,7 @@
if (DataLen > 0) {
llvm::SmallVector<uint32_t, 4> DeclIDs;
for (; DataLen > 0; DataLen -= 4)
- DeclIDs.push_back(ReadUnalignedLE32(d));
+ DeclIDs.push_back(Reader.getGlobalDeclID(F, ReadUnalignedLE32(d)));
Reader.SetGloballyVisibleDecls(II, DeclIDs);
}
@@ -2062,6 +2062,7 @@
case TU_UPDATE_LEXICAL: {
DeclContextInfo Info = {
+ &F,
/* No visible information */ 0,
reinterpret_cast<const KindDeclIDPair *>(BlobStart),
BlobLen / sizeof(KindDeclIDPair)
@@ -2079,7 +2080,7 @@
ASTDeclContextNameLookupTrait(*this));
if (ID == 1 && Context) { // Is it the TU?
DeclContextInfo Info = {
- Table, /* No lexical inforamtion */ 0, 0
+ &F, Table, /* No lexical inforamtion */ 0, 0
};
DeclContextOffsets[Context->getTranslationUnitDecl()].push_back(Info);
} else
@@ -4121,9 +4122,7 @@
if (isKindWeWant && !isKindWeWant((Decl::Kind)ID->first))
continue;
- // FIXME: Modules need to know whether this is already mapped to a
- // global ID or not.
- Decl *D = GetDecl(ID->second);
+ Decl *D = GetLocalDecl(*I->F, ID->second);
assert(D && "Null decl in lexical decls");
Decls.push_back(D);
}
@@ -4158,11 +4157,9 @@
if (Pos == LookupTable->end())
continue;
- // FIXME: Modules need to know whether this is already mapped to a
- // global ID or not.
ASTDeclContextNameLookupTrait::data_type Data = *Pos;
for (; Data.first != Data.second; ++Data.first)
- Decls.push_back(cast<NamedDecl>(GetDecl(*Data.first)));
+ Decls.push_back(GetLocalDeclAs<NamedDecl>(*I->F, *Data.first));
break;
}
@@ -4194,10 +4191,8 @@
= *ItemI;
ASTDeclContextNameLookupTrait::data_type Data = Val.second;
Decls.clear();
- // FIXME: Modules need to know whether this is already mapped to a
- // global ID or not.
for (; Data.first != Data.second; ++Data.first)
- Decls.push_back(cast<NamedDecl>(GetDecl(*Data.first)));
+ Decls.push_back(GetLocalDeclAs<NamedDecl>(*I->F, *Data.first));
MaterializeVisibleDeclsForName(DC, Val.first, Decls);
}
}
@@ -4664,7 +4659,6 @@
}
for (unsigned I = 0, N = DeclIDs.size(); I != N; ++I) {
- // FIXME: Are these IDs local or global? It's not clear!
NamedDecl *D = cast<NamedDecl>(GetDecl(DeclIDs[I]));
if (SemaObj) {
if (SemaObj->TUScope) {
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=135720&r1=135719&r2=135720&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Thu Jul 21 18:29:11 2011
@@ -1688,6 +1688,7 @@
DC->setHasExternalLexicalStorage(Offsets.first != 0);
DC->setHasExternalVisibleStorage(Offsets.second != 0);
DeclContextInfo Info;
+ Info.F = Loc.F;
if (ReadDeclContextStorage(DeclsCursor, Offsets, Info))
return 0;
DeclContextInfos &Infos = DeclContextOffsets[DC];
@@ -1707,6 +1708,7 @@
DeclContextVisibleUpdates &U = I->second;
DeclContextInfos &Infos = DeclContextOffsets[DC];
DeclContextInfo Info;
+ Info.F = Loc.F;
Info.LexicalDecls = 0;
Info.NumLexicalDecls = 0;
for (DeclContextVisibleUpdates::iterator UI = U.begin(), UE = U.end();
More information about the cfe-commits
mailing list