|
1 | | -# The LLVM Compiler Infrastructure |
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) |
6 | | - |
7 | | -Welcome to the LLVM project! |
8 | | - |
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. |
12 | | - |
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. |
18 | | - |
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. |
22 | | - |
23 | | -Other components include: |
24 | | -the [libc++ C++ standard library](https://libcxx.llvm.org), |
25 | | -the [LLD linker](https://lld.llvm.org), and more. |
26 | | - |
27 | | -## Getting the Source Code and Building LLVM |
28 | | - |
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. |
32 | | - |
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. |
| 1 | +# Tor's LLVM modifications |
| 2 | + |
| 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. |
| 4 | + |
| 5 | +## `clangd` features: |
| 6 | + |
| 7 | +### Fix all |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +### swap binary operands |
| 12 | + |
| 13 | +https://github.com/torshepherd/llvm-customizations/assets/49597791/778b35b9-0ab2-4378-b1bb-2bb990cec14d |
| 14 | + |
| 15 | +### Inlay hints for lambda captures |
| 16 | + |
| 17 | +## `clang-tidy` checks: |
| 18 | + |
| 19 | +### `performance-vector-pessimization` |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +## Planned future work: |
| 24 | + |
| 25 | +- `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` |
| 26 | +- `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)` |
| 27 | +- `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)` |
| 28 | +- `modernize-use-views-concat`: transform consecutive range-based for loops with the same element type to a single for loop with `std::views::concat(r1, r2)` |
| 29 | +- `modernize-use-ctad`: transform `make_` functions to class-template-argument-deduction: `std::make_optional(2)` -> `std::optional(2)` |
| 30 | + - With config option to use braced-init or paren-init |
| 31 | +- `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` |
| 32 | +- `performance-use-array`: In cases with compile-known length of std::vector, change type to array instead |
| 33 | +- `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 |
| 34 | +- `bugprone-use-midpoint`: Suggest to use `std::midpoint(x, y)` instead of manual `x + y / 2` |
| 35 | +- `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;}()` |
| 36 | +- Add "swap parameters" code action to clangd |
| 37 | +- Add "extract constraints to concept" code action to clangd |
| 38 | +- Add "move concept to requires clause" code action to clangd |
| 39 | +- Add code action to convert include to forward-declarations |
| 40 | +- Extract to lambda instead of function |
| 41 | +- Inlay hints for size of included file |
| 42 | +- Inlay hints for implicit default initialization |
| 43 | +- Inlay hints for deduced template parameters |
| 44 | +- Inlay hints for default arguments (and template args) |
| 45 | +- Only publish block inlay hints for blocks bigger than a configurable line length |
| 46 | +- Convert block comment to multiline comment & vice versa |
| 47 | +- Convert member function qualifiers into explicit `this` parameter |
| 48 | +- Convert eager monadic functions to lazy versions |
| 49 | +- Autocomplete for #include should use fuzzy path finder |
| 50 | +- Compute comptime enum underlying values on hover |
| 51 | + - For instance, see `llvm/include/llvm/ADT/SparseBitVector.h`, and hover over the enum values `BITS_PER_ELEMENT` |
| 52 | +- Proper schema-based autocomplete for config.yaml |
| 53 | +- Make "add missing includes" use the same path for the includes as autocomplete's "from _.h" functionality |
| 54 | +- Make `-Wunused-but-set-variable` suggest removing the only-ever-set variable |
0 commit comments