[cfe-dev] [PATCH] Fixit for incorrect includes

Douglas Gregor dgregor at apple.com
Tue Jul 17 15:54:58 PDT 2012


On Jul 17, 2012, at 1:27 PM, Aaron Ballman <aaron at aaronballman.com> wrote:

> This patch includes suggestions from David and Sebastian in terms of
> functionality and wording.

I love this Fix-It, but I'd like the diagnostic to be more specific:

Index: include/clang/Basic/DiagnosticLexKinds.td
===================================================================
--- include/clang/Basic/DiagnosticLexKinds.td	(revision 160277)
+++ include/clang/Basic/DiagnosticLexKinds.td	(working copy)
@@ -279,6 +279,7 @@
 def err_pp_invalid_directive : Error<"invalid preprocessing directive">;
 def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal;
+def err_pp_file_not_found_not_fatal : Error<"'%0' file not found as written">;

We need to say why it wasn't found as written. If spelling/case sensitivity comes along later, those can have appropriate specialized diagnostics as well. For the wording, how about something like:

"'%0' file not found with <angled> include; use \"quotes\" instead"

Fix-Its help, but we shouldn't rely on them to communicate information to the user about what went wrong.

  - Doug

> ~Aaron
> 
> On Tue, Jul 17, 2012 at 2:46 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> On Tue, Jul 17, 2012 at 2:37 PM, Sebastian Redl
>> <sebastian.redl at getdesigned.at> wrote:
>>> 
>>> On 17.07.2012, at 20:52, David Blaikie wrote:
>>> 
>>> On Tue, Jul 17, 2012 at 11:46 AM, Aaron Ballman <aaron at aaronballman.com>
>>> wrote:
>>> 
>>> Do we want to have a fatal and non-fatal
>>> 
>>> variant of the error (fatal for when no fixit is available)?
>>> 
>>> 
>>> Yes, I believe that'd be necessary. They can have different diagnostic
>>> names but the same text and just one of them is non-fatal.
>>> 
>>> 
>>> The non-fixit and fixit diagnostics would probably have different text
>>> anyway. "Header not found" and "Header not found as written, but found if
>>> looked up as if it was written with quotes" are pretty different.
>> 
>> Would it be fine to use "file not found as written"?  I ask because I
>> can see a second fixit coming pertaining to spelling or case
>> sensitivity.
>> 
>> ~Aaron
> <include_fixit.patch>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list