libclang python绑定不返回任何修复

时间:2014-03-10 16:15:44

标签: python libclang

我想从翻译单元(tu)转储诊断和修正。但是下面的代码不起作用。

def dump_fixits():
    """Return diagnostics with fixits of translation unit."""
    result = []
    for diag in tu.diagnostics:
        diag_fixits = [repr(it) for it in diag.fixits]
        location = diag.location
        file = "" if location.file is None else location.file.name
        result.append((file + ":"
                       + str(location.line) + ":"
                       + str(location.column) + ": "
                       + severity_map[diag.severity] + ": "
                       + diag.spelling,
                       diag_fixits))
    return result

(我正在使用llvm 3.4)

我注意到conf.lib.clang_getDiagnosticNumFixIts()每次都会返回0

有没有解决方案?

1 个答案:

答案 0 :(得分:0)

抱歉,我误解了fixit。我认为fixit可以得到法术错过,但事实并非如此。关闭这个问题。谢谢。