[PATCH] Was: Re: r178663 - Don't compute a patched/semantic storage class.

Richard Smith richard at metafoo.co.uk
Fri May 10 11:52:01 PDT 2013


On Fri, May 10, 2013 at 8:01 AM, Enea Zaffanella <zaffanella at cs.unipr.it>wrote:

> On 05/10/2013 04:27 PM, Rafael EspĂ­ndola wrote:
>
>> We should really rename getStorageClassSpec to
>>> getStorageClassSpecAsWritten,
>>> too, to reduce the risk of it accidentally being used to determine the
>>> storage class for a variable.
>>>
>>
>> We always want these to be AsWritten, so renaming just this one looks
>> a bit odd. My preference would be to keep the shorter name (i.e. LGTM
>> Enea's patch), but if we are going to rename getStorageClassSpec we
>> should rename getStorageClass too.
>>
>> Cheers,
>> Rafael
>>
>
>
> My 2 cents:
>
>  - getStorageClassSpec() is a method of DeclSpec, whose instances are
> transient objects built during parsing and die soon after being used to
> construct the AST nodes; these objects typically only contain syntactic
> stuff, so the "AsWritten" suffix seems redundant;
>
>  - getStorageClass() is a method of VarDecl/FunctionDecl nodes;
> AST nodes have a longer lifetime and usually mix both syntactic and
> semantic info; the method is used, for instance, in CodeGen and Analysis
> ... I guess these ones care more about semantics.
> Hence, adding the "AsWritten" suffix here seems a reasonable choice to
> warn some of the AST clients.
>

Sorry, my bad, I meant to say that we should rename getStorageClass, not
getStorageClassAsWritten. We really don't want VarDecl::getStorageClass to
continue returning something other than the storage class of the variable
declaration.


> Anyway, if any renaming is to be done, it should go in its own patch.
> Therefore, OK to commit the submitted patch?


Yes, please go ahead.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130510/bbe1dbb6/attachment.html>


More information about the cfe-commits mailing list