[cfe-dev] SourceLocation of FunctionDecl

Nimrod Partush nimrodpar at gmail.com
Tue Nov 2 09:20:37 PDT 2010


Actually i tried it but this approach has 2 problems:

1. I can't always be sure that there will be a previous declaration.
2. When i try to receive the end location of the previous entity, i get a
location which is 2 or 3 offsets prior to the actual location. I think this
is a bug in GetLocEnd.

On Tue, Nov 2, 2010 at 6:14 PM, jahanian <fjahanian at apple.com> wrote:

> Can't you do this by adding code *after* the previous declaration entity?
>
> - Fariborz
>
> On Nov 2, 2010, at 7:54 AM, Nimrod Partush wrote:
>
> > Hi,
> >
> > I want to add code just before a certain function deceleration.
> >
> > I do this by visiting the FunctionDecl and using it's start location for
> InsertTextBefore.
> >
> > The problem is that GetLocStart returns the location of the Function's
> name and not the entire prototype i.e. if i have this function:
> >
> > static int f() {
> > }
> >
> > i will get the location of "f" and not the location of "static".
> >
> > Help?
> >
> > Thanks.
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101102/2caa431a/attachment.html>


More information about the cfe-dev mailing list