[cfe-commits] [patch] Fix PR6353 and some related issues
Douglas Gregor
dgregor at apple.com
Mon Mar 1 21:49:52 PST 2010
On Mar 1, 2010, at 8:56 PM, Rafael Espindola wrote:
>>> One part of the patch I am not very happy with is the change to
>>> SemaExpr. It is there to match the logic in EmitBaseInitializer. The
>>> problem is that it is always marking the destructor as used. We should
>>> do so only if it is actually being used in a base initializer and
>>> exceptions are enabled. Suggestions on how to do so are welcome.
>>
>>
>> Sema::BuildBaseInitializer is where we perform type-checking for base initializers; I suggest putting this logic there. I also feel like we should always mark the destructor (even when exceptions are disabled), because -fno-exceptions should not change the behavior of the front end for non-exception constructs.
>
> The problem with Sema::BuildBaseInitializer is that it is not used in
> implicit cases like
>
> ------------------------------------------
> struct TypedInit {
> virtual ~TypedInit();
> };
> struct OpInit : public TypedInit {
> virtual void resolveBitReference();
> };
> struct BinOpInit : public OpInit {
> virtual void getAsString() const;
> };
> void foobar() {
> new BinOpInit();
> }
> ---------------------------------------------
Ah, sorry. Sema::SetBaseOrMemberInitializers handles both implicit base initializers and explicitly-written ones.
> The new patch is less aggressive then the old one. Now when marking a
> constructor as referenced we walk the initializers and mark the
> destructors for those classes as referenced.
Makes sense.
> I will try to go over the rest of the review tomorrow.
Should I wait until tomorrow to re-review?
- Doug
More information about the cfe-commits
mailing list