<div dir="ltr">On Mon, May 20, 2013 at 6:17 PM, Alexander Kornienko <span dir="ltr"><<a href="mailto:alexfh@google.com" target="_blank">alexfh@google.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Please take a look. Is this enough?</div></div></blockquote><div><br></div><div style>Does it trigger the crash before your fix?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Index: test/Format/style-on-command-line.cpp</div><div>===================================================================</div>
<div>--- test/Format/style-on-command-line.cpp       (revision 182291)</div>
<div>+++ test/Format/style-on-command-line.cpp       (working copy)</div><div>@@ -5,8 +5,10 @@</div><div> // RUN: clang-format -style="{lsjd}" %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s</div>

<div> // RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format</div><div> // RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s</div><div>+// RUN: echo -e "\n" > %T/.clang-format</div>
</div></blockquote><div><br></div><div style>Why not 'touch'?</div><div style><br></div><div style><br></div><div style>Actually, I think all of these tests should change to not use 'echo' or other shell commands to build up the configuration files, and instead the configuration files should be directly added as files to the test suite under the 'Inputs' directory. That makes them much more friendly to Windows IIRC.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<div>+// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s</div><div> // RUN: echo -e "BasedOnStyle: google\nIndentWidth: 5" > %T/.clang-format</div><div>

-// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s</div><div>+// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK7 %s</div>

<div> void f() {</div><div> // CHECK1: {{^        int\* i;$}}</div><div> // CHECK2: {{^       int \*i;$}}</div><div>@@ -17,7 +19,9 @@</div><div> // CHECK4: {{^  int \*i;$}}</div><div> // CHECK5: Can't find usable .clang-format, using LLVM style</div>

<div> // CHECK5: {{^  int \*i;$}}</div><div>-// CHECK6: {{^     int\* i;$}}</div><div>+// CHECK6: Can't find usable .clang-format, using LLVM style</div><div>+// CHECK6: {{^  int \*i;$}}</div><div>+// CHECK7: {{^     int\* i;$}}</div>

<div> int*i;</div><div> int j;</div><div> }</div><div><br></div></div><div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On Mon, May 20, 2013 at 8:00 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</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"><div>On Mon, May 20, 2013 at 3:18 PM, Alexander Kornienko <span dir="ltr"><<a href="mailto:alexfh@google.com" target="_blank">alexfh@google.com</a>></span> wrote:<br>

</div><div class="gmail_extra"><div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: alexfh<br>
Date: Mon May 20 10:18:01 2013<br>
New Revision: 182290<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=182290&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=182290&view=rev</a><br>
Log:<br>
Minor fix: don't crash on empty configuration file, consider empty configuration files invalid.<br></blockquote><div><br></div></div><div>Test case please!</div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<br>
Modified:<br>
    cfe/trunk/lib/Format/Format.cpp<br>
<br>
Modified: cfe/trunk/lib/Format/Format.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=182290&r1=182289&r2=182290&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=182290&r1=182289&r2=182290&view=diff</a><br>



==============================================================================<br>
--- cfe/trunk/lib/Format/Format.cpp (original)<br>
+++ cfe/trunk/lib/Format/Format.cpp Mon May 20 10:18:01 2013<br>
@@ -201,6 +201,8 @@ bool getPredefinedStyle(StringRef Name,<br>
 }<br>
<br>
 llvm::error_code parseConfiguration(StringRef Text, FormatStyle *Style) {<br>
+  if (Text.trim().empty())<br>
+    return llvm::make_error_code(llvm::errc::invalid_argument);<br>
   llvm::yaml::Input Input(Text);<br>
   Input >> *Style;<br>
   return Input.error();<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div><div><font color="#666666"><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(213,15,37);border-right-color:rgb(213,15,37);border-bottom-color:rgb(213,15,37);border-left-color:rgb(213,15,37);padding-top:2px;margin-top:2px">Alexander Kornienko |</span><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(51,105,232);border-right-color:rgb(51,105,232);border-bottom-color:rgb(51,105,232);border-left-color:rgb(51,105,232);padding-top:2px;margin-top:2px"> Software Engineer |</span></font><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(0,153,57);border-right-color:rgb(0,153,57);border-bottom-color:rgb(0,153,57);border-left-color:rgb(0,153,57);padding-top:2px;margin-top:2px"><font color="#666666"> </font><a href="mailto:alexfh@google.com" style="color:rgb(17,85,204)" target="_blank">alexfh@google.com</a> |</span><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(238,178,17);border-right-color:rgb(238,178,17);border-bottom-color:rgb(238,178,17);border-left-color:rgb(238,178,17);padding-top:2px;margin-top:2px"> <a value="+35315435283" style="color:rgb(17,85,204)">+49 151 221 77 957</a></span></div>

</div><div><font color="#666666"><span style="font-family:Arial,Verdana,sans-serif">Google Germany GmbH | </span><span style="font-family:Arial,Verdana,sans-serif">Dienerstr. 12 | </span><span style="font-family:Arial,Verdana,sans-serif">80331 München</span></font></div>


</font></span></div>
</blockquote></div><br></div></div>