]> granicus.if.org Git - clang/commit
DiagnosticsEngine should clear DelayedDiagID before reporting the
authorAlex Lorenz <arphaman@gmail.com>
Thu, 4 May 2017 13:56:51 +0000 (13:56 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Thu, 4 May 2017 13:56:51 +0000 (13:56 +0000)
commitb30065414741792119dd9c4e24484075edc356e3
tree1fc3dc49edee047f4e29eba1b7278ed702042870
parent6f78f4aa2043e30913c1352b09f6c0816e3a4b73
DiagnosticsEngine should clear DelayedDiagID before reporting the
delayed diagnostic

This fix avoids an infinite recursion that was uncovered in one of our internal
tests by r301992. The testcase is the most reduced version of that
auto-generated test.

This is an improved version of the reverted commit r302037. The previous fix
actually managed to expose another subtle bug whereby `fatal_too_many_errors`
error was reported twice, with the second report setting the
`FatalErrorOccurred` flag. That prevented the notes that followed the diagnostic
the caused `fatal_too_many_errors` to be emitted. This commit ensures that notes
that follow `fatal_too_many_errors` but that belong to the diagnostic that
caused `fatal_too_many_errors` won't be emitted by setting the
`FatalErrorOccurred` when emitting `fatal_too_many_errors`.

rdar://31962618

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302151 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Basic/Diagnostic.cpp
lib/Basic/DiagnosticIDs.cpp
test/Index/KeepGoingWithLotsOfErrors.mm [new file with mode: 0644]