<div dir="ltr">Does 323294 help?</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 23, 2018 at 4:58 PM, Galina Kistanova via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Nico,<br><br>This commit broke one of our builders:<br><br><a href="http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror/builds/4701" target="_blank">http://lab.llvm.org:8011/<wbr>builders/ubuntu-gcc7.1-werror/<wbr>builds/4701</a><br>. . .<br>FAILED: /usr/local/gcc-7.1/bin/g++-7.<wbr>1 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/clang/lib/Format -I/home/buildslave/am1i-slv2/<wbr>ubuntu-gcc7.1-werror/llvm/<wbr>tools/clang/lib/Format -I/home/buildslave/am1i-slv2/<wbr>ubuntu-gcc7.1-werror/llvm/<wbr>tools/clang/include -Itools/clang/include -Iinclude -I/home/buildslave/am1i-slv2/<wbr>ubuntu-gcc7.1-werror/llvm/<wbr>include -Wno-noexcept-type -fPIC -fvisibility-inlines-hidden -Werror -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-<wbr>initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -fPIC -UNDEBUG -fno-exceptions -fno-rtti -MD -MT tools/clang/lib/Format/<wbr>CMakeFiles/clangFormat.dir/<wbr>UnwrappedLineParser.cpp.o -MF tools/clang/lib/Format/<wbr>CMakeFiles/clangFormat.dir/<wbr>UnwrappedLineParser.cpp.o.d -o tools/clang/lib/Format/<wbr>CMakeFiles/clangFormat.dir/<wbr>UnwrappedLineParser.cpp.o -c /home/buildslave/am1i-slv2/<wbr>ubuntu-gcc7.1-werror/llvm/<wbr>tools/clang/lib/Format/<wbr>UnwrappedLineParser.cpp<br>/home/buildslave/am1i-slv2/<wbr>ubuntu-gcc7.1-werror/llvm/<wbr>tools/clang/lib/Format/<wbr>UnwrappedLineParser.cpp: In member function ‘void clang::format::<wbr>UnwrappedLineParser::<wbr>parseLevel(bool)’:<br>/home/buildslave/am1i-slv2/<wbr>ubuntu-gcc7.1-werror/llvm/<wbr>tools/clang/lib/Format/<wbr>UnwrappedLineParser.cpp:345:7: error: this statement may fall through [-Werror=implicit-fallthrough=<wbr>]<br> }<br> ^<br>/home/buildslave/am1i-slv2/<wbr>ubuntu-gcc7.1-werror/llvm/<wbr>tools/clang/lib/Format/<wbr>UnwrappedLineParser.cpp:348:5: note: here<br> case tok::kw_case:<br> ^~~~<br>cc1plus: all warnings being treated as errors<br>ninja: build stopped: subcommand failed.<br><br>Please have a look?<br><br>Thanks<br><br>Galina<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 23, 2018 at 8:30 AM, Nico Weber via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: nico<br>
Date: Tue Jan 23 08:30:56 2018<br>
New Revision: 323218<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=323218&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=323218&view=rev</a><br>
Log:<br>
clang-format: Support formatting Java 8 interface default methods.<br>
<br>
Modified:<br>
cfe/trunk/lib/Format/Unwrapped<wbr>LineParser.cpp<br>
cfe/trunk/unittests/Format/For<wbr>matTestJava.cpp<br>
<br>
Modified: cfe/trunk/lib/Format/Unwrapped<wbr>LineParser.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=323218&r1=323217&r2=323218&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Format/Unw<wbr>rappedLineParser.cpp?rev=32321<wbr>8&r1=323217&r2=323218&view=<wbr>diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Format/Unwrapped<wbr>LineParser.cpp (original)<br>
+++ cfe/trunk/lib/Format/Unwrapped<wbr>LineParser.cpp Tue Jan 23 08:30:56 2018<br>
@@ -333,7 +333,18 @@ void UnwrappedLineParser::parseLeve<wbr>l(boo<br>
nextToken();<br>
addUnwrappedLine();<br>
break;<br>
- case tok::kw_default:<br>
+ case tok::kw_default: {<br>
+ unsigned StoredPosition = Tokens->getPosition();<br>
+ FormatToken *Next = Tokens->getNextToken();<br>
+ FormatTok = Tokens->setPosition(StoredPosi<wbr>tion);<br>
+ if (Next && Next->isNot(tok::colon)) {<br>
+ // default not followed by ':' is not a case label; treat it like<br>
+ // an identifier.<br>
+ parseStructuralElement();<br>
+ break;<br>
+ }<br>
+ // Else, if it is 'default:', fall through to the case handling.<br>
+ }<br>
case tok::kw_case:<br>
if (Style.Language == FormatStyle::LK_JavaScript &&<br>
Line->MustBeDeclaration) {<br>
@@ -1032,8 +1043,12 @@ void UnwrappedLineParser::parseStru<wbr>ctura<br>
// 'default: string' field declaration.<br>
break;<br>
nextToken();<br>
- parseLabel();<br>
- return;<br>
+ if (FormatTok->is(tok::colon)) {<br>
+ parseLabel();<br>
+ return;<br>
+ }<br>
+ // e.g. "default void f() {}" in a Java interface.<br>
+ break;<br>
case tok::kw_case:<br>
if (Style.Language == FormatStyle::LK_JavaScript && Line->MustBeDeclaration)<br>
// 'case: string' field declaration.<br>
<br>
Modified: cfe/trunk/unittests/Format/For<wbr>matTestJava.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJava.cpp?rev=323218&r1=323217&r2=323218&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/unittests/Form<wbr>at/FormatTestJava.cpp?rev=3232<wbr>18&r1=323217&r2=323218&view=<wbr>diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/unittests/Format/For<wbr>matTestJava.cpp (original)<br>
+++ cfe/trunk/unittests/Format/For<wbr>matTestJava.cpp Tue Jan 23 08:30:56 2018<br>
@@ -144,6 +144,7 @@ TEST_F(FormatTestJava, ClassDeclarations<br>
verifyFormat("public interface SomeInterface {\n"<br>
" void doStuff(int theStuff);\n"<br>
" void doMoreStuff(int moreStuff);\n"<br>
+ " default void doStuffWithDefault() {}\n"<br>
"}");<br>
verifyFormat("@interface SomeInterface {\n"<br>
" void doStuff(int theStuff);\n"<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>