Issue 58147
Summary [clang-format] BUG: IndentPPDirectives will format incositent
Labels
Assignees
Reporter florianbecker
    Input:
```cpp
#ifdef __has_include
#if __has_include(<LoggerFactory.h>)
#include <LoggerFactory.h>
#else
#include <iostream>
#endif
#else
#include <iostream>
#endif
```

Will result into that:
```cpp
#ifdef __has_include
  #if __has_include( <LoggerFactory.h>)
    #include <LoggerFactory.h>
  #else
    #include <iostream>
  #endif
#else
  #include <iostream>
#endif
```

As you can see, there is a space after the opening brace in line 2. This is ok for my configuration, but there is no space before the closing brace. And this is inconsistent. The space will be forced. So removing this space will insert one, but adding one before the closing brace will keep the space. So this is the workaround to keep the code consistent but looks like some kind of issue.

Tested with clang-format-14 and clang-format-15

My configuration:
[clang-format.txt](https://github.com/llvm/llvm-project/files/9709170/clang-format.txt)

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to