summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-20 00:55:03 +0000
committerChris Lattner <sabre@nondot.org>2009-02-20 00:55:03 +0000
commit24e24d51a13f9e837e4340feae1b9541fb44a2c1 (patch)
treed4e70f9a336ef36cd6da8718786bd94a03445113 /clang/lib/AST/DeclBase.cpp
parent2a9baebae1bd4d1f025973085739eb8091de9aa1 (diff)
downloadbcm5719-llvm-24e24d51a13f9e837e4340feae1b9541fb44a2c1.tar.gz
bcm5719-llvm-24e24d51a13f9e837e4340feae1b9541fb44a2c1.zip
slight code simplifications.
llvm-svn: 65094
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r--clang/lib/AST/DeclBase.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index d244637af7f..8b040538460 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -280,13 +280,10 @@ typedef llvm::DenseMap<DeclarationName, std::vector<NamedDecl*> >
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 @@ DeclContext::lookup(DeclarationName Name) {
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 @@ void DeclContext::makeDeclVisibleInContextImpl(NamedDecl *D) {
DeclNameEntries.push_back(D);
return;
}
-
+
if (MayBeRedeclaration) {
// Determine if this declaration is actually a redeclaration.
std::vector<NamedDecl *>::iterator Redecl
@@ -578,11 +576,10 @@ void DeclContext::makeDeclVisibleInContextImpl(NamedDecl *D) {
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();
OpenPOWER on IntegriCloud