[cfe-commits] r146011 - in /cfe/trunk: test/Misc/serialized-diags-no-category.c test/Misc/serialized-diags.c tools/libclang/CXLoadedDiagnostic.cpp

Ted Kremenek kremenek at apple.com
Tue Dec 6 18:08:00 PST 2011


Author: kremenek
Date: Tue Dec  6 20:08:00 2011
New Revision: 146011

URL: http://llvm.org/viewvc/llvm-project?rev=146011&view=rev
Log:
Tweak serialized diagnostics to support errors with no categories.  Fixes <rdar://problem/10538300>.

Added:
    cfe/trunk/test/Misc/serialized-diags-no-category.c
Modified:
    cfe/trunk/test/Misc/serialized-diags.c
    cfe/trunk/tools/libclang/CXLoadedDiagnostic.cpp

Added: cfe/trunk/test/Misc/serialized-diags-no-category.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/serialized-diags-no-category.c?rev=146011&view=auto
==============================================================================
--- cfe/trunk/test/Misc/serialized-diags-no-category.c (added)
+++ cfe/trunk/test/Misc/serialized-diags-no-category.c Tue Dec  6 20:08:00 2011
@@ -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
+

Modified: cfe/trunk/test/Misc/serialized-diags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/serialized-diags.c?rev=146011&r1=146010&r2=146011&view=diff
==============================================================================
--- cfe/trunk/test/Misc/serialized-diags.c (original)
+++ cfe/trunk/test/Misc/serialized-diags.c Tue Dec  6 20:08:00 2011
@@ -16,7 +16,7 @@
 }
 
 // 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

Modified: cfe/trunk/tools/libclang/CXLoadedDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXLoadedDiagnostic.cpp?rev=146011&r1=146010&r2=146011&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXLoadedDiagnostic.cpp (original)
+++ cfe/trunk/tools/libclang/CXLoadedDiagnostic.cpp Tue Dec  6 20:08:00 2011
@@ -595,7 +595,8 @@
         continue;
       case serialized_diags::RECORD_CATEGORY:
         if (readString(TopDiags, TopDiags.Categories, "category", Record,
-                       BlobStart, BlobLen))
+                       BlobStart, BlobLen,
+                       /* allowEmptyString */ true))
           return Failure;
         continue;
       





More information about the cfe-commits mailing list