[cfe-dev] Looking up another function in code generation

Nat! nat at mulle-kybernetik.com
Fri Jun 12 07:22:22 PDT 2015


During llvm generation of a function I would like to know, if another function (known to me by name) is defined. So I want to find if a FuncDecl by name exists.

There is probably a really easy way to do it, but I don’t know how.


P.S. This is my state of knowledge:

>From what I gathered, I would probably want to find a „DeclContext“ to make a „lookup“. But what I have is „CodeGenFunction" and not much else and I am not subclassing, nor do I really want to. 

CodeGenFunction has 

  /// CurCodeDecl - This is the inner-most code context, which includes blocks.
  const Decl *CurCodeDecl;

which would then allow me „getDeclContext“.  But CurCodeDecl is private :-/

More information about the cfe-dev mailing list