r182290 - Minor fix: don't crash on empty configuration file, consider empty configuration files invalid.

Alexander Kornienko alexfh at google.com
Mon May 20 11:38:52 PDT 2013


On Mon, May 20, 2013 at 8:20 PM, Chandler Carruth <chandlerc at google.com>wrote:

> On Mon, May 20, 2013 at 6:17 PM, Alexander Kornienko <alexfh at google.com>wrote:
>
>> Please take a look. Is this enough?
>>
>
> Does it trigger the crash before your fix?
>

Yes, of course.


>
>
>>
>> Index: test/Format/style-on-command-line.cpp
>> ===================================================================
>> --- test/Format/style-on-command-line.cpp       (revision 182291)
>> +++ test/Format/style-on-command-line.cpp       (working copy)
>> @@ -5,8 +5,10 @@
>>  // RUN: clang-format -style="{lsjd}" %t.cpp 2>&1 | FileCheck
>> -strict-whitespace -check-prefix=CHECK4 %s
>>  // RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format
>>  // RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck
>> -strict-whitespace -check-prefix=CHECK5 %s
>> +// RUN: echo -e "\n" > %T/.clang-format
>>
>
> Why not 'touch'?
>

To also check it with whitespace-only .clang-format.


> 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.
>

We already have grep in one of the RUN lines, so "echo" doesn't make things
worse. We already have plans to make some of our "unit" tests integration
tests instead, as they are in fact. But FileCheck isn't suitable for this,
we need a different mechanism for this, so it'll be a bit later. And I
think this particular test will better fit into that structure. So I'd
leave it as is for now, if you don't object.


>
>
>> +// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck
>> -strict-whitespace -check-prefix=CHECK6 %s
>>  // RUN: echo -e "BasedOnStyle: google\nIndentWidth: 5" > %T/.clang-format
>> -// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck
>> -strict-whitespace -check-prefix=CHECK6 %s
>> +// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck
>> -strict-whitespace -check-prefix=CHECK7 %s
>>  void f() {
>>  // CHECK1: {{^        int\* i;$}}
>>  // CHECK2: {{^       int \*i;$}}
>> @@ -17,7 +19,9 @@
>>  // CHECK4: {{^  int \*i;$}}
>>  // CHECK5: Can't find usable .clang-format, using LLVM style
>>  // CHECK5: {{^  int \*i;$}}
>> -// CHECK6: {{^     int\* i;$}}
>> +// CHECK6: Can't find usable .clang-format, using LLVM style
>> +// CHECK6: {{^  int \*i;$}}
>> +// CHECK7: {{^     int\* i;$}}
>>  int*i;
>>  int j;
>>  }
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130520/de3c2d91/attachment.html>


More information about the cfe-commits mailing list