From: Chris Lattner Date: Sat, 28 Mar 2009 05:59:45 +0000 (+0000) Subject: simplify getNextDeclInScope X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=96f4468b6b1bf69bb01c1207f716a3ffaeb4a8d3;p=clang simplify getNextDeclInScope git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67918 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index 86626fe388..b884738995 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -181,6 +181,9 @@ public: Kind getKind() const { return DeclKind; } const char *getDeclKindName() const; + Decl *getNextDeclInScope() { return NextDeclInScope; } + const Decl *getNextDeclInScope() const { return NextDeclInScope; } + DeclContext *getDeclContext() { if (isInSemaDC()) return getSemanticDC(); @@ -375,8 +378,6 @@ class DeclContext { /// DenseMap. Othewise, it is an array. bool isLookupMap() const { return LookupPtr.getInt() == LookupIsMap; } - static Decl *getNextDeclInScope(Decl *D) { return D->NextDeclInScope; } - protected: DeclContext(Decl::Kind K) : DeclKind(K), LookupPtr(), FirstDecl(0), LastDecl(0) { } @@ -527,7 +528,10 @@ public: reference operator*() const { return Current; } pointer operator->() const { return Current; } - decl_iterator& operator++(); + decl_iterator& operator++() { + Current = Current->getNextDeclInScope(); + return *this; + } decl_iterator operator++(int) { decl_iterator tmp(*this); @@ -779,13 +783,7 @@ inline bool Decl::isTemplateParameter() const { inline bool Decl::isDefinedOutsideFunctionOrMethod() const { if (getDeclContext()) return !getDeclContext()->getLookupContext()->isFunctionOrMethod(); - else - return true; -} - -inline DeclContext::decl_iterator& DeclContext::decl_iterator::operator++() { - Current = getNextDeclInScope(Current); - return *this; + return true; } } // end clang.