| Issue |
176321
|
| Summary |
clang-format IndentPPDirectives unable to detect include guards if the last line is a comment
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
escherstair
|
As far as I understand (and I see), clang-format IndentPPDirectives doesn't indent include guards. And this is ok.
And so there are some checks to detect if the preprocessor directive is an include guard or not.
If they're the fista and the last lines on the file, the include guards are properly detected. As an example:
```C
#ifndef HAVE_TEST
#define HAVE_TEST
#include "foo.hpp"
...
#endif
```
At the beginning of the file, comments only are allowed. As an example:
```C
/* comment block
---
*/
#ifndef HAVE_TEST
#define HAVE_TEST
#include "foo.hpp"
...
#endif
```
clang-format is able to detect the include guards and doesn't indent them.
On the other side, if there is a final comment line
```C
/* comment block
---
*/
#ifndef HAVE_TEST
#define HAVE_TEST
#include "foo.hpp"
...
#endif
/* final comment line */
```
clang-format is not able to detect the include guards and it indents them.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs