[cfe-commits] r65094 - /cfe/trunk/lib/AST/DeclBase.cpp
Chris Lattner
sabre at nondot.org
Thu Feb 19 16:55:04 PST 2009
Author: lattner
Date: Thu Feb 19 18:55:03 2009
New Revision: 65094
URL: http://llvm.org/viewvc/llvm-project?rev=65094&view=rev
Log:
slight code simplifications.
Modified:
cfe/trunk/lib/AST/DeclBase.cpp
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=65094&r1=65093&r2=65094&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Thu Feb 19 18:55:03 2009
@@ -280,13 +280,10 @@
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) {
@@ -412,10 +409,11 @@
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.
@@ -566,7 +564,7 @@
DeclNameEntries.push_back(D);
return;
}
-
+
if (MayBeRedeclaration) {
// Determine if this declaration is actually a redeclaration.
std::vector<NamedDecl *>::iterator Redecl
@@ -578,11 +576,10 @@
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();
More information about the cfe-commits
mailing list