forked from OSchip/llvm-project
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
This commit is contained in:
parent
c6301bfafb
commit
c6ebda167f
|
@ -1090,6 +1090,7 @@ def note_field_decl : Note<"member is declared here">;
|
||||||
def note_ivar_decl : Note<"instance variable is declared here">;
|
def note_ivar_decl : Note<"instance variable is declared here">;
|
||||||
def note_bitfield_decl : Note<"bit-field is declared here">;
|
def note_bitfield_decl : Note<"bit-field is declared here">;
|
||||||
def note_previous_decl : Note<"%0 declared here">;
|
def note_previous_decl : Note<"%0 declared here">;
|
||||||
|
def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
|
||||||
def note_member_synthesized_at : Note<
|
def note_member_synthesized_at : Note<
|
||||||
"implicit default %select{constructor|copy constructor|move constructor|copy "
|
"implicit default %select{constructor|copy constructor|move constructor|copy "
|
||||||
"assignment operator|move assignment operator|destructor}0 for %1 first "
|
"assignment operator|move assignment operator|destructor}0 for %1 first "
|
||||||
|
|
|
@ -543,8 +543,18 @@ void SDiagsWriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||||
// Special-case diagnostics with no location. We may not have entered a
|
// 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
|
// source file in this case, so we can't use the normal DiagnosticsRenderer
|
||||||
// machinery.
|
// 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,
|
EmitDiagnosticMessage(SourceLocation(), PresumedLoc(), DiagLevel,
|
||||||
State->diagBuf, 0, &Info);
|
State->diagBuf, 0, &Info);
|
||||||
|
|
||||||
|
if (DiagLevel == DiagnosticsEngine::Note)
|
||||||
|
ExitDiagBlock();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1672,9 +1672,14 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
|
||||||
<< SS.getRange()
|
<< SS.getRange()
|
||||||
<< FixItHint::CreateReplacement(Corrected.getCorrectionRange(),
|
<< FixItHint::CreateReplacement(Corrected.getCorrectionRange(),
|
||||||
CorrectedStr);
|
CorrectedStr);
|
||||||
if (ND)
|
if (ND) {
|
||||||
Diag(ND->getLocation(), diag::note_previous_decl)
|
unsigned diag = isa<ImplicitParamDecl>(ND)
|
||||||
|
? diag::note_implicit_param_decl
|
||||||
|
: diag::note_previous_decl;
|
||||||
|
|
||||||
|
Diag(ND->getLocation(), diag)
|
||||||
<< CorrectedQuotedStr;
|
<< CorrectedQuotedStr;
|
||||||
|
}
|
||||||
|
|
||||||
// Tell the callee to try to recover.
|
// Tell the callee to try to recover.
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue