[PATCH] D65194: [Format] Make getFormattingLangOpts clear LS_Auto uses LS_Cpp11 lexing rule
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 24 02:02:59 PDT 2019
MaskRay created this revision.
MaskRay added reviewers: modocache, sammccall.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Suggested by sammccall in post-commit review of D65183 <https://reviews.llvm.org/D65183>
Repository:
rC Clang
https://reviews.llvm.org/D65194
Files:
lib/Format/Format.cpp
Index: lib/Format/Format.cpp
===================================================================
--- lib/Format/Format.cpp
+++ 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65194.211445.patch
Type: text/x-patch
Size: 1121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190724/a963747e/attachment-0001.bin>
More information about the cfe-commits
mailing list