diff options
| author | Ted Kremenek <kremenek@apple.com> | 2013-02-21 21:40:44 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2013-02-21 21:40:44 +0000 |
| commit | c6ebda167f524ae32f2c2b97d7b1a2de76013ce7 (patch) | |
| tree | 93eaace3987eca8f161b8ccd7f2ec18fd652a1f3 /clang/lib | |
| parent | c6301bfafb80970f14d82b1d22847bbadb09b838 (diff) | |
| download | llvm-c6ebda167f524ae32f2c2b97d7b1a2de76013ce7.zip llvm-c6ebda167f524ae32f2c2b97d7b1a2de76013ce7.tar.gz llvm-c6ebda167f524ae32f2c2b97d7b1a2de76013ce7.tar.bz2 | |
Teach serialized diagnostics about notes without locations.
Along the way, improve a diagnostic for "previous declaration here" for implicit parameters.
Fixes <rdar://problem/13211384>.
llvm-svn: 175802
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Frontend/SerializedDiagnosticPrinter.cpp | 10 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 9 |
2 files changed, 17 insertions, 2 deletions
diff --git a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp index 8eb0e40..4bb662b 100644 --- a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp @@ -543,8 +543,18 @@ void SDiagsWriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, // Special-case diagnostics with no location. We may not have entered a // source file in this case, so we can't use the normal DiagnosticsRenderer // machinery. + + // Make sure we bracket all notes as "sub-diagnostics". This matches + // the behavior in SDiagsRenderer::emitDiagnostic(). + if (DiagLevel == DiagnosticsEngine::Note) + EnterDiagBlock(); + EmitDiagnosticMessage(SourceLocation(), PresumedLoc(), DiagLevel, State->diagBuf, 0, &Info); + + if (DiagLevel == DiagnosticsEngine::Note) + ExitDiagBlock(); + return; } diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 2858f36..7411e80 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1672,9 +1672,14 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, << SS.getRange() << FixItHint::CreateReplacement(Corrected.getCorrectionRange(), CorrectedStr); - if (ND) - Diag(ND->getLocation(), diag::note_previous_decl) + if (ND) { + unsigned diag = isa<ImplicitParamDecl>(ND) + ? diag::note_implicit_param_decl + : diag::note_previous_decl; + + Diag(ND->getLocation(), diag) << CorrectedQuotedStr; + } // Tell the callee to try to recover. return false; |
