Re: [anjuta-devel] Clang and the include files





On Mon, Aug 6, 2012 at 11:33 AM, Moritz Lüdecke <ritze skweez net> wrote:
Hi,


so you need to pass these paths to clang for it to work properly
Thanks, this is the command what I searched. I added the paths by hand [1]. But if I open a document, I'll get many errors of the same sort:
/usr/include/stdio.h:715:8: error: unknown type name 'size_t'

I wrote a hello world program. At the moment clang will only find the cursor to the definition, if the definition is in the same file. For example the definition of printf () cannot be found out.


Assuming you are using the same translation unit (CXTranslationUnit), you should be able to retrieve all declarations even if they are not in the same file.
(obviously you will not be able to find the *implementation* of printf)
 
The logic to get the cursor definition (regardless of its file)

- You get the cursor at the current location
- If the cursor is not a definition use clang_getCursorDefinition()
- Translate the cursor into the source location

(this is how I implemented it and its working very nicely)
I can give you reference to working code (GPLed) if you need more asistant


Regards,
Moritz

[1] https://github.com/ritze/anjuta-clang/commit/5e8cca68269b39516821d6d8f2c530158eccca98



--
Eran Ifrah
Author of the cross platform, open source C++ IDE: http://www.codelite.org



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]