[cfe-users] Can't perform name lookup with Sema class

DeadMG wolfeinstein at gmail.com
Sun Dec 23 10:48:24 PST 2012


Hey all,

I've experienced some troubles using the Clang C++ API. If I am requesting
assistance in the wrong place, if you could kindly point me to somewhere
more appropriate, I'd appreciate it.

Firstly, I have been attempting to use the Sema class to perform name
lookup. I have a very simple test case that declares one function, and then
attempts to call it with the incorrect number of arguments. Clang emits the
expected diagnostic, and even quotes the entire function declaration, so
the name is clearly available, but the Sema instance insists that the name
does not exist when I attempt to look it up.

I have pasted the relevant code here:
http://pastebin.com/kFRdQF4M

The IdentifierInfo, and the file and source information all check out in
the debugger as far as I can tell. If you can identify any issues, I would
much appreciate it.

Secondly, I have been looking to produce files such as the main.cpp above
as llvm::Module*. I intend to do things such as link it to other modules
from other sources and add functions and such to this module. Whilst I have
been able to cause Clang to write out the module in various formats to the
drive, I was hoping instead to simply have the Module object. The public
API doesn't appear to include such a function, so I was looking to use the
CodeGenModule class from part of the implementation. Would this class be
suitable for that purpose?

Thanks,
DeadMG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20121223/0b4ff637/attachment.html>


More information about the cfe-users mailing list