]> granicus.if.org Git - clang/commitdiff
cindex.py: Avoid deprecated function
authorAlp Toker <alp@nuanti.com>
Sun, 20 Apr 2014 01:07:03 +0000 (01:07 +0000)
committerAlp Toker <alp@nuanti.com>
Sun, 20 Apr 2014 01:07:03 +0000 (01:07 +0000)
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

bindings/python/clang/cindex.py

index 5078825f14779613fa4c5554ec291c1a7f1779f1..eea7d331aefdbb7cf6ff5216d73f31316eb93a0d 100644 (file)
@@ -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),