[PATCH] D51333: Diagnose likely typos in include statements

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 12 17:55:32 PDT 2018


rsmith added a comment.

Thanks, some comments but the approach here looks great.



================
Comment at: include/clang/Basic/DiagnosticLexKinds.td:428-429
+def err_pp_file_not_found_typo_not_fatal
+    : Error<"'%0' file not found due to leading or trailing non-alphanumeric "
+            "characters">;
 def err_pp_error_opening_file : Error<
----------------
Our usual convention is to phrase this as "'%0' file not found; did you mean '%1'?". I don't think we need to describe the exact process we used to figure out the intended filename here; the user should be able to compare the names before and after to determine what we changed.


================
Comment at: lib/Lex/PPDirectives.cpp:1901
+            FilenameLoc,
+            LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename, false,
+            LookupFrom, LookupFromFile, CurDir,
----------------
You're passing in `false` for `isAngled` here, and producing a double-quoted replacement below. Is that intentional? I would expect that we would preserve the form of the header-name (quoted or angled) and suggest a replacement with the same form.


https://reviews.llvm.org/D51333





More information about the cfe-commits mailing list