DeclContext::~DeclContext() {
unsigned Size = LookupPtr.getInt();
- if (Size == LookupIsMap) {
- StoredDeclsMap *Map = static_cast<StoredDeclsMap*>(LookupPtr.getPointer());
- delete Map;
- } else {
- NamedDecl **Array = static_cast<NamedDecl**>(LookupPtr.getPointer());
- delete [] Array;
- }
+ if (Size == LookupIsMap)
+ delete static_cast<StoredDeclsMap*>(LookupPtr.getPointer());
+ else
+ delete [] static_cast<NamedDecl**>(LookupPtr.getPointer());
}
void DeclContext::DestroyDecls(ASTContext &C) {
if (isLookupMap()) {
StoredDeclsMap *Map = static_cast<StoredDeclsMap*>(LookupPtr.getPointer());
StoredDeclsMap::iterator Pos = Map->find(Name);
- if (Pos != Map->end())
- return lookup_result(&Pos->second.front(),
- &Pos->second.front() + Pos->second.size());
- return lookup_result(0, 0);
+ if (Pos == Map->end())
+ return lookup_result(0, 0);
+
+ return lookup_result(&Pos->second.front(),
+ &Pos->second.front() + Pos->second.size());
}
// We have a small array. Look into it.
DeclNameEntries.push_back(D);
return;
}
-
+
if (MayBeRedeclaration) {
// Determine if this declaration is actually a redeclaration.
std::vector<NamedDecl *>::iterator Redecl
return;
}
}
-
+
// Put this declaration into the appropriate slot.
if (isa<UsingDirectiveDecl>(D) ||
- D->getIdentifierNamespace() == Decl::IDNS_Tag ||
- DeclNameEntries.empty())
+ D->getIdentifierNamespace() == Decl::IDNS_Tag)
DeclNameEntries.push_back(D);
else if (DeclNameEntries.back()->getIdentifierNamespace() == Decl::IDNS_Tag) {
NamedDecl *TagD = DeclNameEntries.back();