diff options
-rw-r--r-- | clang/lib/Basic/Diagnostic.cpp | 3 | ||||
-rw-r--r-- | clang/test/Index/KeepGoingWithLotsOfErrors.mm | 29 |
2 files changed, 31 insertions, 1 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp index 6bdef78c074..2cd400dbd71 100644 --- a/clang/lib/Basic/Diagnostic.cpp +++ b/clang/lib/Basic/Diagnostic.cpp @@ -146,8 +146,9 @@ void DiagnosticsEngine::SetDelayedDiagnostic(unsigned DiagID, StringRef Arg1, } void DiagnosticsEngine::ReportDelayed() { - Report(DelayedDiagID) << DelayedDiagArg1 << DelayedDiagArg2; + unsigned ID = DelayedDiagID; DelayedDiagID = 0; + Report(ID) << DelayedDiagArg1 << DelayedDiagArg2; DelayedDiagArg1.clear(); DelayedDiagArg2.clear(); } diff --git a/clang/test/Index/KeepGoingWithLotsOfErrors.mm b/clang/test/Index/KeepGoingWithLotsOfErrors.mm new file mode 100644 index 00000000000..014461725bd --- /dev/null +++ b/clang/test/Index/KeepGoingWithLotsOfErrors.mm @@ -0,0 +1,29 @@ +// RUN: env CINDEXTEST_KEEP_GOING=1 c-index-test -code-completion-at=%s:25:1 %s +// Shouldn't crash! +// This is the minimized test that triggered an infinite loop: + ++(BOOL) onEntity { +} + +-(const Object &) a_200 { +} + +-(int) struct { +} + +-(int) bar { +} + +-(int) part { +} + ++(some_type_t) piece { +} + ++(void) z_Z_42 { + ([self onEntity: [] { 42]; + } class: ^ { } +]; + [super]; + BOOL struct; +} |