Skip to content
Snippets Groups Projects
Commit 443b931d authored by Daniel Jasper's avatar Daniel Jasper
Browse files

clang-format: Basic support for C++1y.

Before:
  int bi{1 '000' 000};
After:
  int bi{1'000'000};

This fixes llvm.org/PR19342.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206263 91177308-0d34-0410-b5e6-96231b3b80d8
parent 3726781f
No related branches found
No related tags found
No related merge requests found
...@@ -1848,6 +1848,7 @@ LangOptions getFormattingLangOpts(FormatStyle::LanguageStandard Standard) { ...@@ -1848,6 +1848,7 @@ LangOptions getFormattingLangOpts(FormatStyle::LanguageStandard Standard) {
LangOptions LangOpts; LangOptions LangOpts;
LangOpts.CPlusPlus = 1; LangOpts.CPlusPlus = 1;
LangOpts.CPlusPlus11 = Standard == FormatStyle::LS_Cpp03 ? 0 : 1; LangOpts.CPlusPlus11 = Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
LangOpts.CPlusPlus1y = Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
LangOpts.LineComment = 1; LangOpts.LineComment = 1;
LangOpts.Bool = 1; LangOpts.Bool = 1;
LangOpts.ObjC1 = 1; LangOpts.ObjC1 = 1;
......
...@@ -6663,6 +6663,10 @@ TEST_F(FormatTest, DoesNotTryToParseUDLiteralsInPreCpp11Code) { ...@@ -6663,6 +6663,10 @@ TEST_F(FormatTest, DoesNotTryToParseUDLiteralsInPreCpp11Code) {
format("#define x(_a) printf(\"foo\"_a);", Style)); format("#define x(_a) printf(\"foo\"_a);", Style));
} }
TEST_F(FormatTest, UnderstandsCpp1y) {
verifyFormat("int bi{1'000'000};");
}
TEST_F(FormatTest, BreakStringLiteralsBeforeUnbreakableTokenSequence) { TEST_F(FormatTest, BreakStringLiteralsBeforeUnbreakableTokenSequence) {
EXPECT_EQ("someFunction(\"aaabbbcccd\"\n" EXPECT_EQ("someFunction(\"aaabbbcccd\"\n"
" \"ddeeefff\");", " \"ddeeefff\");",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment