[PATCH] D51333: Diagnose likely typos in include statements
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 13 11:59:29 PDT 2018
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.
Looks good (with a couple of minor code style adjustments). Do you need someone to commit this for you?
In https://reviews.llvm.org/D51333#1233042, @sammccall wrote:
> One thing I'd like to do sometime is add code completion of filenames in #include directives.
> This would mean listing the relevant directories from the include path. (VFS is slow for this today, but I have a patch out for it).
>
> Maybe it would make sense to do that here and use edit-distance to pick the suggestion, like typo correction elsewhere?
> Could be a way to extend this patch's behavior in the future.
I agree; I think this would be a very interesting extension for this patch if someone feels motivated.
================
Comment at: lib/Lex/PPDirectives.cpp:1891
+ if (!File) {
+ auto originalFilename = Filename;
+ while (!isAlphanumeric(Filename.front())) {
----------------
Nit: please spell out the type here, because it's not obvious from the initializer. Please capitalize the variable name.
================
Comment at: lib/Lex/PPDirectives.cpp:1907
+ SourceRange Range(FilenameTok.getLocation(), CharEnd);
+ auto hint = isAngled ? FixItHint::CreateReplacement(
+ Range, "<" + Filename.str() + ">")
----------------
Nit: please capitalize this variable name.
https://reviews.llvm.org/D51333
More information about the cfe-commits
mailing list