[Patch] Fix '-include' Path Search (PR 3395)

Attached is a patch to fix '-include' for clang (PR 3395).

Currently, paths fed to '-include' are treated as relative to the
compliation unit at hand, instead of to the current working directory
from which clang was invoked. The patch coerces relative paths into
absolute ones, which seem to be handled just fine by the Lexer and

That said, this feels a bit hackish. I hate munging paths. It's
entirely possible someone more familiar could suggest a cleaner way
:). Nothing is jumping out at me from my cursory, hobbyist readings.

Cool Beans,
-Jon Simons

PatchJS (1.37 KB)

Hi Jon,

Thanks for the patch!

My feeling is we should fix this bug in clang-cc, not the driver, though. I would also argue for making an makeAbsolute method on llvm::sys::Path.

This is PR3464 by the way:

I think the cleanest way to handle this would be to allow the predefines buffer to supply the current directory as the place to start the header search, so the usual search mechanisms handle the resolution. I’m not sure what this involves, however.

  • Daniel

2009/4/5 Jon Simons <simonsj@ccs.neu.edu>