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

Enea Zaffanella zaffanella at cs.unipr.it
Fri May 10 08:01:17 PDT 2013


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.

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

Enea.




More information about the cfe-commits mailing list