How do I get the EndLoc for a function prototype?

Hi All,

This seems really simple, but I just can’t get it to work. Suppose I’m running a libtool over the following code:

int foo(int);

int foo(int i) {
return ++i;
}

When I intercept the first foo FunctionDecl (the prototype) with a RecursiveASTVisitor and I get the SourceRange, I would expect it to be

int foo(int);
^begin ^end

int foo(int i) {
return ++i;
}

But instead I get

int foo(int);
^begin

int foo(int i) {
return ++i;
}

^end

Any advice would be much appreciated.

Thanks in advance,

Scott Constable

UPDATE: My mistake, my code was incorrect :). I was using FunctionDecl::hasBody() to detect whether or not a FunctionDecl is a prototype, whereas I should have been using FunctionDecl::doesThisDeclarationHaveABody().