[cfe-dev] TypeAliasDecl SourceRange is not giving proper range

Vane, Edwin edwin.vane at intel.com
Thu Mar 28 05:45:21 PDT 2013


Sorry, didn't mean to reply to this thread.

From: Vane, Edwin
Sent: Thursday, March 28, 2013 8:44 AM
To: 'Abir Basak'; cfe-dev at cs.uiuc.edu
Subject: RE: [cfe-dev] TypeAliasDecl SourceRange is not giving proper range

Who would I talk to about getting the build bots to track clang-tools-extra?

From: cfe-dev-bounces at cs.uiuc.edu<mailto:cfe-dev-bounces at cs.uiuc.edu> [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Abir Basak
Sent: Thursday, March 28, 2013 8:30 AM
To: cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>
Subject: [cfe-dev] TypeAliasDecl SourceRange is not giving proper range

I am new to clang ast, and trying to parse some c++ code with it.

When I am using TypedefDecl->getSourceRange() for say
typedef long double LDBL it returns the whole thing
However when I am using TypeAliasDecl->getSourceRange() for say
using LDBL = long double
it only returns the range using LDBL = long. (i.e removes the double part)

I used the code below to extract text from SourceRange
char const* first = sm.getCharacterData(r.getBegin());
 char const* last = sm.getCharacterData(pp.getLocForEndOfToken(r.getEnd()));
 return std::string(first,last);

Am I doing something wrong? How can I get the whole source range, and esp the type part of it i.e. long double part, so that I can rearrange it as typedef long double LDBL
I am using clang 3.2 with RAV

Any help will be appreciated.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130328/fb73be1c/attachment.html>


More information about the cfe-dev mailing list