[llvm-bugs] [Bug 49298] New: Sort includes pass will sort inside raw strings
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Feb 20 13:36:44 PST 2021
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: unassignedclangbugs at nondot.org
Reporter: N.James93 at hotmail.co.uk
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210220/9267bd7f/attachment.html>
More information about the llvm-bugs
mailing list