diff options
author | Anders Carlsson <andersca@mac.com> | 2008-02-16 03:37:41 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2008-02-16 03:37:41 +0000 |
commit | acea415ec52a45be64f32e6ade8dc325b4e77ee4 (patch) | |
tree | fb45ae13794f88773744c41a11ffa02a226feffe | |
parent | 652e4618e26112806b7c228a94e4e163e386a43b (diff) | |
download | bcm5719-llvm-acea415ec52a45be64f32e6ade8dc325b4e77ee4.tar.gz bcm5719-llvm-acea415ec52a45be64f32e6ade8dc325b4e77ee4.zip |
More comments from Chris.
llvm-svn: 47210
-rw-r--r-- | clang/AST/Decl.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/clang/AST/Decl.cpp b/clang/AST/Decl.cpp index 04d0d3cac2b..5d68927b82f 100644 --- a/clang/AST/Decl.cpp +++ b/clang/AST/Decl.cpp @@ -259,18 +259,18 @@ void Decl::addDeclKind(const Kind k) { // Out-of-line virtual method providing a home for Decl. Decl::~Decl() { - if (!DeclAttrs) + if (!HasAttrs) return; DeclAttrMapTy::iterator it = DeclAttrs->find(this); - if (it != DeclAttrs->end()) { - delete it->second; - DeclAttrs->erase(it); - if (DeclAttrs->empty()) { - delete DeclAttrs; - DeclAttrs = 0; - } - } + assert(it != DeclAttrs->end() && "No attrs found but HasAttrs is true!"); + + delete it->second; + DeclAttrs->erase(it); + if (DeclAttrs->empty()) { + delete DeclAttrs; + DeclAttrs = 0; + } } void Decl::addAttr(Attr *newattr) @@ -278,7 +278,7 @@ void Decl::addAttr(Attr *newattr) if (!DeclAttrs) DeclAttrs = new llvm::DenseMap<const Decl*, Attr*>; - Attr *&attr = DeclAttrs->FindAndConstruct(this).second; + Attr *&attr = (*DeclAttrs)[this]; newattr->setNext(attr); attr = newattr; @@ -288,10 +288,10 @@ void Decl::addAttr(Attr *newattr) const Attr *Decl::getAttrs() const { - if (!HasAttrs || !DeclAttrs) + if (!HasAttrs) return 0; - return DeclAttrs->find(this)->second; + return (*DeclAttrs)[this]; } const char *NamedDecl::getName() const { |