[PATCH] D125727: [clang] Avoid suggesting typoed directives in `.S` files

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

[PATCH] D125727: [clang] Avoid suggesting typoed directives in `.S` files

2022-05-16 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. @nickdesaulniers Thank you for your review! I do not have permission to land this patch, so could you please do it on my behalf? Here is my information: Name: `Ken Matsui` Email: `v...@kmatsui.me` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION ht

[PATCH] D125727: [clang] Avoid suggesting typoed directives in `.S` files

2022-05-16 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Sorry for having missed it. Thank you! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125727/new/ https://reviews.llvm.org/D125727 ___ cfe-commits mailing list cfe-commits@list

[PATCH] D125727: [clang] Avoid suggesting typoed directives in `.S` files

2022-05-16 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 429877. ken-matsui added a comment. Remove `- < %s` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125727/new/ https://reviews.llvm.org/D125727 Files: clang/lib/Lex/PPDirectives.cpp clang/test/Preprocess

[PATCH] D125727: [clang] Avoid suggesting typoed directives in `.S` files

2022-05-16 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Removed it 👍 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125727/new/ https://reviews.llvm.org/D125727 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[PATCH] D125727: [clang] Avoid suggesting typoed directives in `.S` files

2022-05-16 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 429872. ken-matsui added a comment. Remove `-x assembler-with-cpp` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125727/new/ https://reviews.llvm.org/D125727 Files: clang/lib/Lex/PPDirectives.cpp clang/

[PATCH] D125727: [clang] Avoid suggesting typoed directives in `.S` files

2022-05-16 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:484 const SourceLocation &EndLoc) const { + // If this is a `.S` file, treat unknown # directives as non-preprocessor + // directives. nickde

[PATCH] D125727: [clang] Avoid suggesting typoed directives in `.S` files

2022-05-16 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you for your review! I've fixed it. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125727/new/ https://reviews.llvm.org/D125727 ___ cfe-commits mailing list cfe-commits@l

[PATCH] D125727: [clang] Avoid suggesting typoed directives in `.S` files

2022-05-16 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 429869. ken-matsui added a comment. Update the code as reviewed Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125727/new/ https://reviews.llvm.org/D125727 Files: clang/lib/Lex/PPDirectives.cpp clang/tes

[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] D125727: Avoid suggesting typoed directives in `.S` files

2022-05-16 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui created this revision. ken-matsui added a reviewer: aaron.ballman. 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 is itended to avoid suggesting typoed directives in `.S` files

[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-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 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 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] D125178: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode

2022-05-12 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. I fixed it! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125178/new/ https://reviews.llvm.org/D125178 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode

2022-05-12 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428910. ken-matsui added a comment. Fix the failed test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125178/new/ https://reviews.llvm.org/D125178 Files: clang/docs/ReleaseNotes.rst clang/include/clang/

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode

2022-05-11 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you so much for your review! My public email address is: `07softy_br...@icloud.com`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125178/new/ https://reviews.llvm.org/D125178

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode

2022-05-11 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428840. ken-matsui added a comment. Updated the code as reviewed, added a release note, and merged `ext-cpp2b-pp-directive.cpp` & `ext-c2x-pp-directive.c` into `ext-pp-directive.c`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION http

[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 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] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-11 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Hello @Jake-Egan, I believe the problem was already fixed by the @aaron.ballman's patch here . Thank you for fixing it, @aaron.ballman! Repository: rG LLVM Github Monorepo CHAN

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode

2022-05-11 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you for your review! I updated the code. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125178/new/ https://reviews.llvm.org/D125178 ___ cfe-commits mailing list cfe-comm

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode

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

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-11 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. > That looks to be exactly what I needed, but you can double-check that you > were properly attributed here: > https://github.com/llvm/llvm-project/commit/786c721c2bbd2e0646e314671e010859550423bf > I added one when I landed. I also adjusted the commit message slight

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. In D124534#3504610 , @aaron.ballman wrote: > LGTM, thank you for all the hard work on this! I assume you need me to land > this on your behalf -- if so, can you let me know what name and email address > you would like me to

[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] D124534: [clang] Add a diagnostic for line directive of a gnu extension

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

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you for your review! I'm going to fix them :) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124534/new/ https://reviews.llvm.org/D124534 ___ cfe-commits mailing list cfe

[PATCH] D125078: Implement a feature to show line numbers in diagnostics

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you all so much :))) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125078/new/ https://reviews.llvm.org/D125078 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428435. ken-matsui added a comment. Fix failed tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125178/new/ https://reviews.llvm.org/D125178 Files: clang/include/clang/Basic/DiagnosticLexKinds.td cla

[PATCH] D125078: Implement a feature to show line numbers in diagnostics

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you :) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125078/new/ https://reviews.llvm.org/D125078 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x mode

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:696-698 +def ext_c2x_pp_directive : Extension< + "%select{#elifdef|#elifndef}0 is a C2x extension">, + InGroup; aaron.ballman wrote: > ken-matsui wrote: > > aaron.ball

[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] D125178: Warn if using `elifdef` & `elifndef` in not C2x mode

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. In D125178#3503617 , @aaron.ballman wrote: > It looks like precommit CI caught some related failures: > > Failed Tests (7): > Clang :: Lexer/deprecate-macro.c > Clang :: Lexer/unsafe-macro.c > Clang :: Preprocess

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428382. ken-matsui added a comment. Update test codes as reviewed Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124534/new/ https://reviews.llvm.org/D124534 Files: clang/include/clang/Basic/DiagnosticGrou

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x mode

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you so much for your review! Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:696-698 +def ext_c2x_pp_directive : Extension< + "%select{#elifdef|#elifndef}0 is a C2x extension">, + InGroup; aaron.ballman wrote: > I

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x mode

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

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/test/Preprocessor/line-directive-system-headers.c:2-6 -// RUN: not %clang_cc1 -E %s 2>&1 | grep 'blonk.c:92:2: error: ABC' -// RUN: not %clang_cc1 -E %s 2>&1 | grep 'blonk.c:93:2: error: DEF' -// RUN: not %clang_cc1 -E %s 2>&1 |

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you for your review! Comment at: clang/test/Preprocessor/line-directive-system-headers.c:2-6 -// RUN: not %clang_cc1 -E %s 2>&1 | grep 'blonk.c:92:2: error: ABC' -// RUN: not %clang_cc1 -E %s 2>&1 | grep 'blonk.c:93:2: error: DEF' -// RUN: not

[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] D125078: Implement a feature to show line numbers in diagnostics

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. This feature is already implemented in GCC, so in my opinion, it would be great if we could turn this on by default. I also added a feature to separate location info and a message in https://reviews.llvm.org/D125175. Should its feature be avoided from turning on by d

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-10 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui marked an inline comment as not done. ken-matsui added inline comments. Comment at: clang/test/Preprocessor/line-directive.c:33 # 42 "foo" 2 // expected-error {{invalid line marker flag '2': cannot pop empty include stack}} # 42 "foo" 1 3 // enter # 42 "foo" 2 3

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-09 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 428301. ken-matsui added a comment. Add a test file that uses the `-Wsystem-headers` option. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124534/new/ https://reviews.llvm.org/D124534 Files: clang/include

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x mode

2022-05-07 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui created this revision. ken-matsui added a reviewer: aaron.ballman. 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 resolves https://github.com/llvm/llvm-project/issues/55306. R

[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] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-07 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. After some investigations, some directives behave weirdly. I will continue investigating, but do you have any suggestions here? Comment at: clang/test/Preprocessor/line-directive.c:33 # 42 "foo" 2 // expected-error {{invalid line marker flag '2': ca

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-07 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. @aaron.ballman Thank you for your review and sorry to have missed those directives! I also found additional directives that I might have to diagnose. Could you please tell me if these are also required? Comment at: clang/test/Preprocessor/line-dire

[PATCH] D125078: Implement a feature to show line numbers in diagnostics

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

[PATCH] D125078: Implement a feature to show line numbers in diagnostics

2022-05-06 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui created this revision. Herald added a project: All. ken-matsui requested review of this revision. Herald added subscribers: cfe-commits, MaskRay. Herald added a project: clang. I implemented a feature to show line numbers with left margins in diagnostics like GCC-9 does. Ref: https://

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-05 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. @aaron.ballman I could suppress the strange warnings by using `isWrittenInBuiltinFile` and `isWrittenInCommandLineFile`. Thank you! Could you please review this patch? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D12453

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

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

[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] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-04 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. In D124534#3490732 , @aaron.ballman wrote: > The tests run in -cc1 mode and don't #include anything, so I don't think the > issue is an internally included SDK. I think the issue could be from this: > https://github.com/llvm

[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] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-03 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. @aaron.ballman > If so, I think putting Diag after the call of this function would be better. With the above change, I tried to add comments to failed tests, but there were over 300 files. During my investigation, I found most tests printed warnings without file in

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-03 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:1356 + +PP.Diag(FlagTok, diag::ext_pp_gnu_line_directive); } else if (FlagVal == 2) { aaron.ballman wrote: > ken-matsui wrote: > > aaron.ballman wrote: > > > ken-matsui wrote: > >

[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

[PATCH] D124534: Add a diagnostic for line directive of a gnu extension

2022-04-29 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 426185. ken-matsui added a comment. Add a diagnostic for line directive of a gnu extension Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124534/new/ https://reviews.llvm.org/D124534 Files: clang/include/c

[PATCH] D124534: Add a diagnostic for line directive of a gnu extension

2022-04-29 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:1356 + +PP.Diag(FlagTok, diag::ext_pp_gnu_line_directive); } else if (FlagVal == 2) { aaron.ballman wrote: > ken-matsui wrote: > > aaron.ballman wrote: > > > I speculate that this

[PATCH] D124534: Add a diagnostic for line directive of a gnu extension

2022-04-29 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:1356 + +PP.Diag(FlagTok, diag::ext_pp_gnu_line_directive); } else if (FlagVal == 2) { aaron.ballman wrote: > I speculate that this change is wrong. > > The goal here is to diagno

[PATCH] D124556: [NFC] Prevent shadowing a variable declared in `if`

2022-04-29 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Thank you! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124556/new/ https://reviews.llvm.org/D124556 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llv

[PATCH] D124534: Add a diagnostic for line directive of a gnu extension

2022-04-28 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Hi, @aaron.ballman Thanks for your kind reviews! I’ve updated the code, but is this what you’d expected? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124534/new/ https://reviews.llvm.org/D124534 __

[PATCH] D124534: Add a diagnostic for line directive of a gnu extension

2022-04-28 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 425916. ken-matsui added a comment. Add a diagnostic for line directive of a gnu extension Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124534/new/ https://reviews.llvm.org/D124534 Files: clang/include/c

[PATCH] D124556: [NFC] Prevent shadowing a variable declared in `if`

2022-04-28 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. @hubert.reinterpretcast I see. Thank you for the detailed information! Could you please commit this patch? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124556/new/ https://reviews.llvm.org/D124556 ___

[PATCH] D124556: [NFC] Prevent shadowing a variable declared in `if`

2022-04-28 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. @hubert.reinterpretcast Sorry, I'm a newbie here, but is there anything I should do after getting approved? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124556/new/ https://reviews.llvm.org/D124556 __

[PATCH] D124556: [NFC] Prevent shadowing a variable declared in `if`

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

[PATCH] D124556: [NFC] Prevent shadowing a variable declared in `if`

2022-04-28 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. @hubert.reinterpretcast, Thank you for your suggestion! I’ve updated the summary. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124556/new/ https://reviews.llvm.org/D124556 _

[PATCH] D124556: [NFC] Prevent shadowing a variable declared in `if`

2022-04-28 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. @hubert.reinterpretcast, Sorry to have missed providing a summary. In most cases, shadowing a declaration of a local variable should be avoided to prevent making others confused and mistakes because we need to figure out the boundaries of the declaration. In this ca

[PATCH] D124556: Prevent shadowing a variable declared in `if`

2022-04-27 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui created this revision. Herald added a project: All. ken-matsui requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D124556 Files: clang/lib/Basic/Diagnostic.cpp Ind

[PATCH] D124534: Add a warning diagnostic for line directive of a gnu extension

2022-04-27 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. Hi @aaron.ballman, Thank you for your review! I updated the code. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124534/new/ https://reviews.llvm.org/D124534 ___ cfe-commits m

[PATCH] D124534: Add a warning diagnostic for line directive of a gnu extension

2022-04-27 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui updated this revision to Diff 425601. ken-matsui added a comment. Add a diagnostic for line directive of a gnu extension Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124534/new/ https://reviews.llvm.org/D124534 Files: clang/include/c

[PATCH] D124534: Add a warning diagnostic for line directive of a gnu extension

2022-04-27 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui added a comment. This change is related to: https://github.com/llvm/llvm-project/issues/55067 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124534/new/ https://reviews.llvm.org/D124534 ___ cfe

[PATCH] D124534: Add a warning diagnostic for line directive of a gnu extension

2022-04-27 Thread Ken Matsui via Phabricator via cfe-commits
ken-matsui created this revision. Herald added a project: All. ken-matsui requested review of this revision. Herald added projects: clang, clang-tools-extra. Herald added a subscriber: cfe-commits. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D124534 Files: clang-tools-extra/