[cfe-dev] CXXConstructExpr qualifier loc?

Douglas Gregor dgregor at apple.com
Tue Jan 3 07:41:32 PST 2012


On Jan 2, 2012, at 4:26 PM, Jason Haslam wrote:

> Hi All,
> 
> I'm trying to visit the nested name specifier for the likes of CXXConstructExpr and CXXNewExpr but they don't seem to have a qualifier loc. Is this encoded elsewhere in the AST? If not, would it be appropriate to add a qualifier loc to these expressions?


CXXConstructExpr is only used when implicitly generating constructor calls, so it doesn't ever represent anything that's been written directly in the source. If an object construction is written in the source, you'll see a CXXTemporaryObjectExpr, which has a TypeSourceInfo that will include any qualification.

For CXXNewExpr, there are two potential qualifiers. The first is the qualifier on the type name, which will be part of the TypeSourceInfo for the allocated type. The second is the (optional) global qualifier ('::') that can precede 'new'. If present, the source location of the '::' will be the starting location of the expression, IIRC.

	- Doug



More information about the cfe-dev mailing list