[cfe-dev] Proposal to change the PPCallbacks interface

Manuel Klimek klimek at google.com
Wed Mar 9 18:51:59 PST 2011


Hi,

the attached patch is a proposal to add the "raw path" (== the path
that a file was accessed by in the file manager) into the PPCallback's
InclusionDirective call.

The problem this solves is that we're trying to replay the compilation
after observing it via PPCallbacks by mapping virtual files into the
cache.
Considering the following example:

lib/b/b.h:
#include "../a/a.h"

lib/a/a.h:
int a();

b.cc:
#include "lib/b/b.h"
#include "lib/a/a.h"
int main() { return 0; }

When compiled with -Ilib/b, the FileEntry in the InclusionDirective
will have a getName() leading to "lib/b/../a/a.h" for both include
directives of a.h because of inode caching.
When we replay this compilation, we need to inject the raw path under
which the include is looked up, which means that we need to get a.h
into the cache for "./lib/a/a.h".

Is this an acceptable solution?
Thanks,
/Manuel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-raw-path.diff
Type: text/x-patch
Size: 18897 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110309/1ccb4bc0/attachment.bin>


More information about the cfe-dev mailing list