diff options
author | Nico Weber <nicolasweber@gmx.de> | 2017-02-24 19:10:12 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2017-02-24 19:10:12 +0000 |
commit | d96ae867351ece78d2aa2fe0fb463a626fbb3029 (patch) | |
tree | 2781930994a16ea12577896489c0502d5bf6e6a1 /clang/lib/Format/Format.cpp | |
parent | 3f4a4b36818ace88fb0263ba7e999115a2c7d7af (diff) | |
download | bcm5719-llvm-d96ae867351ece78d2aa2fe0fb463a626fbb3029.tar.gz bcm5719-llvm-d96ae867351ece78d2aa2fe0fb463a626fbb3029.zip |
clang-format: Fix many Objective-C formatting regressions from r289428
r289428 added a separate language kind for Objective-C, but kept many
"Language == LK_Cpp" checks untouched. This introduced a "IsCpp()"
method that returns true for both C++ and Objective-C++, and replaces
all comparisons of Language with LK_Cpp with calls to this new method.
Also add a lot more test coverge for formatting things in LK_ObjC mode,
by having FormatTest's verifyFormat() test for LK_ObjC everything that's
being tested for LK_Cpp at the moment.
Fixes PR32060 and many other things.
llvm-svn: 296160
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 77d351eeb2b..9d72797cff1 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1662,7 +1662,7 @@ bool isDeletedHeader(llvm::StringRef HeaderName, tooling::Replacements fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style) { - if (Style.Language != FormatStyle::LanguageKind::LK_Cpp) + if (!Style.IsCpp()) return Replaces; tooling::Replacements HeaderInsertions; @@ -1864,7 +1864,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) { LangOpts.CPlusPlus11 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; LangOpts.CPlusPlus14 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; LangOpts.LineComment = 1; - bool AlternativeOperators = Style.Language == FormatStyle::LK_Cpp; + bool AlternativeOperators = Style.IsCpp(); LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0; LangOpts.Bool = 1; LangOpts.ObjC1 = 1; |