[llvm-commits] RFC: new tool: llvm-strings

Dmitri Gribenko gribozavr at gmail.com
Tue Nov 13 08:50:00 PST 2012


On Tue, Nov 13, 2012 at 6:46 PM, Marshall Clow <mclow.lists at gmail.com> wrote:
> On Nov 13, 2012, at 8:00 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>
>> On Tue, Nov 13, 2012 at 5:29 PM, Marshall Clow <mclow.lists at gmail.com> wrote:
>>> On Nov 12, 2012, at 12:58 PM, Eric Christopher <echristo at gmail.com> wrote:
>>>
>>> On Mon, Nov 12, 2012 at 7:58 AM, Marshall Clow <mclow.lists at gmail.com>
>>> wrote:
>>>>
>>>> Here's a first cut at a "strings" tool for LLVM.
>>>>
>>>> It is currently missing one feature: the ability to dump the strings from
>>>> a single object file in an archive.
>>>> There are also some 80 column style violations in the source.
>>>>
>>>> I'll be fixing both of those and re-posting soon - but I'm posting now
>>>> this to get feedback - to see if anyone thinks that I'm missing (any other)
>>>> stuff.
>>>
>>>
>>> Tabs, oh god the tabs.
>>>
>>>
>>> To spare Eric the agony, I have:
>>> * removed all the tabs
>>> * cleaned up a bunch of style violations
>>> * implemented the feature to dump only the contents of one object file in an
>>> archive.
>>
>> Hi Marshall,
>>
>> +bool isPrintable( char c ) {
>> +  return isalnum(c) ||
>> +         ispunct(c) ||
>> +         (isspace(c) && (!iscntrl(c) || c == '\t')) ||
>> +         (isascii(c) && isprint(c));
>> +//  Easy to replace this with a table at some point
>> +  }
>>
>> isalpha() & friends are locale-dependent.
>
> Yes.
> Is that a problem?
> [ Seriously. I can see arguments either way. ]

As a user, I would not expect toolchain output to depend on locale.

Anyway, it is 2012, so most strings that contain non-ASCII characters
in practice should be UTF-8 encoded.  So it might make sense to
include support for UTF-8 instead.

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 llvm-commits mailing list