[cfe-dev] Absolute paths for UnsavedFiles

Andrey Pushkar via cfe-dev cfe-dev at lists.llvm.org
Tue May 19 01:37:56 PDT 2020


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
"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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200519/d9c0dda7/attachment.html>

More information about the cfe-dev mailing list