summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-11-14 09:02:28 +0000
committerDaniel Jasper <djasper@google.com>2014-11-14 09:02:28 +0000
commit30a2406e65a914fff3e2abcfd233e60470245f85 (patch)
tree1b14a8a9dca1b53d417ea09d3d3ec4db13bcd722 /clang
parent2ee635a6a6b2d5894ba819598da06628810d10ed (diff)
downloadbcm5719-llvm-30a2406e65a914fff3e2abcfd233e60470245f85.tar.gz
bcm5719-llvm-30a2406e65a914fff3e2abcfd233e60470245f85.zip
clang-format: [Java] No altnerative operator names in Java.
Before: someObject.and (); After: someObject.and(); llvm-svn: 221978
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/Format.cpp5
-rw-r--r--clang/unittests/Format/FormatTestJava.cpp4
2 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 740adb2b126..52a88e0a788 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -2133,8 +2133,9 @@ 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;
- LangOpts.CXXOperatorNames =
- Style.Language != FormatStyle::LK_JavaScript ? 1 : 0;
+ bool AlternativeOperators = Style.Language != FormatStyle::LK_JavaScript &&
+ Style.Language != FormatStyle::LK_Java;
+ LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0;
LangOpts.Bool = 1;
LangOpts.ObjC1 = 1;
LangOpts.ObjC2 = 1;
diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp
index 650c0af0cbb..e8e35c85ef7 100644
--- a/clang/unittests/Format/FormatTestJava.cpp
+++ b/clang/unittests/Format/FormatTestJava.cpp
@@ -50,6 +50,10 @@ protected:
}
};
+TEST_F(FormatTestJava, NoAlternativeOperatorNames) {
+ verifyFormat("someObject.and();");
+}
+
TEST_F(FormatTestJava, ClassDeclarations) {
verifyFormat("public class SomeClass {\n"
" private int a;\n"
OpenPOWER on IntegriCloud