[cfe-dev] a question about the location of "define"

Eli Friedman eli.friedman at gmail.com
Sun Oct 20 20:17:49 PDT 2013


On Sat, Oct 19, 2013 at 10:04 PM, Rambo <hunanlwm at sina.cn> wrote:

> Hi,
>    There is a sample program as follows:
> #include<stdio.h>
> #define *(1)*uchar char
> void retrans(int *p,*(2)*uchar *q)
> {
>
> }
> int main()
> {
>   int a=1;
>   char b='c';
>   retrans(&a,&b);
>   return 0;
> }
> Now,I want to get the location about (2) with followed codes and I get
> location of (1) actually.
> for (FunctionDecl::param_iterator b = f->param_begin(), e = f->param_end();
> b != e; ++b)
>     if(ParmVarDecl *Body3=dyn_cast<ParmVarDecl>(*b))
>           SourceLocation begin=Body3->getLocStart();
> How I obtain the location (2)?thank you very much!
>
>
>
Try SourceManager::getExpansionLoc

-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131020/6aaeb191/attachment.html>


More information about the cfe-dev mailing list