3 ms·
Getting code analysis/refactoring tools to understand huge, complicated projects like the Linux kernel is far from trivial.
by slaymaker1907 5y ago
Getting code analysis/refactoring tools to understand huge, complicated projects like the Linux kernel is far from trivial.
- klodolph 5y agoIn practice it is not that hard. The refactoring tool may only need to tackle one translation unit at a time. You create a pattern which matches some usage of a macro, and create some logic to write out some changes to the AST. It can involve a surprisingly short amount of code—because clang-tidy has good tools for writing patterns and modifying ASTs! You can brows the clang-tidy source code yourself. There are existing checks specific to the Linux kernel in there already. Well, there’s one check. But if you use clang-tidy, you’ll discover that automatic refactoring of extremely large code bases is within reach. https://github.com/llvm/llvm-project/tree/main/clang-tools-extra/clang-tidy https://github.com/llvm/llvm-project/tree/main/clang-tools-e... The only question is whether you would want to spend the staff hours working on a clang-tidy check. Large code bases are exactly where the tradeoff makes sense.