[cfe-commits] r172087 - in /cfe/trunk: test/TableGen/ test/TableGen/DiagnosticBase.inc test/TableGen/anonymous-groups.td test/TableGen/lit.local.cfg test/TableGen/tg-fixits.td utils/TableGen/ClangDiagnosticsEmitter.cpp

Dmitri Gribenko gribozavr at gmail.com
Thu Jan 10 16:38:30 PST 2013


On Fri, Jan 11, 2013 at 12:25 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Fri, Jan 11, 2013 at 12:20 AM, Jordan Rose <jordan_rose at apple.com> wrote:
>>
>> On Jan 10, 2013, at 14:19 , Dmitri Gribenko <gribozavr at gmail.com> wrote:
>>
>>> On Thu, Jan 10, 2013 at 11:54 PM, Jordan Rose <jordan_rose at apple.com> wrote:
>>>>
>>>> On Jan 10, 2013, at 13:51 , Dmitri Gribenko <gribozavr at gmail.com> wrote:
>>>>
>>>> On Thu, Jan 10, 2013 at 11:47 PM, Jordan Rose <jordan_rose at apple.com> wrote:
>>>>
>>>>
>>>> On Jan 10, 2013, at 13:41 , Dmitri Gribenko <gribozavr at gmail.com> wrote:
>>>>
>>>> On Thu, Jan 10, 2013 at 8:50 PM, Jordan Rose <jordan_rose at apple.com> wrote:
>>>>
>>>> --- cfe/trunk/test/TableGen/tg-fixits.td (added)
>>>> +++ cfe/trunk/test/TableGen/tg-fixits.td Thu Jan 10 12:50:46 2013
>>>> @@ -0,0 +1,41 @@
>>>> +// RUN: clang-tblgen -gen-clang-diag-groups -I%S %s -o /dev/null 2>&1 |
>>>> FileCheck --strict-whitespace %s
>>>> +include "DiagnosticBase.inc"
>>>> +
>>>> +def NamedGroup : DiagGroup<"name">;
>>>> +
>>>> +def InNamedGroup : Warning<"">, InGroup<DiagGroup<"name">>;
>>>> +//      CHECK: tg-fixits.td:[[@LINE-1]]:41: error: group 'name' is referred
>>>> to anonymously
>>>> +// CHECK-NEXT: {{^def InNamedGroup : Warning<"">,
>>>> InGroup<DiagGroup<"name">>;}}
>>>> +// CHECK-NEXT: {{^
>>>> ~~~~~~~~\^~~~~~~~~~~~~~~~~~}}
>>>> +// CHECK-NEXT: {{^                                InGroup<NamedGroup>}}
>>>> +
>>>> +def Wrapped : Warning<"">, InGroup<DiagGroup<
>>>> +  "name">>;
>>>> +//      CHECK: tg-fixits.td:[[@LINE-2]]:36: error: group 'name' is referred
>>>> to anonymously
>>>> +// CHECK-NEXT: {{^def Wrapped : Warning<"">, InGroup<DiagGroup<}}
>>>> +// CHECK-NEXT: {{^                           ~~~~~~~~\^~~~~~~~~~}}
>>>> +// CHECK-NEXT: {{^                           InGroup<NamedGroup>}}
>>>> +
>>>> +def AlsoWrapped : Warning<"">, InGroup<
>>>> +  DiagGroup<"name">>;
>>>> +//      CHECK: tg-fixits.td:[[@LINE-1]]:3: error: group 'name' is referred
>>>> to anonymously
>>>> +// CHECK-NEXT: {{^  DiagGroup<"name">>;}}
>>>> +// CHECK-NEXT: {{^~~\^~~~~~~~~~~~~~~~~~}}
>>>> +// CHECK-NEXT: {{^InGroup<NamedGroup>}}
>>>> +
>>>> +// The following lines contain hard tabs (\t); do not change this!
>>>> +def HardTabs : Warning<"">,
>>>> +       InGroup<        DiagGroup<"name">       >;
>>>> +//      CHECK: tg-fixits.td:[[@LINE-1]]:11: error: group 'name' is referred
>>>> to anonymously
>>>> +// CHECK-NEXT: {{^        InGroup<        DiagGroup<"name">       >;}}
>>>> +// CHECK-NEXT: {{^        ~~~~~~~~~~~~~~~~\^~~~~~~~~~~~~~~~~~~~~~~~~}}
>>>> +// CHECK-NEXT: {{^        InGroup<NamedGrop>}}
>>>> +
>>>> +// The following line has Unicode characters in it; do not change them!
>>>> +// FIXME: For now, we just give up on printing carets/ranges/fixits for
>>>> +// lines with Unicode in them, because SMDiagnostic don't keep a
>>>> byte<->column
>>>> +// map around to line things up like Clang does.
>>>> +def Unicode : Warning<"ユニコード">, InGroup<DiagGroup<"name">>;
>>>> +//      CHECK: tg-fixits.td:[[@LINE-1]]:51: error: group 'name' is referred
>>>> to anonymously
>>>> +// CHECK-NEXT: def Unicode : Warning<"{{[^"]+}}">,
>>>> InGroup<DiagGroup<"name">>;
>>>> +// CHECK-NEXT: note:
>>>>
>>>>
>>>> Hello Jordan,
>>>>
>>>> The Unicode test fails:
>>>> http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/119
>>>>
>>>> Dmitri
>>>>
>>>>
>>>> Hm. That doesn't make sense to me; the Unicode is clearly in the output,
>>>> Japanese characters require three bytes of UTF-8, and presumably take 1 or 2
>>>> columns each. Is there a way to get the input that FileCheck is seeing from
>>>> this builder?
>>>>
>>>>
>>>> The Japanese characters are fine (but since they are double-width, our
>>>> underlining in the terminal is funny).  The issue is with missing
>>>> CHECK lines.
>>>>
>>>>
>>>> Right, but the code in SourceMgr.cpp is supposed to say "oh, we can't print
>>>> a caret here because we'll get it wrong", and leave out the caret and fixit
>>>> lines (see LLVM r172086). Why would that fail?
>>>
>>> Breakpoint 1, llvm::SMDiagnostic::print (this=0x7fffffffd408,
>>> ProgName=0x0, S=..., ShowColors=true) at
>>> /home/gribozavr/clang/llvm/lib/Support/SourceMgr.cpp:400
>>> 400     SmallString<128> PrintableLine(LineContents);
>>> (gdb) p LineContents.data()
>>> $3 = 0x78cb38 "def Unicode : Warning<\"ユニコード\">, InGroup<DiagGroup<\"name\">>;"
>>> (gdb) n
>>> 401     std::replace(PrintableLine.begin(), PrintableLine.end(), '\t', ' ');
>>> (gdb) n
>>> 402     size_t NumColumns = (size_t)llvm::sys::locale::columnWidth(PrintableLine);
>>> (gdb) n
>>> 403     if (NumColumns != PrintableLine.size()) {
>>> (gdb) p NumColumns
>>> $4 = 69
>>> (gdb) p PrintableLine.size()
>>> $5 = 69
>>>
>>> Seems like columnWidth() is not working properly in this case.  I'm
>>> running with LANG=ru_UA.utf8, same results with LANG=en_US.utf8.
>>
>> Great. Okay, can you file a PR that columnWidth doesn't seem to work correctly on Linux systems? Meanwhile, I'll just blanket this check to "any non-ASCII characters" for now.
>
> Of course it is not working! :)  LocaleGeneric is used for some reason:
>
> (gdb) b llvm::sys::locale::columnWidth
> Breakpoint 1 at 0x5186b4: file
> /home/gribozavr/clang/llvm/lib/Support/LocaleGeneric.inc, line 8.
>
> I will file a PR.

Fixed up the test in r172152.

http://llvm.org/bugs/show_bug.cgi?id=14910

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/




More information about the cfe-commits mailing list