| Issue |
97539
|
| Summary |
[clang-format] Google-Style on sorting Includes moves them into comment & breaks code
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
iAroc
|
if you have a few includes commented out with a multiline comment (e.g. /* */) and then use clang-format on based google style to sort, it will move needed includes into the comment.
my includes pre sort:
```c++
#include <Log.h>
#include <Misc.h>
#include <TryCatch.h>
#include <robin_hood.h>
/* #include "DBO_Articles/DBO_Articles.h"
#include "DBO_Customers/DBO_Customers.h"
#include "DBO_PackagingOrders/DBO_PackagingOrders.h"
#include "DBO_PickingListRegistrations/DBO_PickingListRegistrations.h" */
#include "MySQL/MySQL.h"
#include "SQLJob.h"
#include "Time/Time.h"
#include "Worker/Worker.h"
#include <chrono>
#include <thread>
```
and after clang format sort:
```c++
#include <Misc.h>
#include <TryCatch.h>
#include <robin_hood.h>
/* #include "DBO_Articles/DBO_Articles.h"
#include <chrono>
#include <thread>
#include "DBO_Customers/DBO_Customers.h"
#include "DBO_PackagingOrders/DBO_PackagingOrders.h"
#include "DBO_PickingListRegistrations/DBO_PickingListRegistrations.h" */
#include "MySQL/MySQL.h"
#include "SQLJob.h"
#include "Time/Time.h"
#include "Worker/Worker.h"
```
as seen in the example, it moved the `chrono` and `thread` includes into the comment, which should not happen, since it breaks code
here is my clang format
```YAML
BasedOnStyle: Google
SpaceBeforeRangeBasedForLoopColon: false
ReferenceAlignment: Left
PointerAlignment: Left
AlignConsecutiveDeclarations: true
IndentWidth: 4
ColumnLimit: 0
BreakBeforeBraces: Attach
AllowShortFunctionsOnASingleLine: false
AllowShortLambdasOnASingleLine: false
DerivePointerAlignment: false
NamespaceIndentation: All
QualifierAlignment: Right
BraceWrapping:
AfterControlStatement: true
SplitEmptyFunction: false
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs