|
1 | | -# The LLVM Compiler Infrastructure |
| 1 | +# Tor's LLVM modifications |
2 | 2 |
|
3 | | -[](https://securityscorecards.dev/viewer/?uri=github.com/llvm/llvm-project) |
4 | | -[](https://www.bestpractices.dev/projects/8273) |
5 | | -[](https://github.com/llvm/llvm-project/actions/workflows/libcxx-build-and-test.yaml?query=event%3Aschedule) |
| 3 | +This repo is my running contributions and personal changes to `clangd` and `clang-tidy`. I'll try to merge as many of my updates as are accepted upstream to https://github.com/llvm/llvm-project. |
6 | 4 |
|
7 | | -Welcome to the LLVM project! |
| 5 | +## `clangd` features: |
8 | 6 |
|
9 | | -This repository contains the source code for LLVM, a toolkit for the |
10 | | -construction of highly optimized compilers, optimizers, and run-time |
11 | | -environments. |
| 7 | +### swap binary operands |
12 | 8 |
|
13 | | -The LLVM project has multiple components. The core of the project is |
14 | | -itself called "LLVM". This contains all of the tools, libraries, and header |
15 | | -files needed to process intermediate representations and convert them into |
16 | | -object files. Tools include an assembler, disassembler, bitcode analyzer, and |
17 | | -bitcode optimizer. |
| 9 | +https://github.com/torshepherd/llvm-customizations/assets/49597791/778b35b9-0ab2-4378-b1bb-2bb990cec14d |
18 | 10 |
|
19 | | -C-like languages use the [Clang](http://clang.llvm.org/) frontend. This |
20 | | -component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode |
21 | | --- and from there into object files, using LLVM. |
| 11 | +## `clang-tidy` checks: |
22 | 12 |
|
23 | | -Other components include: |
24 | | -the [libc++ C++ standard library](https://libcxx.llvm.org), |
25 | | -the [LLD linker](https://lld.llvm.org), and more. |
| 13 | +### `performance-vector-pessimization` |
26 | 14 |
|
27 | | -## Getting the Source Code and Building LLVM |
| 15 | + |
28 | 16 |
|
29 | | -Consult the |
30 | | -[Getting Started with LLVM](https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm) |
31 | | -page for information on building and running LLVM. |
| 17 | +## Planned future work: |
32 | 18 |
|
33 | | -For information on how to contribute to the LLVM project, please take a look at |
34 | | -the [Contributing to LLVM](https://llvm.org/docs/Contributing.html) guide. |
35 | | - |
36 | | -## Getting in touch |
37 | | - |
38 | | -Join the [LLVM Discourse forums](https://discourse.llvm.org/), [Discord |
39 | | -chat](https://discord.gg/xS7Z362), |
40 | | -[LLVM Office Hours](https://llvm.org/docs/GettingInvolved.html#office-hours) or |
41 | | -[Regular sync-ups](https://llvm.org/docs/GettingInvolved.html#online-sync-ups). |
42 | | - |
43 | | -The LLVM project has adopted a [code of conduct](https://llvm.org/docs/CodeOfConduct.html) for |
44 | | -participants to all modes of communication within the project. |
| 19 | +- `modernize-use-views-enumerate`: transform index-based for loops with end condition of `.size()` that use the index and also use the value at the index to range-based for loops with `| std::views::enumerate` |
| 20 | +- `modernize-use-views-iota`: transform index-based for loops that start from an integral `start` and go to an integral `end` to range-based for loops with `std::views::iota(start, end)` |
| 21 | +- `modernize-use-views-zip`: transform index-based for loops with end condition of `.size()` that use the value from two ranges `r1` and `r2` at the index to range-based for loops with `std::views::zip(r1, r2)` |
| 22 | +- `modernize-use-ctad`: transform `make_` functions to class-template-argument-deduction: `std::make_optional(2)` -> `std::optional(2)` |
| 23 | +- `misc-use-static-or-inline-constexpr`: suggest transforming global `constexpr` variables in header files to `inline constexpr` and global variables in source files or function-level variables to `static constexpr` |
| 24 | +- `performance-use-array`: In cases with compile-known length of std::vector, change type to array instead |
| 25 | +- `bugprone-move-reference-capture`: Suggest move captures for vars captured by reference which are later moved in the lambda iff the lambda is not immediately-invoked |
| 26 | +- `bugprone-use-midpoint`: Suggest to use `std::midpoint(x, y)` instead of manual `x + y / 2` |
| 27 | +- `performance-initializer-list`: In cases where vector is instantiated with the initializer-list ctor and the type is not trivially copyable, suggest using emplace back instead: `std::vector<T> vec{t1, t2, t3}` -> `std::vector<T> vec = [&]{std::vector<T> out{}; out.emplace_back(t1); out.emplace_back(t2); out.emplace_back(t3); return out;}()` |
| 28 | +- Add "swap parameters" code action to clangd |
| 29 | +- Add "extract constraints to concept" code action to clangd |
| 30 | +- Add "move concept to requires clause" code action to clangd |
| 31 | +- Add "fix all" and "fix all from _" quick fixes to clangd |
| 32 | +- Add code action to convert include to forward-declarations |
| 33 | +- Extract to lambda instead of function |
| 34 | +- Inlay hints for lambda captures |
| 35 | +- Inlay hints for size of included file |
| 36 | +- Convert block comment to multiline comment & vice versa |
| 37 | +- Convert member function qualifiers into explicit `this` parameter |
| 38 | +- Convert eager monadic functions to lazy versions |
| 39 | +- Autocomplete for #include should use fuzzy path finder |
0 commit comments