diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-04-12 00:03:31 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-04-12 00:03:31 +0000 |
commit | 78d5d3bb9386a5aa31d19445eb8f81bf2652acb4 (patch) | |
tree | 5bc532482d3f9dd23f983cc62120ac4256e2b9c0 /tools/libclang/CXLoadedDiagnostic.cpp | |
parent | 104dbf982582f16888fb15f9342fce9748af48c5 (diff) |
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
Diffstat (limited to 'tools/libclang/CXLoadedDiagnostic.cpp')
-rw-r--r-- | tools/libclang/CXLoadedDiagnostic.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/libclang/CXLoadedDiagnostic.cpp b/tools/libclang/CXLoadedDiagnostic.cpp index d52c18319f..e5b6ccc5b7 100644 --- a/tools/libclang/CXLoadedDiagnostic.cpp +++ b/tools/libclang/CXLoadedDiagnostic.cpp @@ -119,6 +119,10 @@ unsigned CXLoadedDiagnostic::getCategory() const { return category; } +CXString CXLoadedDiagnostic::getCategoryText() const { + return cxstring::createCXString(CategoryText); +} + unsigned CXLoadedDiagnostic::getNumRanges() const { return Ranges.size(); } @@ -650,6 +654,7 @@ LoadResult DiagLoader::readDiagnosticBlock(llvm::BitstreamCursor &Stream, D->category = Record[offset++]; unsigned diagFlag = Record[offset++]; D->DiagOption = diagFlag ? TopDiags.WarningFlags[diagFlag] : ""; + D->CategoryText = D->category ? TopDiags.Categories[D->category] : ""; D->Spelling = TopDiags.makeString(BlobStart, BlobLen); continue; } |