[cfe-dev] Function Lookup in SemaExpr

Nikola Smiljanic popizdeh at gmail.com
Mon Dec 1 19:30:43 PST 2014


Where is this function name coming from? Is it some kind of built-in?

You should be able to construct DeclarationName from IdentifierInfo. Call
PP.getIdentiferInfo inside Sema to get the identifier.

On Tue, Dec 2, 2014 at 1:03 PM, Aaron W.Hsu <arcfide at sacrideo.us> wrote:

>  Dear Nikola:
>
> Thanks for the introduction to LookupName() and LookupResult. I think this
> is exactly what I want, especially LookupSingleName(). However, I seem to
> require a DeclarationName, which I don’t have yet. I’m not sure how to get
> one. I just have a string which is the name of the function I wish to
> lookup (this is in C), and I don’t know how to get from there to a
> DeclarationName and the other information I need.
>
> --
> Aaron W. Hsu | arcfide at sacrideo.us | http://www.sacrideo.us
> Please support my work: https://www.gratipay.com/arcfide/
> לֵ֤ב חֲכָמִים֙ בְּבֵ֣ית אֵ֔בֶל וְלֵ֥ב כְּסִילִ֖ים בְּבֵ֥ית שִׂמְחָֽה׃
>
> *From:* Nikola Smiljanic <popizdeh at gmail.com>
> *Sent:* ‎Monday‎, ‎December‎ ‎1‎, ‎2014 ‎6‎:‎19‎ ‎PM
> *To:* Aaron W.Hsu <arcfide at sacrideo.us>
> *Cc:* Clang Dev List <cfe-dev at cs.uiuc.edu>
>
> Create LookupResult and call LookupName on it passing appropriate
> DeclarationContext into which you're performing the lookup (can be a scope
> or record decl).
>
> On Tue, Dec 2, 2014 at 10:00 AM, Aaron W.Hsu <arcfide at sacrideo.us> wrote:
>
>>  Dear Clang Developers:
>>
>> Inside of SemaExpr.cpp when handling BinOps, I want to lookup the (Expr
>> *) and (NamedDecl) of a function by its name. How can I do this?
>>
>> Yours truly,
>>
>> Aaron W. Hsu
>>
>>
>> --
>> Aaron W. Hsu | arcfide at sacrideo.us | http://www.sacrideo.us
>> Please support my work: https://www.gratipay.com/arcfide/
>> לֵ֤ב חֲכָמִים֙ בְּבֵ֣ית אֵ֔בֶל וְלֵ֥ב כְּסִילִ֖ים בְּבֵ֥ית שִׂמְחָֽה׃
>>
>>
>> _______________________________________________
>> 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/20141202/64246031/attachment.html>


More information about the cfe-dev mailing list