Implement clang_getDiagnosticCategoryText() to provide a way for a client of libclang to accurately
get the diagnostic category name from a serialized diagnostic when the version of libclang used
to read the diagnostic file is newer than the clang that emitted the diagnostic file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154567 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index a81de27..04e7a50 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -2586,9 +2586,9 @@
CXSourceLocation DiagLoc;
CXDiagnostic D;
CXFile File;
- CXString FileName, DiagSpelling, DiagOption;
+ CXString FileName, DiagSpelling, DiagOption, DiagCat;
unsigned line, column, offset;
- const char *DiagOptionStr = 0;
+ const char *DiagOptionStr = 0, *DiagCatStr = 0;
D = clang_getDiagnosticInSet(Diags, i);
DiagLoc = clang_getDiagnosticLocation(D);
@@ -2611,6 +2611,12 @@
fprintf(stderr, " [%s]", DiagOptionStr);
}
+ DiagCat = clang_getDiagnosticCategoryText(D);
+ DiagCatStr = clang_getCString(DiagCat);
+ if (DiagCatStr) {
+ fprintf(stderr, " [%s]", DiagCatStr);
+ }
+
fprintf(stderr, "\n");
printRanges(D, indent);