diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-19 17:26:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-19 17:26:29 +0000 |
commit | 90a1a65194237f0fcd2c4bf847e0e8b4c419061c (patch) | |
tree | 9c3656f0c03a47912d4d1786159b9185af05e29d /clang/lib/Sema/SemaCXXScopeSpec.cpp | |
parent | e4f361212b8aa2e0d587a6d173b3fb48808d400d (diff) | |
download | bcm5719-llvm-90a1a65194237f0fcd2c4bf847e0e8b4c419061c.tar.gz bcm5719-llvm-90a1a65194237f0fcd2c4bf847e0e8b4c419061c.zip |
Introduce a new expression type, UnresolvedDeclRefExpr, that describes
dependent qualified-ids such as
Fibonacci<N - 1>::value
where N is a template parameter. These references are "unresolved"
because the name is dependent and, therefore, cannot be resolved to a
declaration node (as we would do for a DeclRefExpr or
QualifiedDeclRefExpr). UnresolvedDeclRefExprs instantiate to
DeclRefExprs, QualifiedDeclRefExprs, etc.
Also, be a bit more careful about keeping only a single set of
specializations for a class template, and instantiating from the
definition of that template rather than a previous declaration. In
general, we need a better solution for this for all TagDecls, because
it's too easy to accidentally look at a declaration that isn't the
definition.
We can now process a simple Fibonacci computation described as a
template metaprogram.
llvm-svn: 67308
Diffstat (limited to 'clang/lib/Sema/SemaCXXScopeSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCXXScopeSpec.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp index 156f3a12fbb..9e1196143b6 100644 --- a/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -29,6 +29,21 @@ DeclContext *Sema::computeDeclContext(const CXXScopeSpec &SS) { return NNS.computeDeclContext(Context); } +bool Sema::isDependentScopeSpecifier(const CXXScopeSpec &SS) { + if (!SS.isSet() || SS.isInvalid()) + return false; + + NestedNameSpecifier NNS + = NestedNameSpecifier::getFromOpaquePtr(SS.getCurrentScopeRep()); + + if (Type *T = NNS.getAsType()) + return T->isDependentType(); + + // FIXME: What about the injected-class-name of a class template? It + // is dependent, but we represent it as a declaration. + return false; +} + /// \brief Require that the context specified by SS be complete. /// /// If SS refers to a type, this routine checks whether the type is |