[cfe-dev] Accessing FunctionDecl from clang::Expr

Amila Jayasekara thejaka.amila at gmail.com
Wed Oct 8 18:43:32 PDT 2014


Hello All,

I am trying to find the clang::FunctionDecl relevant to a return expression
(clang::Expr). For example consider following function;

1. int foo(int a, int b) {
2.
3.  int k;
4.  int d = 5 * k;
5.
6.  return d;
7.
8. }


I have an expression (clang::Expr type) relevant to line 6 (return
statement). From that I want to access the function declaration
(clang::FunctionDecl) where return statement resides (i.e. foo).

Further I need to access declarations relevant to lines 3 and 4. I believe
I can access name declarations relevant to lines 3 and 4 once I have access
to FunctionDecl.

Could you please advise how to access clang::FunctionDecl from clang::Expr ?

Thank you in advance.

Regards
-Thejaka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141008/a4d8227f/attachment.html>


More information about the cfe-dev mailing list