diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-08-26 00:04:55 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-08-26 00:04:55 +0000 |
commit | dacd434c49658286c380c7b4c357d76d53cb4aa1 (patch) | |
tree | 96445b18410c013f21aabb19f3fe17348fbfb225 /lib/Sema/Sema.cpp | |
parent | ec7738776ba68576db5d8316af399d1f983245ee (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/Sema.cpp')
-rw-r--r-- | lib/Sema/Sema.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 5425c4fb5a..24c5e09f43 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -79,8 +79,7 @@ static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val, else assert(ModLen == 0 && ArgLen == 0 && "Invalid modifier for DeclarationName argument"); - } else { - assert(Kind == Diagnostic::ak_nameddecl); + } else if (Kind == Diagnostic::ak_nameddecl) { if (ModLen == 1 && Modifier[0] == 'q' && ArgLen == 0) S = reinterpret_cast<NamedDecl*>(Val)->getQualifiedNameAsString(); else { @@ -88,6 +87,11 @@ static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val, "Invalid modifier for NamedDecl* argument"); S = reinterpret_cast<NamedDecl*>(Val)->getNameAsString(); } + } else { + llvm::raw_string_ostream OS(S); + assert(Kind == Diagnostic::ak_nestednamespec); + reinterpret_cast<NestedNameSpecifier*> (Val)->print(OS, + Context.PrintingPolicy); } Output.push_back('\''); |