diff options
| author | Douglas Gregor <dgregor@apple.com> | 2008-12-05 18:15:24 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2008-12-05 18:15:24 +0000 |
| commit | 5101c24f60997b3775624f5c9488ded8e9f3cdf2 (patch) | |
| tree | 2807802cd135f700026aa90f8d842508b2630d5a /clang/include/clang/Parse/Scope.h | |
| parent | 43c08918389ca2f928a94a4f2a5faa256a10e8e4 (diff) | |
| download | bcm5719-llvm-5101c24f60997b3775624f5c9488ded8e9f3cdf2.tar.gz bcm5719-llvm-5101c24f60997b3775624f5c9488ded8e9f3cdf2.zip | |
Representation of template type parameters and non-type template
parameters, with some semantic analysis:
- Template parameters are introduced into template parameter scope
- Complain about template parameter shadowing (except in Microsoft mode)
Note that we leak template parameter declarations like crazy, a
problem we'll remedy once we actually create proper declarations for
templates.
Next up: dependent types and value-dependent/type-dependent
expressions.
llvm-svn: 60597
Diffstat (limited to 'clang/include/clang/Parse/Scope.h')
| -rw-r--r-- | clang/include/clang/Parse/Scope.h | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/clang/include/clang/Parse/Scope.h b/clang/include/clang/Parse/Scope.h index 8cb2f7434cc..5695fc0be19 100644 --- a/clang/include/clang/Parse/Scope.h +++ b/clang/include/clang/Parse/Scope.h @@ -87,7 +87,13 @@ private: /// BlockParent - This is a direct link to the immediately containing /// BlockScope if this scope is not one, or null if there is none. Scope *BlockParent; - + + /// TemplateParamParent - This is a direct link to the + /// immediately containing template parameter scope. In the + /// case of nested templates, template parameter scopes can have + /// other template parameter scopes as parents. + Scope *TemplateParamParent; + /// DeclsInScope - This keeps track of all declarations in this scope. When /// the declaration is added to the scope, it is set as the current /// declaration for the identifier in the IdentifierTable. When the scope is @@ -147,6 +153,9 @@ public: Scope *getBlockParent() { return BlockParent; } const Scope *getBlockParent() const { return BlockParent; } + + Scope *getTemplateParamParent() { return TemplateParamParent; } + const Scope *getTemplateParamParent() const { return TemplateParamParent; } typedef DeclSetTy::iterator decl_iterator; decl_iterator decl_begin() const { return DeclsInScope.begin(); } @@ -196,18 +205,20 @@ public: BreakParent = AnyParent->BreakParent; ContinueParent = AnyParent->ContinueParent; BlockParent = AnyParent->BlockParent; + TemplateParamParent = AnyParent->TemplateParamParent; } else { FnParent = BreakParent = ContinueParent = BlockParent = 0; + TemplateParamParent = 0; } // If this scope is a function or contains breaks/continues, remember it. - if (Flags & FnScope) FnParent = this; - if (Flags & BreakScope) BreakParent = this; - if (Flags & ContinueScope) ContinueParent = this; - if (Flags & BlockScope) BlockParent = this; - + if (Flags & FnScope) FnParent = this; + if (Flags & BreakScope) BreakParent = this; + if (Flags & ContinueScope) ContinueParent = this; + if (Flags & BlockScope) BlockParent = this; + if (Flags & TemplateParamScope) TemplateParamParent = this; DeclsInScope.clear(); - } + } }; } // end namespace clang |

