[cfe-commits] r38917 - /cfe/cfe/trunk/include/clang/Parse/Scope.h

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:25:44 PDT 2007


Author: sabre
Date: Wed Jul 11 11:25:44 2007
New Revision: 38917

URL: http://llvm.org/viewvc/llvm-project?rev=38917&view=rev
Log:
Add accessors for scope info.

Modified:
    cfe/cfe/trunk/include/clang/Parse/Scope.h

Modified: cfe/cfe/trunk/include/clang/Parse/Scope.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/Scope.h?rev=38917&r1=38916&r2=38917&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Scope.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Scope.h Wed Jul 11 11:25:44 2007
@@ -14,11 +14,11 @@
 #ifndef LLVM_CLANG_PARSE_SCOPE_H
 #define LLVM_CLANG_PARSE_SCOPE_H
 
+#include "clang/Parse/Action.h"
 #include "llvm/ADT/SmallVector.h"
 
 namespace llvm {
 namespace clang {
-  class Decl;
     
 /// Scope - A scope is a transient data structure that is used while parsing the
 /// program.  It assists with resolving identifiers to the appropriate
@@ -37,8 +37,9 @@
   /// the declaration is added to the scope, it is set as the current
   /// declaration for the identifier in the IdentifierTable.  When the scope is
   /// popped, these declarations are removed from the IdentifierTable's notion
-  /// of current declaration.
-  SmallVector<Decl*, 32> DeclsInScope;
+  /// of current declaration.  It is up to the current Action implementation to
+  /// implement these semantics.
+  SmallVector<Action::DeclTy*, 32> DeclsInScope;
 public:
   Scope(Scope *parent) : Parent(parent), Depth(Parent ? Parent->Depth+1 : 0) {
   }
@@ -47,6 +48,19 @@
   ///
   Scope *getParent() const { return Parent; }
   
+  typedef SmallVector<Action::DeclTy*, 32>::iterator decl_iterator;
+  typedef SmallVector<Action::DeclTy*, 32>::const_iterator decl_const_iterator;
+  
+  decl_iterator decl_begin() { return DeclsInScope.begin(); }
+  decl_iterator decl_end()   { return DeclsInScope.end(); }
+
+  decl_const_iterator decl_begin() const { return DeclsInScope.begin(); }
+  decl_const_iterator decl_end()   const { return DeclsInScope.end(); }
+
+  void AddDecl(Action::DeclTy *D) {
+    DeclsInScope.push_back(D);
+  }
+  
 };
     
 }  // end namespace clang





More information about the cfe-commits mailing list