aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCXXScopeSpec.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-08-26 00:04:55 +0000
committerDouglas Gregor <dgregor@apple.com>2009-08-26 00:04:55 +0000
commitdacd434c49658286c380c7b4c357d76d53cb4aa1 (patch)
tree96445b18410c013f21aabb19f3fe17348fbfb225 /lib/Sema/SemaCXXScopeSpec.cpp
parentec7738776ba68576db5d8316af399d1f983245ee (diff)
Improve diagnostics and recovery when the nested-name-specifier of a
qualified name does not actually refer into a class/class template/class template partial specialization. Improve printing of nested-name-specifiers to eliminate redudant qualifiers. Also, make it possible to output a nested-name-specifier through a DiagnosticBuilder, although there are relatively few places that will use this leeway. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCXXScopeSpec.cpp')
-rw-r--r--lib/Sema/SemaCXXScopeSpec.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp
index 9c9bff8a08..3dac5d7297 100644
--- a/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/lib/Sema/SemaCXXScopeSpec.cpp
@@ -79,17 +79,6 @@ DeclContext *Sema::computeDeclContext(const CXXScopeSpec &SS,
// The nested name specifier refers to a member of a class template.
return RecordT->getDecl();
}
-
- std::string NNSString;
- {
- llvm::raw_string_ostream OS(NNSString);
- NNS->print(OS, Context.PrintingPolicy);
- }
-
- // FIXME: Allow us to pass a nested-name-specifier to Diag?
- Diag(SS.getRange().getBegin(),
- diag::err_template_qualified_declarator_no_match)
- << NNSString << SS.getRange();
}
return 0;
@@ -298,6 +287,9 @@ Sema::CXXScopeTy *Sema::ActOnCXXNestedNameSpecifier(Scope *S,
T.getTypePtr());
}
+ // FIXME: It would be nice to maintain the namespace alias name, then
+ // see through that alias when resolving the nested-name-specifier down to
+ // a declaration context.
if (NamespaceAliasDecl *Alias = dyn_cast<NamespaceAliasDecl>(SD))
return NestedNameSpecifier::Create(Context, Prefix,
Alias->getNamespace());
@@ -404,8 +396,6 @@ void Sema::ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
if (DeclContext *DC = computeDeclContext(SS, true))
EnterDeclaratorContext(S, DC);
- else
- const_cast<CXXScopeSpec&>(SS).setScopeRep(0);
}
/// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
@@ -415,8 +405,8 @@ void Sema::ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
/// defining scope.
void Sema::ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS) {
assert(SS.isSet() && "Parser passed invalid CXXScopeSpec.");
- assert((SS.isInvalid() || S->getEntity() == computeDeclContext(SS, true)) &&
- "Context imbalance!");
- if (!SS.isInvalid())
+ if (SS.isInvalid())
+ return;
+ if (computeDeclContext(SS, true))
ExitDeclaratorContext(S);
}