From: Alp Toker Date: Sun, 20 Apr 2014 01:07:03 +0000 (+0000) Subject: cindex.py: Avoid deprecated function X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=34bf531fe55a681b8ed84e1925e10bab79b1be44;p=clang cindex.py: Avoid deprecated function Implement Diagnostic::category_name() using clang_getDiagnosticCategoryText() instead of the deprected clang_getDiagnosticCategoryName(). Preserves existing behaviour and API covered by existing tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206712 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index 5078825f14..eea7d331ae 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -361,13 +361,13 @@ class Diagnostic(object): @property def category_number(self): - """The category number for this diagnostic.""" + """The category number for this diagnostic or 0 if unavailable.""" return conf.lib.clang_getDiagnosticCategory(self) @property def category_name(self): """The string name of the category for this diagnostic.""" - return conf.lib.clang_getDiagnosticCategoryName(self.category_number) + return conf.lib.clang_getDiagnosticCategoryText(self) @property def option(self): @@ -2922,8 +2922,8 @@ functionList = [ [Diagnostic], c_uint), - ("clang_getDiagnosticCategoryName", - [c_uint], + ("clang_getDiagnosticCategoryText", + [Diagnostic], _CXString, _CXString.from_result),