Absolute paths for UnsavedFiles

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Absolute paths for UnsavedFiles

Vassil Vassilev via cfe-dev

I've recently stumbled upon a bug in one of the clang-related projects: we've been calling clang_parseTranslationUnit() from clang C API there, and we have not been able to pass _both_ saved and unsaved files - apparently commandline we've been passing was not correct.
After looking into this for a while I've figured out that while clang is OK with accepting just file names (without paths) for real files, it demands _absolute_ paths for the unsaved files.
So I've got a couple of questions:
- Is my understanding correct, or I've missed something?
- What is the motivation for this behaviour, and is there any chance we could work it around by using -I directives or anything else?
- Could you please elaborate on the following bit from the docs on CXUnsavedFile::Filename: 
"This file must already exist in the file system". Does it mean we have to explicitly create it in virtual FS beforehand? And if so, why does specifying the full path seem to override this requirement?

I've tried debugging this, but unfortunately, I didn't manage to fully understand the logic behind it :(

Thank you!

Andrey Pushkar

cfe-dev mailing list
[hidden email]