[cfe-dev] Adding more info to builtin source types.
Enea Zaffanella
zaffanella at cs.unipr.it
Mon Jan 11 13:06:54 PST 2010
Hello.
Currently, class BuiltinTypeLoc provides a single source location,
accessible via member getNameLoc(), pointing to the name of the type
specifier type (e.g., for 'unsigned int' it would return the location of
'int'). It is quite common for coders to declare builtin integral types
using sign or width type specifiers only (e.g., 'unsigned', 'long',
'unsigned short', etc.). In these cases the getNameLoc() method would
return an invalid source location.
The attached patch augments BuiltinTypeLoc class by adding two source
locations, one for the sign specifier and the other for the width
specifier. We have added methods to get/set the three source locations.
We also modified method getNameLoc() so as to return what is _likely_ to
be the source location of the first type specifier token in the source
code, assuming that the three specifiers are provided in the "canonical"
order:
<sign> <width> <type>
Please let us know if the patch is OK.
Cheers,
Enea Zaffanella.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BuiltinTypeLoc.patch
Type: text/x-patch
Size: 5096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100111/73b52970/attachment.bin>
More information about the cfe-dev
mailing list