https://llvm.org/bugs/show_bug.cgi?id=30220
Bug ID: 30220
Summary: clang-format with webkit style breaks code for raw
strings with quote characters
Product: clang
Version: 3.8
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]
Classification: Unclassified
Consider the minimal example code here:
auto foo()
{
std::string s{R"(ha"ha)" };
return s;
}
auto bar()
{
std::string s{R"(AAAAA)"};
return foo();
}
Formatting this with "clang-format -style=Webkit" leads to :
1. Incorrect syntax for the raw string literals, as the formatter inserts a
space between the R and the opening quote of the raw string literal in g(). The
other built in formats in clang-format do not do this.
2. Bad indentations after the first raw string in foo(). It seems the formatter
does not ignore the contents of the raw string literals, and treats the quote
inside the raw string as the closing quote of the raw string. Here is the
output I get with version 3.8.1:
sandipan@jrl:~/tmp> clang-format -style=Webkit cf_rs.cc
auto foo()
{
std::string s
{R"(ha"ha)" };
return s;
}
auto bar()
{
std::string s{ R "(AAAAA)" };
return foo();
}
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs