https://bugs.llvm.org/show_bug.cgi?id=49298

            Bug ID: 49298
           Summary: Sort includes pass will sort inside raw strings
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

clang-format does not respect raw string literals when sorting includes

Take this snippet:
>const char *RawStr = R"(
>#include "headerB.h"
>#include "headerA.h"
>)";

Running clang-format over with SortIncludes enabled transforms this code to:
>const char *RawStr = R"(
>#include "headerA.h"
>#include "headerB.h"
>)";

The formatter should not sort these includes as they are part of a raw string
without a language delimiter.

The cause for this is pretty obvious, the include sorter runs without parsing
the code, so it can't see that include tokens should actually be part of a
string.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to