[cfe-commits] Patch to recover from 'file not found' error
Jason Haslam
jason.haslam at gmail.com
Sat Nov 19 21:20:03 PST 2011
On Nov 19, 2011, at 12:15 PM, Douglas Gregor wrote:
> On Nov 2, 2011, at 4:45 PM, Jason Haslam wrote:
>
>> On Nov 2, 2011, at 12:16 PM, Douglas Gregor wrote:
>>
>>>> The attached patch adds the ability to recover from an include file not found error through the InclusionDirective PP callback. We use this in our IDE to provide an option to search among project files for missing includes.
>>>
>>> Wouldn't it be better for the callback to return a new header search path that would be used to find the header, so that we can augment the list of header search paths? That way, we can find the same header (and any other headers available via that path) in subsequent inclusions.
>>
>> It doesn't matter too much for our current use case, but yes you're absolutely right. If we eventually decide to prompt the user for the missing header we wouldn't want to continue prompting for the same directory over and over again. Updated patch attached.
>
> It occurs to me that we probably shouldn't change the signature of InclusionDirective for this. Rather, I'd prefer to have a new, separate "file not found" callback in PPCallbacks that the preprocessor only calls when it can't find the included file. Does that seem reasonable?
Sure, that's probably cleaner. Updated patch attached. Thanks for looking at this!
Jason
-------------- next part --------------
A non-text attachment was scrubbed...
Name: recovery.diff
Type: application/octet-stream
Size: 6665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111119/65a7080d/attachment.obj>
More information about the cfe-commits
mailing list