Author: maskray Date: Wed Jul 24 02:50:56 2019 New Revision: 366883 URL: http://llvm.org/viewvc/llvm-project?rev=366883&view=rev Log: [Format] getFormattingLangOpts: make LS_Auto uses LS_Cpp11 lexing rule
Suggested by sammccall in post-commit review of D65183 Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D65194 Modified: cfe/trunk/lib/Format/Format.cpp Modified: cfe/trunk/lib/Format/Format.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=366883&r1=366882&r2=366883&view=diff ============================================================================== --- cfe/trunk/lib/Format/Format.cpp (original) +++ cfe/trunk/lib/Format/Format.cpp Wed Jul 24 02:50:56 2019 @@ -2365,11 +2365,14 @@ tooling::Replacements sortUsingDeclarati 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