summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-07-24 08:04:29 +0000
committerFangrui Song <maskray@google.com>2019-07-24 08:04:29 +0000
commit00e8ac3bebfa92e5a6260de0a87d70108d03edf4 (patch)
treeda2f7c34f7387365daf992a88ae06d0288e663ae /clang/lib/Format/Format.cpp
parent0e7bbb11220a761fd999440b9bba3d30cac35095 (diff)
downloadbcm5719-llvm-00e8ac3bebfa92e5a6260de0a87d70108d03edf4.tar.gz
bcm5719-llvm-00e8ac3bebfa92e5a6260de0a87d70108d03edf4.zip
[Format] Make it easy to add new format::FormatStyle::LanguageStandard. NFCI
Preparatory change for D65043. We current use `!=LS_Cpp03` to enable language standards 11,14,17, and 2a. `>=LS_Cpp11` is better if we decide to add new LanguageStandard in the future. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D65183 llvm-svn: 366876
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 62e8fdc977c..f3688aa7ee4 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -2366,10 +2366,10 @@ tooling::Replacements sortUsingDeclarations(const FormatStyle &Style,
LangOptions getFormattingLangOpts(const FormatStyle &Style) {
LangOptions LangOpts;
LangOpts.CPlusPlus = 1;
- LangOpts.CPlusPlus11 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
- LangOpts.CPlusPlus14 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
- LangOpts.CPlusPlus17 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
- LangOpts.CPlusPlus2a = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 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.LineComment = 1;
bool AlternativeOperators = Style.isCpp();
LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0;
OpenPOWER on IntegriCloud