diff options
author | Craig Topper <craig.topper@gmail.com> | 2015-11-26 05:51:54 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2015-11-26 05:51:54 +0000 |
commit | 5e35e669a58fad4f39ecea7289f5271fe89dafb9 (patch) | |
tree | 436a44fb8ba74c27b481db8c80f37cd3183dd8c0 | |
parent | a52e2b22e68e427972f72188073b1c74a4758ebd (diff) | |
download | bcm5719-llvm-5e35e669a58fad4f39ecea7289f5271fe89dafb9.tar.gz bcm5719-llvm-5e35e669a58fad4f39ecea7289f5271fe89dafb9.zip |
[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.
llvm-svn: 254134
-rw-r--r-- | clang/lib/Basic/Diagnostic.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp index a49ed25a1ee..7cf7305827f 100644 --- a/clang/lib/Basic/Diagnostic.cpp +++ b/clang/lib/Basic/Diagnostic.cpp @@ -226,12 +226,12 @@ void DiagnosticsEngine::setSeverity(diag::kind Diag, diag::Severity Map, // Update all diagnostic states that are active after the given location. for (DiagStatePointsTy::iterator I = Pos+1, E = DiagStatePoints.end(); I != E; ++I) { - GetCurDiagState()->setMapping(Diag, Mapping); + I->State->setMapping(Diag, Mapping); } // If the location corresponds to an existing point, just update its state. if (Pos->Loc == Loc) { - GetCurDiagState()->setMapping(Diag, Mapping); + Pos->State->setMapping(Diag, Mapping); return; } @@ -240,7 +240,7 @@ void DiagnosticsEngine::setSeverity(diag::kind Diag, diag::Severity Map, assert(Pos->Loc.isBeforeInTranslationUnitThan(Loc)); DiagStates.push_back(*Pos->State); DiagState *NewState = &DiagStates.back(); - GetCurDiagState()->setMapping(Diag, Mapping); + NewState->setMapping(Diag, Mapping); DiagStatePoints.insert(Pos+1, DiagStatePoint(NewState, FullSourceLoc(Loc, *SourceMgr))); } |