[cfe-commits] r67918 - /cfe/trunk/include/clang/AST/DeclBase.h

Chris Lattner sabre at nondot.org
Fri Mar 27 22:59:45 PDT 2009


Author: lattner
Date: Sat Mar 28 00:59:45 2009
New Revision: 67918

URL: http://llvm.org/viewvc/llvm-project?rev=67918&view=rev
Log:
simplify getNextDeclInScope

Modified:
    cfe/trunk/include/clang/AST/DeclBase.h

Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=67918&r1=67917&r2=67918&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Sat Mar 28 00:59:45 2009
@@ -181,6 +181,9 @@
   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 @@
   /// 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 @@
     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::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.





More information about the cfe-commits mailing list