-
Notifications
You must be signed in to change notification settings - Fork 53
/
.pre-commit-search-and-replace.yaml
32 lines (31 loc) · 1.3 KB
/
.pre-commit-search-and-replace.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Force all C++ mlir include paths to be prefixed with "mlir/include/mlir",
# instead of just "mlir/", as the latter is incompatible with Google's internal
# filesystem.
- search: '/^#include "mlir\/(?!include\/mlir\/)/'
replacement: '#include "mlir/include/mlir/'
# Same for llvm paths.
- search: '/^#include "llvm\/(?!include\/llvm\/)/'
replacement: '#include "llvm/include/llvm/'
# Ensure that all C++ mlir include paths include a "// from @llvm-project"
# comment import into Google's internal filesystem.
- search: '/^#include ("mlir\/.*")$/'
replacement: '#include \1 // from @llvm-project'
# Same for llvm paths.
- search: '/^#include ("llvm\/.*")$/'
replacement: '#include \1 // from @llvm-project'
# consistent include guards
# Cf. https://github.com/google/heir/issues/843
# Note the trailing underscore which helps avoid matching other #defines that
# might start with HEIR_
- search: '/^#ifndef HEIR_(.*)_$/'
replacement: '#ifndef \1_'
- search: '/^#ifndef THIRD_PARTY_HEIR_(.*)_$/'
replacement: '#ifndef \1_'
- search: '/^#define HEIR_(.*)_$/'
replacement: '#define \1_'
- search: '/^#define THIRD_PARTY_HEIR_(.*)_$/'
replacement: '#define \1_'
- search: '/^#endif *\/\/ HEIR_(.*)_$/'
replacement: '#endif // \1_'
- search: '/^#endif *\/\/ THIRD_PARTY_HEIR_(.*)_$/'
replacement: '#endif // \1_'