From 443b931d0665194e43b131d0ac5ef132f47fa379 Mon Sep 17 00:00:00 2001
From: Daniel Jasper <djasper@google.com>
Date: Tue, 15 Apr 2014 08:49:21 +0000
Subject: [PATCH] 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
---
 lib/Format/Format.cpp           | 1 +
 unittests/Format/FormatTest.cpp | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 528e1356108..4a9c37e0841 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1848,6 +1848,7 @@ LangOptions getFormattingLangOpts(FormatStyle::LanguageStandard Standard) {
   LangOptions LangOpts;
   LangOpts.CPlusPlus = 1;
   LangOpts.CPlusPlus11 = Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
+  LangOpts.CPlusPlus1y = Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
   LangOpts.LineComment = 1;
   LangOpts.Bool = 1;
   LangOpts.ObjC1 = 1;
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 45ad5fe39ef..708ddfa0913 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -6663,6 +6663,10 @@ TEST_F(FormatTest, DoesNotTryToParseUDLiteralsInPreCpp11Code) {
             format("#define x(_a) printf(\"foo\"_a);", Style));
 }
 
+TEST_F(FormatTest, UnderstandsCpp1y) {
+  verifyFormat("int bi{1'000'000};");
+}
+
 TEST_F(FormatTest, BreakStringLiteralsBeforeUnbreakableTokenSequence) {
   EXPECT_EQ("someFunction(\"aaabbbcccd\"\n"
             "             \"ddeeefff\");",
-- 
GitLab