diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-12-07 02:08:00 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-12-07 02:08:00 +0000 |
commit | 13eee196469596a107762606e5cea6511368a54c (patch) | |
tree | 31602454f97c5df9455e5a809d7e5fede697ef8d | |
parent | 26e80cdfe8933a7f804e1d05b379d5ad50119db5 (diff) |
Tweak serialized diagnostics to support errors with no categories. Fixes <rdar://problem/10538300>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146011 91177308-0d34-0410-b5e6-96231b3b80d8
-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; |