[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-16 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. I see. Thank you. I fixed the issue using its workaround. https://reviews.llvm.org/D125727 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-16 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. In D124726#3516896 , @ken-matsui wrote: > @nathanchance > > Oops, thank you for your comment! > I would like to work on a hotfix patch for this issue. > > @aaron.ballman > > Should we entirely opt-out of this suggestion on `.S

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-16 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. @nathanchance Oops, thank you for your comment! I would like to work on a hotfix patch for this issue. @aaron.ballman Should we entirely opt-out of this suggestion on `.S` files? I think there are other approaches here, such as decreasing the max edit distance to av

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D124726#3516346 , @nathanchance wrote: > I see an instance of this warning in the Linux kernel due to the "Now, for > unknown directives inside a skipped conditional block, we diagnose the > unknown directive as a warn

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-16 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added subscribers: nickdesaulniers, nathanchance. nathanchance added a comment. I see an instance of this warning in the Linux kernel due to the "Now, for unknown directives inside a skipped conditional block, we diagnose the unknown directive as a warning if it is sufficiently simi

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-13 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you for your support! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. LGTM, thank you for this! I adjusted the release note and commit message somewhat when landing to make sure they were detailed enough. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.or

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGa247ba9d1563: Suggest typo corrections for preprocessor directives

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-13 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. @aaron.ballman I prepared a new public email address: `v...@kmatsui.me` instead of the auto-generated one. So, could you please use the new one for future commit? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-13 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. @aaron.ballman I prepared a new public email address: `g...@kmatsui.me` instead of the auto-generated one. So, could you please use the new one for future commit? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-12 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 429005. ken-matsui added a comment. Revert the changes for errored directives Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726 Files: clang/docs/ReleaseNotes.rst

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-12 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:1257 // If we reached here, the preprocessing token is not valid! - Diag(Result, diag::err_pp_invalid_directive); + Diag(Result, diag::err_pp_invalid_directive) << 0; aaron.ballma

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:1257 // If we reached here, the preprocessing token is not valid! - Diag(Result, diag::err_pp_invalid_directive); + Diag(Result, diag::err_pp_invalid_directive) << 0; ken-matsu

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-12 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428985. ken-matsui added a comment. Add test for errored directive but no suggestion Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726 Files: clang/docs/ReleaseNot

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-12 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428983. ken-matsui added a comment. Update the code as reviewed and add a release note Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726 Files: clang/docs/ReleaseN

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-12 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you for your review :) Comment at: clang/lib/Lex/PPDirectives.cpp:1257 // If we reached here, the preprocessing token is not valid! - Diag(Result, diag::err_pp_invalid_directive); + Diag(Result, diag::err_pp_invalid_directive) << 0;

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. You should also come up with a release note for the changes. Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:431-432 +def err_pp_invalid_directive : Error< + "invalid preprocessing directive%select{|, did you mean '#%1'?}0" +>; +def w

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-11 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:36 +// elfidef: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you mean '#elifdef'?}} +// elfindef: c2x-cpp2b-warning@-12 {{invalid preprocessing directive, did you

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-11 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428827. ken-matsui added a comment. Remove unused includes in `StringRef.h` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726 Files: clang/include/clang/Basic/Diag

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-11 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you for your support! I updated the code, so could you please review this patch again? Comment at: llvm/lib/Support/StringRef.cpp:102 +// Find a similar string in `Candidates`. +Optional StringRef::find_similar_str(const std::vector &Candidat

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-11 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428826. ken-matsui added a comment. Update the code as reviewed Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726 Files: clang/include/clang/Basic/DiagnosticLexKin

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: llvm/lib/Support/StringRef.cpp:102 +// Find a similar string in `Candidates`. +Optional StringRef::find_similar_str(const std::vector &Candidates, size_t Dist) const { + // We need to check if `rng` has the exact case-insensitive

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-11 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:10 +// expected-warning@+11 {{'#elfidef' directive not found, did you mean '#elifdef'?}} +// expected-warning@+11 {{'#elfindef' directive not found, did you mean '#elifdef'?}} +// e

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:10 +// expected-warning@+11 {{'#elfidef' directive not found, did you mean '#elifdef'?}} +// expected-warning@+11 {{'#elfindef' directive not found, did you mean '#elifdef'?}} +/

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:10 +// expected-warning@+11 {{'#elfidef' directive not found, did you mean '#elifdef'?}} +// expected-warning@+11 {{'#elfindef' directive not found, did you mean '#elifdef'?}} +// e

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428471. ken-matsui added a comment. Set `AllowReplacements` to `true` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726 Files: clang/include/clang/Basic/Diagnostic

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:3 + +// id: not suggested to '#if' +// ifd: expected-warning@+11 {{invalid preprocessing directive, did you mean '#if'?}} erichkeane wrote: > aaron.bal

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-10 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:3 + +// id: not suggested to '#if' +// ifd: expected-warning@+11 {{invalid preprocessing directive, did you mean '#if'?}} aaron.ballman wrote: > This stil

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:3 + +// id: not suggested to '#if' +// ifd: expected-warning@+11 {{invalid preprocessing directive, did you mean '#if'?}} This still suggests that some

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428395. ken-matsui added a comment. Fix the test for FindSimilarStr Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726 Files: clang/include/clang/Basic/DiagnosticLe

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:444 + + if (auto Sugg = Directive.find_similar_str(Candidates)) { +CharSourceRange DirectiveRange = erichkeane wrote: > I don't believe this meets our requirements for 'auto'. Than

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428335. ken-matsui added a comment. Herald added a subscriber: hiraditya. Updated the code as reviewed Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726 Files: cla

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:441 + constexpr StringRef Candidates[] = { + "if", "ifdef", "ifndef", "elif", "elifdef", "elifndef", "else", "endif" + }; erichkeane wrote: > Should this be dependent on C mode

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-09 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:441 + constexpr StringRef Candidates[] = { + "if", "ifdef", "ifndef", "elif", "elifdef", "elifndef", "else", "endif" + }; Should this be dependent on C modes? it would be kind of

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a subscriber: erichkeane. aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:10 +// expected-warning@+11 {{'#elfidef' directive not found, did you mean '#elifdef'?}} +// expected-warning@+11 {{'#elfindef' direc

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-07 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:362-365 +def warn_pp_typo_directive : Warning< + "'#%0' directive not found, did you mean '#%1'?">, + InGroup; aaron.ballman wrote: > ken-matsui wrote: > > aaron.bal

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-06 Thread Christopher Di Bella via Phabricator via cfe-commits
cjdb added a comment. Thanks for working on this! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-06 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a subscriber: cjdb. aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:362-365 +def warn_pp_typo_directive : Warning< + "'#%0' directive not found, did you mean '#%1'?">, + InGroup; ken-matsui

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-05 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 427263. ken-matsui added a comment. Remove unnecessary includes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.org/D124726 Files: clang/include/clang/Basic/DiagnosticLexKin

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-05 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 427262. ken-matsui added a comment. Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Update codes as reviewed Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.l

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-05 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/include/clang/Tooling/LevDistance.h:1 +//===--- LevDistance.h --*- C++ -*-===// +// ken-matsui wrote: > aaron.ballman wrote: > > You shouldn't need this file or the imple

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-04 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you so much for your clear review! Comment at: clang/include/clang/Basic/DiagnosticGroups.td:1023-1024 +// Typoed directive warnings +def TypoedDirective : DiagGroup<"typoed-directive">; + aaron.ballman wrote: > We don't typi

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-03 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a subscriber: rsmith. aaron.ballman added a comment. Thank you for working on this! Comment at: clang/include/clang/Basic/DiagnosticGroups.td:1023-1024 +// Typoed directive warnings +def TypoedDirective : DiagGroup<"typoed-directive">; + W

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-04-30 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/test/OpenMP/predefined_macro.c:7 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -verify -o - %s -// expected-no-diagnostics +// expected-warning@+5 {{'#elsif' directive not found, did you mean '#elif'?}} #ifdef FOPENMP -

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-04-30 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui created this revision. ken-matsui added a reviewer: aaron.ballman. Herald added a subscriber: mgorny. Herald added a project: All. ken-matsui requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. This patch implements suggestion for ty