File README.md copied from file test-files/vector-all.cpp (similarity 51%) (mode: 100644) (index 42aa3d3..03302a1) |
|
1 |
|
Brief description |
|
2 |
|
----------------- |
|
3 |
|
|
|
4 |
|
Clang-based standalone tool that detects for-loops with postfix operators. |
|
5 |
|
|
|
6 |
|
Example |
|
7 |
|
------- |
|
8 |
|
|
|
9 |
|
Input: |
|
10 |
|
|
|
11 |
|
```c++ |
1 |
12 |
#include <cstdlib> |
#include <cstdlib> |
2 |
13 |
|
|
3 |
14 |
#include <vector> |
#include <vector> |
|
... |
... |
main(void) |
32 |
43 |
|
|
33 |
44 |
return EXIT_SUCCESS; |
return EXIT_SUCCESS; |
34 |
45 |
} |
} |
|
46 |
|
``` |
|
47 |
|
|
|
48 |
|
Run command: |
|
49 |
|
|
|
50 |
|
```sh |
|
51 |
|
bin/for-postfix vector-all.cpp -- |
|
52 |
|
``` |
|
53 |
|
|
|
54 |
|
Output (paths are truncated): |
|
55 |
|
|
|
56 |
|
``` |
|
57 |
|
.../vector-all.cpp:17:dangerous use of postfix operator |
|
58 |
|
.../vector-all.cpp:25:dangerous use of postfix operator |
|
59 |
|
``` |
|
60 |
|
|
|
61 |
|
Building |
|
62 |
|
-------- |
|
63 |
|
|
|
64 |
|
1. Clone the repository to `llvm/tools/clang/tools/extra`. |
|
65 |
|
2. Add `add_subdirectory(for-postfix)` to `CMakeLists.txt` in the same |
|
66 |
|
directory. |
|
67 |
|
3. Run `ninja for-postfix` inside your LLVM's `build/` directory. |