Answer the question
In order to leave comments, you need to log in
Clang as a static analysis tool: only processing specified files?
A tool for static analysis of C++ code is being developed. The main work is done by means of Clang. The following problem has arisen: I can't figure out how to make Clang (and our user code) issue warnings and other information only about code written by the end user, and not library code. At the same time, it is clear that you cannot simply ignore include's - then you will not parse the code using the names declared in the corresponding headers.
Answer the question
In order to leave comments, you need to log in
I think you have already looked at these links, but suddenly...
Article on Clang API
Plugin for SublimeText2 , parsed with Clang. Written in python.
I couldn't remember anything else.
It all depends on what mechanism is used to receive diagnostics from clang and issue this diagnostic to the user. If this is done on the basis of your own DiagnosticRenderer, then each message is associated with the place in the source text for which it was issued. Compare the name of the file for which the message was issued with the name of the file being processed - and voila, if the file is not the current one, do not display anything.
If the clang-c API is used, then you can use the clang_getDiagnosticSetFromTU method , and then filter everything in the same way - by the name of the file for which this or that message was issued.
And another link that might be helpful. This is a clang-based C++ code parser for Qt Creator:
https://qt.gitorious.org/qt-creator/qt-creator/trees/wip/clang/src/plugins/clangcodemodel
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question