r221978 - clang-format: [Java] No altnerative operator names in Java.
Daniel Jasper
djasper at google.com
Fri Nov 14 01:02:28 PST 2014
Author: djasper
Date: Fri Nov 14 03:02:28 2014
New Revision: 221978
URL: http://llvm.org/viewvc/llvm-project?rev=221978&view=rev
Log:
clang-format: [Java] No altnerative operator names in Java.
Before:
someObject.and ();
After:
someObject.and();
Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTestJava.cpp
Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=221978&r1=221977&r2=221978&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Fri Nov 14 03:02:28 2014
@@ -2133,8 +2133,9 @@ LangOptions getFormattingLangOpts(const
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;
Modified: cfe/trunk/unittests/Format/FormatTestJava.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJava.cpp?rev=221978&r1=221977&r2=221978&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestJava.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJava.cpp Fri Nov 14 03:02:28 2014
@@ -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"
More information about the cfe-commits
mailing list