diff options
-rw-r--r-- | test/Misc/serialized-diags-no-category.c | 12 | ||||
-rw-r--r-- | test/Misc/serialized-diags.c | 2 | ||||
-rw-r--r-- | tools/libclang/CXLoadedDiagnostic.cpp | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/test/Misc/serialized-diags-no-category.c b/test/Misc/serialized-diags-no-category.c new file mode 100644 index 0000000000..9c92ac3330 --- /dev/null +++ b/test/Misc/serialized-diags-no-category.c @@ -0,0 +1,12 @@ +#error foo +#error bar + +// RUN: rm -f %t +// RUN: %clang -ferror-limit=1 -fsyntax-only %s --serialize-diagnostics %t > /dev/null 2>&1 || true +// RUN: c-index-test -read-diagnostics %t 2>&1 | FileCheck %s + +// This test case tests that we can handle both fatal errors and errors without categories. + +// CHECK: {{.*[/\\]}}serialized-diags-no-category.c:1:2: error: #error foo [] +// CHECK: Number of diagnostics: 2 + diff --git a/test/Misc/serialized-diags.c b/test/Misc/serialized-diags.c index 7cdac53b84..b5b619d655 100644 --- a/test/Misc/serialized-diags.c +++ b/test/Misc/serialized-diags.c @@ -16,7 +16,7 @@ void qux(int x) { } // RUN: rm -f %t -// RUN: %clang -Wall -fsyntax-only %s --serialize-diagnostics %t 2>&1 /dev/null || true +// RUN: %clang -Wall -fsyntax-only %s --serialize-diagnostics %t > /dev/null 2>&1 || true // RUN: c-index-test -read-diagnostics %t 2>&1 | FileCheck %s // This test case tests that we can handle multiple diagnostics which contain diff --git a/tools/libclang/CXLoadedDiagnostic.cpp b/tools/libclang/CXLoadedDiagnostic.cpp index 61b9e33c2d..b95515e6e2 100644 --- a/tools/libclang/CXLoadedDiagnostic.cpp +++ b/tools/libclang/CXLoadedDiagnostic.cpp @@ -595,7 +595,8 @@ LoadResult DiagLoader::readDiagnosticBlock(llvm::BitstreamCursor &Stream, continue; case serialized_diags::RECORD_CATEGORY: if (readString(TopDiags, TopDiags.Categories, "category", Record, - BlobStart, BlobLen)) + BlobStart, BlobLen, + /* allowEmptyString */ true)) return Failure; continue; |