[cfe-dev] Making Sema public

Chris Lattner clattner at apple.com
Wed Dec 17 20:50:07 PST 2008


On Dec 11, 2008, at 6:50 AM, Lukasz Janyst wrote:

> On Thu, Dec 11, 2008 at 7:27 AM, Chris Lattner <clattner at apple.com>  
> wrote:
>> I'd prefer not to, but could be convinced.  What sorts of crazy  
>> things do
>> you want to do?
>
>   I have a set of function declarations given as a vector of
> FunctionDecl objects. The set is dynamic, I mean its contents depend
> on the previous activity of the user. The code being parsed may call
> any of these functions. I need to make the parser to insert correct
> DeclRefExpr nodes when it encouters a function call so that I could
> later codegen the AST and link the resulting module to another module
> actually holding the definitions of these functions.
>
>   For example the following code is to be parsed:
>
> #include <stdio.h>
>
> int main( int argc, char** argv ) {
>  printf( "The result: %s\n", doSomething( argv[0] ) );
>  return 0;
> }
>
>  And I have: "char* doSomething( const char* input );" given as a  
> FunctionDecl.

hi Luckasz,

This is somewhat similar to how we synthesize builtins dynamically  
(see what happens when you use something like __builtin_bswap32 or  
something).  I'd be ok with adding a top-level hook that does a  
virtual method call to do a "last chance" resolution if normal lookup  
fails.  Would this work for you?

-Chris




More information about the cfe-dev mailing list