[cfe-dev] Function Lookup in SemaExpr
Aaron W.Hsu
arcfide at sacrideo.us
Mon Dec 1 21:16:32 PST 2014
Dear Nikola:
Thanks a bunch for the help, this is what I was looking for. I was trying to do it with Context.Idents. Basically, at the moment it’s sort of like a built-in function, but the reason I need to lookup the function is because I’m rewriting parts of the AST to be calls into these built-ins instead of what they would be originally.
--
Aaron W. Hsu | arcfide at sacrideo.us | http://www.sacrideo.us
Please support my work: https://www.gratipay.com/arcfide/
לֵ֤ב חֲכָמִים֙ בְּבֵ֣ית אֵ֔בֶל וְלֵ֥ב כְּסִילִ֖ים בְּבֵ֥ית שִׂמְחָֽה׃
From: Nikola Smiljanic
Sent: Monday, December 1, 2014 10:30 PM
To: Aaron W.Hsu
Cc: Clang Dev List
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
Sent: Monday, December 1, 2014 6:19 PM
To: Aaron W.Hsu
Cc: Clang Dev List
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/e430c52a/attachment.html>
More information about the cfe-dev
mailing list