[all-commits] [llvm/llvm-project] 2fec88: [sanitizer] Set IndentPPDirectives: AfterHash in ....
Fangrui Song via All-commits
all-commits at lists.llvm.org
Mon May 3 13:50:01 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2fec8860d8aef7ba74064de622fe9ce29f3b19fb
https://github.com/llvm/llvm-project/commit/2fec8860d8aef7ba74064de622fe9ce29f3b19fb
Author: Fangrui Song <i at maskray.me>
Date: 2021-05-03 (Mon, 03 May 2021)
Changed paths:
M compiler-rt/lib/asan/.clang-format
M compiler-rt/lib/dfsan/.clang-format
M compiler-rt/lib/hwasan/.clang-format
M compiler-rt/lib/interception/.clang-format
M compiler-rt/lib/lsan/.clang-format
M compiler-rt/lib/msan/.clang-format
M compiler-rt/lib/safestack/.clang-format
M compiler-rt/lib/sanitizer_common/.clang-format
M compiler-rt/lib/tsan/.clang-format
M compiler-rt/test/.clang-format
Log Message:
-----------
[sanitizer] Set IndentPPDirectives: AfterHash in .clang-format
Code patterns like this are common, `#` at the line beginning
(https://google.github.io/styleguide/cppguide.html#Preprocessor_Directives),
one space indentation for if/elif/else directives.
```
#if SANITIZER_LINUX
# if defined(__aarch64__)
# endif
#endif
```
However, currently clang-format wants to reformat the code to
```
#if SANITIZER_LINUX
#if defined(__aarch64__)
#endif
#endif
```
This significantly harms readability in my review. Use `IndentPPDirectives:
AfterHash` to defeat the diagnostic. clang-format will now suggest:
```
#if SANITIZER_LINUX
# if defined(__aarch64__)
# endif
#endif
```
Unfortunately there is no clang-format option using indent with 1 for
just preprocessor directives. However, this is still one step forward
from the current behavior.
Reviewed By: #sanitizers, vitalybuka
Differential Revision: https://reviews.llvm.org/D100238
More information about the All-commits
mailing list