[cfe-dev] Not getting expected Decls (possible newbie mistake)

Pascal Dennerly dnnrly at gmail.com
Tue Feb 23 14:11:22 PST 2010


I hate to sound like I'm having a conversation with myself but I just
thought I'd update this thread for the sake of anyone that has a similar
problem in the future. I've found lots of previous threads useful myself so
I wanted to make sure that I followed up properly.

It appears that the problem is that I wasn't setting the language properly
and the namespace keyword and Stuff::Thingy declaration weren't being
recognised as good C++.

One thing that helped me diagnose this was to iterate through the strings
output from the diagnostics via the diagnostics buffer via the
error_begin/end methods.

To solve this in the short term I did this:

CompilerInvocation *pInv = new CompilerInvocation()
pInv->getLangOpts().CPlusPlus = 1;
compiler_instance.setInvocation(pInv);

The next problem I found was that when I tried point to another file, the
parser couldn't find any include files. The solution to this problem is to
parse the command line with full -I options included. A great example of how
to do this can be found in:
tools/driver/cc1_main.cpp: cc1_main(...)

I hope someone (anyone) finds this useful.

Pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100223/26241990/attachment.html>


More information about the cfe-dev mailing list