Skip to content

Commit 6319930

Browse files
committed
[Diagnostics] Call setMapping on the correct diagnostic states in a few places. GetCurDiagState() was being used when it shouldn't be.
I spotted this by inspection in the for loop that wasn't using its iterator and was just acting on the current state repeatedly. This appears to have been introduced as a copy and paste bug in r140763 over 4 years ago. I have no idea how to test this. I just went back to the original commit and tried to use the variables it was using before that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254134 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 5a36f5a commit 6319930

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Basic/Diagnostic.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,12 @@ void DiagnosticsEngine::setSeverity(diag::kind Diag, diag::Severity Map,
226226
// Update all diagnostic states that are active after the given location.
227227
for (DiagStatePointsTy::iterator
228228
I = Pos+1, E = DiagStatePoints.end(); I != E; ++I) {
229-
GetCurDiagState()->setMapping(Diag, Mapping);
229+
I->State->setMapping(Diag, Mapping);
230230
}
231231

232232
// If the location corresponds to an existing point, just update its state.
233233
if (Pos->Loc == Loc) {
234-
GetCurDiagState()->setMapping(Diag, Mapping);
234+
Pos->State->setMapping(Diag, Mapping);
235235
return;
236236
}
237237

@@ -240,7 +240,7 @@ void DiagnosticsEngine::setSeverity(diag::kind Diag, diag::Severity Map,
240240
assert(Pos->Loc.isBeforeInTranslationUnitThan(Loc));
241241
DiagStates.push_back(*Pos->State);
242242
DiagState *NewState = &DiagStates.back();
243-
GetCurDiagState()->setMapping(Diag, Mapping);
243+
NewState->setMapping(Diag, Mapping);
244244
DiagStatePoints.insert(Pos+1, DiagStatePoint(NewState,
245245
FullSourceLoc(Loc, *SourceMgr)));
246246
}

0 commit comments

Comments
 (0)