mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:06:21 +01:00
[clangd] Fix readability-else-after-return 'Adding a note without main diagnostic' crash
Fix a crash in clangd caused by an (admittidly incorrect) Remark diagnositic being emitted from readability-else-after-return. This crash doesn't occur in clang-tidy so there are no tests there for this. Reviewed By: hokein Differential Revision: https://reviews.llvm.org/D81785
This commit is contained in:
@@ -188,9 +188,8 @@ void ElseAfterReturnCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
if (IsLastInScope) {
|
||||
// If the if statement is the last statement its enclosing statements
|
||||
// scope, we can pull the decl out of the if statement.
|
||||
DiagnosticBuilder Diag =
|
||||
diag(ElseLoc, WarningMessage, clang::DiagnosticIDs::Level::Remark)
|
||||
<< ControlFlowInterruptor;
|
||||
DiagnosticBuilder Diag = diag(ElseLoc, WarningMessage)
|
||||
<< ControlFlowInterruptor;
|
||||
if (checkInitDeclUsageInElse(If) != nullptr) {
|
||||
Diag << tooling::fixit::createReplacement(
|
||||
SourceRange(If->getIfLoc()),
|
||||
|
||||
Reference in New Issue
Block a user