Closed JamesLee-Jones closed 1 month ago
Although this is unlikely to ever be unreasonably expensive, there is probably an optimizations that could be made. If the Clang AST is always traversed top down, then we just need to find the place that Dredd is going to modify and insert the prelude before this at the global scope. This means once start_location_of_first_function_in_source_file_
is valid, we could skip the rest of the function as this will always have the earliest starting source location.
@JamesLee-Jones Can you rebase this one please? From what I recall it should be good to go, except there was one simplification you were looking at making (see open discussion).
@JamesLee-Jones This will need a rebase. Does my suggested refactoring make sense and are you good to do it?
@JamesLee-Jones This will need a rebase. Does my suggested refactoring make sense and are you good to do it?
Your suggestion makes sense, I'll refactor it today!
Inserting Dredd's declarations at the beginning of the file can cause issues with header files that have to be before any system headers. So instead, insert Dredd's declarations at the top level before the first mutation that we find.
Fixes: #219, #215