[PATCH] [Statepoints][NFC] Constify accessors on Statepoint.

Philip Reames listmail at philipreames.com
Fri Jun 26 11:54:22 PDT 2015



On 06/26/2015 11:49 AM, Sanjoy Das wrote:
> In http://reviews.llvm.org/D10755#195561, @reames wrote:
>
>> Returning a pointer to a non-const component of the underlying call from
>>   a const function seems deceptive.
>
> I wouldn't quite call it deceptive -- `CallSite` uses the same idiom, and the `const` conveys that, for instance, there is no caching going on in the background and the calling `getArgument` is reallyt idempotent.
Well, modulo mutable at least.  const is not about caching.  It's about 
visible side effects on the object.
>
>> ValueTy *getActualCallee() const {
>> I'm open to being convinced that's reasonable, but I'd prefer to see
>>   those left non-const or overrides which return pointers-to-const added.
>
> `ImmutableStatepoint` will return `const Value *`s as usual.
>
> Having said that, I'm not going to argue that this change is a particularly useful one; the //real// reason behind this change and http://reviews.llvm.org/D10756 is to make `Statepoint`  more similar to `CallSite` with the eventual goal of merging these classes.
Given this, LGTM.  I'm not a huge fan of the usage here, but this is 
really minor and outweighed by the benefit you outline.  We may consider 
"fixing" CallSite, but that's definitely a distinct and optional change.
>
>> Philip
>
>
>
>
> http://reviews.llvm.org/D10755
>
> EMAIL PREFERENCES
>    http://reviews.llvm.org/settings/panel/emailpreferences/
>
>




More information about the llvm-commits mailing list