forked from OSchip/llvm-project
b2780cd744
Previously, the JavaScript import sorter would ignore `// clang-format off` and `on` comments. This change fixes that. It tracks whether formatting is enabled for a stretch of imports, and then only sorts and merges the imports where formatting is enabled, in individual chunks. This means that there's no meaningful total order when module references are mixed with blocks that have formatting disabled. The alternative approach would have been to sort all imports that have formatting enabled in one group. However that raises the question where to insert the formatting-off block, which can also impact symbol visibility (in particular for exports). In practice, sorting in chunks probably isn't a big problem. This change also simplifies the general algorithm: instead of tracking indices separately and sorting them, it just sorts the vector of module references. And instead of attempting to do fine grained tracking of whether the code changed order, it just prints out the module references text, and compares that to the previous text. Given that source files typically have dozens, but not even hundreds of imports, the performance impact seems negligible. Differential Revision: https://reviews.llvm.org/D101515 |
||
---|---|---|
.. | ||
AST | ||
ASTMatchers | ||
Analysis | ||
Basic | ||
CodeGen | ||
CrossTU | ||
DirectoryWatcher | ||
Driver | ||
Format | ||
Frontend | ||
Index | ||
Introspection | ||
Lex | ||
Rename | ||
Rewrite | ||
Sema | ||
Serialization | ||
StaticAnalyzer | ||
Tooling | ||
libclang | ||
CMakeLists.txt |