Open gamesh411 opened 5 years ago
Could you plase check the new test files 'ctu-on-the-fly.c' and 'ctu-on-the-fly.cpp'. I have managed to get almost working, however there are 2 issues still reamining.
First issue: During the analysis of sometimes the file part is entirely left off from the diagnostic. The interesting part is that Line number is OK, just the file part gets lost. This could be fixed by making the check more lenient in case of on-demand analysis (eg. not requiring that the diagnostic contains the file information).
Second issue: Inline assembly importing fails if -std=c89 is given inside compile_commands.json for the c test (see the test RUN: lines for the contents of the compile_commands.json). If however no -std=c89 is given, then unsupported AST node error is given during the analysis (I assume that it must be the clang tool which parses the file).
What are your thoughts?
Thanks
I have a working solution updated. The parsing logic of external TUs should be refactored to increase maintainability. However, this change is complex enough as is, and I would recommend refactoring in a separate change.
There is another ongoing issue with passing configuration options to CTUContext during the CallEvent handling of the analyzer engine. This promotes parameter-style passing of information, however, the Context object would be better off with constructor parameter injection or getters and setters (which is still a bit inferior to constructor injection because the values are set every time an external TU definition is requested from the context).
Fixed a remaining typo.
I have refactored and rebased the solution. There is an extra diagnostic as requested, and I have asserted some invariants in the code.
CI still fails...
run tests (this message is intended for the build bot, if you answer to this message then you owe me a bottle of whiskey)
run tests
run tests
Add an option to enable on-the-fly parsing of needed ASTs during CTU analysis. The option CTUCompilationDatabase should be a path to a compilation database, which has all the necessary information to generate the ASTs. In case an empty string is given, on-the-fly parsing is disabled.