[cfe-commits] r164861 - in /cfe/trunk: bindings/xml/comment-xml-schema.rng tools/libclang/CXComment.cpp
Jordan Rose
jordan_rose at apple.com
Mon Oct 1 09:38:59 PDT 2012
On Oct 1, 2012, at 9:36 , Douglas Gregor <dgregor at apple.com> wrote:
>
> On Oct 1, 2012, at 9:33 AM, Jordan Rose <jordan_rose at apple.com> wrote:
>
>>
>> On Sep 30, 2012, at 20:41 , Douglas Gregor <dgregor at apple.com> wrote:
>>
>>>> + Result << "<Availability";
>>>> + StringRef distribution;
>>>> + if (AA->getPlatform()) {
>>>> + distribution = AA->getPlatform()->getName();
>>>> + if (distribution == "macosx")
>>>> + distribution = "OSX";
>>>> + else
>>>> + distribution = "iOS";
>>>> + }
>>>
>>> I agree with Dmitri, and suggest here that you map macosx -> OS X, ios -> iOS, and pass through the other names. Isn't there already code to do this in the AST library? Can it be abstracted nicely?
>>
>> I think what makes it tricky (read: hardcoded) is that these have to be XML node names, i.e. no spaces and few special characters. It's too bad they can't be attributes, though:
>>
>> <Availability platform="ios">...</Availability>
>>
>> ...but we're going for compatibility with an existing format (if internal).
>
> Huh?
>
> The existing format is
>
> <Availability distribution="iOS">…</Availability>
>
> or
>
> <Availability distribution="OS X">…</Availability>
>
> The "ios" and "macosx" names are baked into the 'availability' attribute. Those we can't change, but that's fine; they're meant to be identifiers.
Oh, whoops! I read this wrong. In that case, yes, I think there should either be an assert or explicit handling (or no distribution at all) if the platform isn't OS X or iOS. Also, if "OS X" really does have a space, the code is wrong.
More information about the cfe-commits
mailing list