This revision was automatically updated to reflect the committed changes.
Closed by commit rL366883: [Format] getFormattingLangOpts: make LS_Auto uses 
LS_Cpp11 lexing rule (authored by MaskRay, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65194/new/

https://reviews.llvm.org/D65194

Files:
  cfe/trunk/lib/Format/Format.cpp


Index: cfe/trunk/lib/Format/Format.cpp
===================================================================
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -2365,11 +2365,14 @@
 
 LangOptions getFormattingLangOpts(const FormatStyle &Style) {
   LangOptions LangOpts;
+  FormatStyle::LanguageStandard LexingStd =
+      Style.Standard == FormatStyle::LS_Auto ? FormatStyle::LS_Cpp11
+                                             : Style.Standard;
   LangOpts.CPlusPlus = 1;
-  LangOpts.CPlusPlus11 = Style.Standard >= FormatStyle::LS_Cpp11;
-  LangOpts.CPlusPlus14 = Style.Standard >= FormatStyle::LS_Cpp11;
-  LangOpts.CPlusPlus17 = Style.Standard >= FormatStyle::LS_Cpp11;
-  LangOpts.CPlusPlus2a = Style.Standard >= FormatStyle::LS_Cpp11;
+  LangOpts.CPlusPlus11 = LexingStd >= FormatStyle::LS_Cpp11;
+  LangOpts.CPlusPlus14 = LexingStd >= FormatStyle::LS_Cpp11;
+  LangOpts.CPlusPlus17 = LexingStd >= FormatStyle::LS_Cpp11;
+  LangOpts.CPlusPlus2a = LexingStd >= FormatStyle::LS_Cpp11;
   LangOpts.LineComment = 1;
   bool AlternativeOperators = Style.isCpp();
   LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0;


Index: cfe/trunk/lib/Format/Format.cpp
===================================================================
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -2365,11 +2365,14 @@
 
 LangOptions getFormattingLangOpts(const FormatStyle &Style) {
   LangOptions LangOpts;
+  FormatStyle::LanguageStandard LexingStd =
+      Style.Standard == FormatStyle::LS_Auto ? FormatStyle::LS_Cpp11
+                                             : Style.Standard;
   LangOpts.CPlusPlus = 1;
-  LangOpts.CPlusPlus11 = Style.Standard >= FormatStyle::LS_Cpp11;
-  LangOpts.CPlusPlus14 = Style.Standard >= FormatStyle::LS_Cpp11;
-  LangOpts.CPlusPlus17 = Style.Standard >= FormatStyle::LS_Cpp11;
-  LangOpts.CPlusPlus2a = Style.Standard >= FormatStyle::LS_Cpp11;
+  LangOpts.CPlusPlus11 = LexingStd >= FormatStyle::LS_Cpp11;
+  LangOpts.CPlusPlus14 = LexingStd >= FormatStyle::LS_Cpp11;
+  LangOpts.CPlusPlus17 = LexingStd >= FormatStyle::LS_Cpp11;
+  LangOpts.CPlusPlus2a = LexingStd >= FormatStyle::LS_Cpp11;
   LangOpts.LineComment = 1;
   bool AlternativeOperators = Style.isCpp();
   LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to