]> granicus.if.org Git - clang/commitdiff
Tweak serialized diagnostics to support errors with no categories. Fixes <rdar:...
authorTed Kremenek <kremenek@apple.com>
Wed, 7 Dec 2011 02:08:00 +0000 (02:08 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 7 Dec 2011 02:08:00 +0000 (02:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146011 91177308-0d34-0410-b5e6-96231b3b80d8

test/Misc/serialized-diags-no-category.c [new file with mode: 0644]
test/Misc/serialized-diags.c
tools/libclang/CXLoadedDiagnostic.cpp

diff --git a/test/Misc/serialized-diags-no-category.c b/test/Misc/serialized-diags-no-category.c
new file mode 100644 (file)
index 0000000..9c92ac3
--- /dev/null
@@ -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
+
index 7cdac53b84dd45fd00da5855c3d6a54762c179c1..b5b619d655bb7ccb2ef773b922a4a5bac6e19ab7 100644 (file)
@@ -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
index 61b9e33c2da30c3bc1c3c89a58edfcdb17177079..b95515e6e2256957b337f35c393342e5bc124765 100644 (file)
@@ -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;