[cfe-dev] MultiExprPtr vs ArrayRef

Ahmed Charles ahmedcharles at gmail.com
Sat Oct 15 23:01:44 PDT 2011


I'm going through Sema and trying to clean up raw arrays and replace
them with ArrayRef's and learning a thing or two at the same time.
MultiExprPtr (typedef of ASTMultiPtr<Expr*>) claims to have ownership
semantics, but that doesn't seem to be the case in the code. It used
to have those Semantics back in 2008 when it was introduced, but they
were removed since then (my git fu isn't strong enough to easily
figure out when they were removed). Just wondering if MultiExprPtr
should be replaced with ArrayRef<Expr*> (they are equivalent other
than constness, more below), so it would seem that this would be the
way to go.

ArrayRef seems to force it's elements to be const, regardless of the
constness of the ArrayRef object. Is this something that wasn't added
simply because it wasn't needed at the time or because it's undesired?
The comments don't seem to indicate the rationale behind the choice,
simply that it was the choice.



More information about the cfe-dev mailing list