summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-07-24 09:50:56 +0000
committerFangrui Song <maskray@google.com>2019-07-24 09:50:56 +0000
commit5a43ba8a6245372a55871e69fdec31017aae8eab (patch)
treeefcf99af2de81619bff7ad770faacad3798bf67b /clang/lib/Format/Format.cpp
parent2ff40ca367d5e4e0807b255e17b90a9fc49f86f8 (diff)
downloadbcm5719-llvm-5a43ba8a6245372a55871e69fdec31017aae8eab.tar.gz
bcm5719-llvm-5a43ba8a6245372a55871e69fdec31017aae8eab.zip
[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 llvm-svn: 366883
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index f3688aa7ee4..96f02110280 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -2365,11 +2365,14 @@ tooling::Replacements sortUsingDeclarations(const FormatStyle &Style,
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;
OpenPOWER on IntegriCloud