[PATCH] D140860: [Diagnostics][NFC] Fix -Wlogical-op-parentheses warning inconsistency for const and constexpr values

2023-01-02 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet created this revision. hazohelet added a project: clang. Herald added a project: All. hazohelet requested review of this revision. When using the `&&` operator within a `||` operator, both Clang and GCC produce a warning for potentially confusing operator precedence. However, Clang avoi

[PATCH] D140860: [Diagnostics][NFC] Fix -Wlogical-op-parentheses warning inconsistency for const and constexpr values

2023-01-05 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. As you point out, enhancement may be more accurate than bug fix. There are rare cases where enabling a warning for missing parentheses in `constexpr` logical expressions can be helpful, I think. For example, consider the following code: constexpr A = ...; constexp

[PATCH] D140860: [Diagnostics][NFC] Fix -Wlogical-op-parentheses warning inconsistency for const and constexpr values

2023-01-06 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 486776. hazohelet added a comment. This update limits the warning suppression case to string literals only, and delete no longer necessary functions. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140860/new/ https://reviews.llvm.org/D140860 File

[PATCH] D140860: [Diagnostics][NFC] Fix -Wlogical-op-parentheses warning inconsistency for const and constexpr values

2023-01-06 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 486793. hazohelet added a comment. add up the former 2 commits into 1 CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140860/new/ https://reviews.llvm.org/D140860 Files: clang/lib/Sema/SemaExpr.cpp clang/test/Sema/logical-op-parentheses.c Inde

[PATCH] D140860: [Diagnostics][NFC] Fix -Wlogical-op-parentheses warning inconsistency for const and constexpr values

2023-01-06 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. > So, so long as a string literal still does the suppression, it's probably > fine. I agree with you. I now also think that integer literals _should not_ do the warning suppression because programmers are sometimes unsure of the expansion result of predefined macros

[PATCH] D140860: [Diagnostics][NFC] Fix -Wlogical-op-parentheses warning inconsistency for const and constexpr values

2023-01-07 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. I have yet to do thorough checks using this patched clang to build significant code bases. It will likely take quite a bit of time as I am not used to editing build tool files. Instead, I used `grep` to find potentially newly-warned codes. The `grep` command is shown

[PATCH] D140860: [Diagnostics][NFC] Fix -Wlogical-op-parentheses warning inconsistency for const and constexpr values

2023-01-10 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. > FWIW a lot of build systems support setting CXXFLAGS/CFLAGS before invoking > the build system/build generator (cmake, for instance) and respects those - > so might be relatively easy to add a new warning flag to the build (& CXX/CC > to set the compiler to point to

[PATCH] D142800: [Clang][Diagnostic] Add `-Wcomparison-op-parentheses` to warn on chained comparisons

2023-01-27 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet created this revision. hazohelet added reviewers: dblaikie, aaron.ballman, erichkeane. Herald added a project: All. hazohelet requested review of this revision. Herald added a reviewer: jdoerfert. Herald added a subscriber: sstefan1. Herald added a project: clang. This patch introduces a

[PATCH] D142800: [Clang][Diagnostic] Add `-Wcomparison-op-parentheses` to warn on chained comparisons

2023-01-28 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 492986. hazohelet added a comment. Fix the new warning issued against libcxx test code. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D142800/new/ https://reviews.llvm.org/D142800 Files: clang/docs/ReleaseNotes.rst clang/include/clang/Basic/Di

[PATCH] D142800: [Clang][Diagnostic] Add `-Wcomparison-op-parentheses` to warn on chained comparisons

2023-01-31 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added inline comments. Comment at: clang/lib/Sema/SemaExpr.cpp:15548 + + SuggestParentheses(Self, Bop->getOperatorLoc(), + Self.PDiag(diag::note_precedence_silence) erichkeane wrote: > I find myself wondering if we could provide a b

[PATCH] D142800: [Clang][Diagnostic] Add `-Wcomparison-op-parentheses` to warn on chained comparisons

2023-02-03 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 494635. hazohelet added a comment. Address comments from erichkeane: - Fix comment wording - Avoid using macro in test file Implement my proposal for fix-it hint: - In the case of chained relational operators (`<`, `>`, `<=`, `>=`), suggest adding `&&`.

[PATCH] D142800: [Clang][Diagnostic] Add `-Wcomparison-op-parentheses` to warn on chained comparisons

2023-02-04 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. > Also, why are these diagnostics off by default? Do we have some idea as to > the false positive rate? As for the false positive rate, I have checked for instances of this warning in the codebases for 'oneapi-src/oneTBB', 'rui314/mold', and 'microsoft/lightgbm', but

[PATCH] D140860: [Diagnostics][NFC] Fix -Wlogical-op-parentheses warning inconsistency for const and constexpr values

2023-01-12 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D140860#4047534 , @aaron.ballman wrote: > In D140860#4045224 , @dblaikie > wrote: > >> In D140860#4044937 , >> @aaron.ballman wrote: >> >>

[PATCH] D140860: [Diagnostics][NFC] Fix -Wlogical-op-parentheses warning inconsistency for const and constexpr values

2023-01-12 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 488863. hazohelet added a comment. I added the release note. > Also, do you need someone to commit on your behalf? If so, what name and > email address would you like used for patch attribution? I don't have commit access. Would you please land this patch

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-09-26 Thread Takuya Shimizu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG491b2810fb7f: [clang][SemaCXX] Diagnose tautological uses of consteval if and… (authored by hazohelet). Changed prior to commit: https://reviews.l

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-09-27 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D155064#4651306 , @hans wrote: > We saw a new warning in Chromium after this, and I wasn't sure if that's > intentional: > > #include > > template float foo(T input) { > if (sizeof(T) > 2) { > return 42; >

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-09-27 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Thanks for the report about the errors in lambdas. The culprit is `clang/lib/Sema/SemaTemplateInstantiateDecl.cpp`. I am pushing constant-evaluated context if the instantiated variable is constexpr variable, and somehow it causes those errors. I'll take deeper look in

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-09-28 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Thank you for the revert! This looks like a general issue of clang on template deduction in constant-evaluated context (https://godbolt.org/z/zTro7Ycfa). Pushing constant-evaluated context against initializer of instantiated constexpr variables made this bug appear i

[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

2023-09-30 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet abandoned this revision. hazohelet added a comment. Thank you so much to everyone for guiding this patch onto the right track! I'll submit GitHub PR after making suggested changes. Since Phabricator is going to be shutdown, I mark this differential as abandoned. CHANGES SINCE LAST AC

[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

2023-10-01 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D155610#4652198 , @cor3ntin wrote: > @hazohelet Please keep this patch on Phab. It's not going to be shutdown. The > current consensus is that we will reconsider shutting down phab on November 15 > https://discourse.llvm.org

[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

2023-10-01 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 557524. hazohelet added a comment. Address comments from Corentin CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155610/new/ https://reviews.llvm.org/D155610 Files: clang/docs/ReleaseNotes.rst clang/include/clang/Basic/Diagnostic.h clang/lib

[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

2023-10-03 Thread Takuya Shimizu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG2176c5e510e3: [Clang][Sema] Fix display of characters on static assertion failure (authored by hazohelet). Changed prior to commit: https://reviews.llvm.org/D155610?vs=557524&id=557581#toc Repository:

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-07-18 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 541528. hazohelet marked 8 inline comments as done. hazohelet edited the summary of this revision. hazohelet added a comment. Address review comments - Rename tablegen name of the diagnostics to follow other tautological warnings - Remove redundant modifica

[PATCH] D155610: [Clang][ExprConstant] Print integer instead of character on static assertion failure

2023-07-18 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet created this revision. hazohelet added reviewers: aaron.ballman, tbaeder, cjdb. Herald added a project: All. hazohelet requested review of this revision. Herald added a project: clang. BEFORE this patch, the values printed in `static_assert` were printed after ignoring the implicit type

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-07-19 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Regarding the clang CI failure, libcxx's `__libcpp_is_constant_evaluated` always returns false under C++03 or earlier, where constexpr isn't available. (Code: https://github.com/llvm/llvm-project/blob/036a1b2202cb71aacfa72ef15145a88dc50a02cf/libcxx/include/__type_trait

[PATCH] D155610: [Clang][ExprConstant] Print integer instead of character on static assertion failure

2023-07-19 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D155610#4511547 , @tbaeder wrote: > What if you switch from `IgnoreParenImpCasts` at the top of > `DiagnoseStaticAssertDetails()` to just `IgnoreParens()`? That improve cases > where we simply compare a character literal to

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-07-21 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D155064#4514893 , @cor3ntin wrote: > This looks good to me modulo nitpicks. > When you land that, please make an issue on github for the missing narrowing > warning, it seems important. > > I'll wait before approving in cas

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-07-22 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 543189. hazohelet marked 3 inline comments as done. hazohelet edited the summary of this revision. hazohelet added a comment. Address comments from Corentin - NFC stylistic changes - Bring back narrowing warning on constexpr variables to avoid regression -

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-07-23 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added inline comments. Comment at: clang/test/SemaCXX/vartemplate-lambda.cpp:17 +// expected-note{{cannot be used in a constant expression}} \ +// expected-e

[PATCH] D153969: [clang][ExprConstant] Fix crash on uninitialized base class subobject

2023-07-24 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Ping CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153969/new/ https://reviews.llvm.org/D153969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-07-24 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 543510. hazohelet marked 4 inline comments as done. hazohelet added a comment. Address comments from Corentin - When emitting "lambda expression may not appear inside of a constant expression" error from `Sema::PopExpressionEvaluationContext`, mark the va

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-07-24 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added inline comments. Comment at: clang/test/SemaCXX/vartemplate-lambda.cpp:17 +// expected-note{{cannot be used in a constant expression}} \ +// expected-e

[PATCH] D154366: [clang][ExprConstant] Print template arguments when describing stack frame

2023-07-25 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D154366#4530536 , @dblaikie wrote: > @hazohelet can you commit this yourself, or do you need someone to commit it > on your behalf? (& if so, what name/email address would you like to be > credited) Thanks for the review.

[PATCH] D152093: [clang][Analysis] Handle && and || against variable and its negation as tautology

2023-07-27 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Ping CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152093/new/ https://reviews.llvm.org/D152093 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-08-10 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 549203. hazohelet added a comment. Resolved the constexpr-if init-statement expression evaluation context problem. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155064/new/ https://reviews.llvm.org/D155064 Files: clang/docs/ReleaseNotes.rst c

[PATCH] D157855: [clang][ExprConstant] Improve error message of compound assignment against uninitialized object

2023-08-14 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet created this revision. hazohelet added reviewers: aaron.ballman, tbaeder, cjdb. Herald added a project: All. hazohelet requested review of this revision. Herald added a project: clang. BEFORE this patch, compound assignment operator against uninitialized object such as `uninit += 1` was

[PATCH] D157855: [clang][ExprConstant] Improve error message of compound assignment against uninitialized object

2023-08-15 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 550216. hazohelet marked an inline comment as done. hazohelet added a comment. Address comments from Timm - Moved test to C++14,20,23 test file from C++20-only one - NFC stylistic changes CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157855/new/

[PATCH] D152495: [Clang][SemaCXX] Add unused warning for variables declared in condition expressions

2023-08-15 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D152495#4587804 , @chapuni wrote: > Would this cause many warnings in Clang/LLVM tree? > https://lab.llvm.org/buildbot/#/builders/36/builds/36560 > > I hope you to fix possible warnings at first. Thanks. I'll revert this cha

[PATCH] D157383: [clang][Diagnostics] Provide source range to integer-overflow warnings

2023-08-15 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157383/new/ https://reviews.llvm.org/D157383 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

2023-08-15 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 550403. hazohelet marked 16 inline comments as done. hazohelet added a comment. Address some review comments - Renamed `ConvertCharToString` to `WriteCharValueForDiagnostic` - Made the function static - Fixed the printing for unicode 0x80 ~ 0xFF - Added dec

[PATCH] D152495: [Clang][SemaCXX] Add unused warning for variables declared in condition expressions

2023-08-15 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 550433. hazohelet added a comment. Herald added subscribers: llvm-commits, wangpc, hoy, wlei, steakhal, abrachet, ormris, martong, MaskRay, hiraditya. Herald added a reviewer: NoQ. Herald added projects: LLVM, lld-macho. Herald added a reviewer: lld-macho.

[PATCH] D158016: [NFC] Remove unused variables declared in conditions

2023-08-15 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet created this revision. hazohelet added reviewers: nikic, aaron.ballman, MaskRay, tbaeder. Herald added subscribers: hoy, wlei, steakhal, abrachet, ormris, StephenFan, martong, hiraditya. Herald added a reviewer: NoQ. Herald added projects: lld-macho, All. Herald added a reviewer: lld-mac

[PATCH] D152495: [Clang][SemaCXX] Add unused warning for variables declared in condition expressions

2023-08-15 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 550443. hazohelet added a comment. Removed warning fixes that are now in D158016 CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152495/new/ https://reviews.llvm.org/D152495 Files: clang/docs/ReleaseNotes.rst

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-08-15 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Thanks for the feedback. Comment at: clang/test/SemaCXX/warn-constant-evaluated-constexpr.cpp:38 constexpr int fn5() { - if constexpr (__builtin_is_constant_evaluated()) // expected-warning {{'__builtin_is_constant_evaluated' will always evaluate t

[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

2023-08-16 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 550707. hazohelet marked 3 inline comments as done. hazohelet added a comment. Address comments from Hubert - Bring back type prefix - NFC stylistic changes CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155610/new/ https://reviews.llvm.org/D15561

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-08-16 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 550881. hazohelet marked an inline comment as done. hazohelet added a comment. Address comments from Chris - Generate fix-it hint to remove `constexpr` in constexpr-if Added `SourceLocation` field to Sema that saves the location of `constexpr` in constexp

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-08-16 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 550899. hazohelet added a comment. rebase to upstream to run ci CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155064/new/ https://reviews.llvm.org/D155064 Files: clang/docs/ReleaseNotes.rst clang/include/clang/Basic/DiagnosticASTKinds.td cl

[PATCH] D152093: [clang][Analysis] Handle && and || against variable and its negation as tautology

2023-08-17 Thread Takuya Shimizu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. hazohelet marked an inline comment as done. Closed by commit rGb3469ce6f80b: [clang][Analysis] Handle && and || against variable and its negation as… (authored by hazoh

[PATCH] D157526: [clang][Sema] Remove irrelevant diagnostics from constraint satisfaction failure

2023-08-17 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157526/new/ https://reviews.llvm.org/D157526 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-08-19 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added inline comments. Comment at: libcxx/include/__type_traits/is_constant_evaluated.h:31 + return false; +#endif } Mordante wrote: > Why is this needed? Does this mean the builtin will fail in C++03 mode? `__libcpp_is_constant_evaluated` always retu

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-08-19 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 551744. hazohelet marked 2 inline comments as done. hazohelet added a comment. Address comments from Mark - Added comment about the need of macro use in libc++ include file. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155064/new/ https://review

[PATCH] D157383: [clang][Diagnostics] Provide source range to integer-overflow warnings

2023-08-19 Thread Takuya Shimizu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG985a72b6b3e7: [clang][Diagnostics] Provide source range to integer-overflow warnings (authored by hazohelet). Changed prior to commit: https://reviews.llvm.org/D157383?vs=548149&id=551746#toc Repositor

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-08-19 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet marked an inline comment as done. hazohelet added inline comments. Comment at: libcxx/include/__type_traits/is_constant_evaluated.h:31 + return false; +#endif } philnik wrote: > Mordante wrote: > > hazohelet wrote: > > > Mordante wrote: > > > > Why is

[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

2023-08-21 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 552167. hazohelet marked an inline comment as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155610/new/ https://reviews.llvm.org/D155610 Files: clang/docs/ReleaseNotes.rst clang/lib/Sema/SemaDeclCXX.cpp clang/test/Lexer/cxx1z-trigraphs.

[PATCH] D158472: [clang][Diagnostics] Emit fix-it hint separately on overload resolution failure

2023-08-21 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet created this revision. hazohelet added reviewers: aaron.ballman, cjdb, tbaeder, shafik. Herald added a subscriber: arphaman. Herald added a project: All. hazohelet requested review of this revision. Herald added a project: clang. D153359 addressed the d

[PATCH] D158472: [clang][Diagnostics] Emit fix-it hint separately on overload resolution failure

2023-08-21 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. This breaks the one-note-for-one-overload-candidate rule of overload resolution failure diagnostics (https://github.com/llvm/llvm-project/blob/ff08c8e57e39d7970b65637595cdc221901f4ed1/clang/lib/Sema/SemaOverload.cpp#L11517-L11526), but in most cases this change would

[PATCH] D158472: [clang][Diagnostics] Emit fix-it hint separately on overload resolution failure

2023-08-22 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 552417. hazohelet added a comment. Herald added a subscriber: kadircet. Herald added a project: clang-tools-extra. Fixed clangd test CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158472/new/ https://reviews.llvm.org/D158472 Files: clang-tools-e

[PATCH] D158562: [clang][Sema] Add truncation warning on fortified snprintf

2023-08-22 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet created this revision. hazohelet added reviewers: aaron.ballman, serge-sans-paille, nickdesaulniers, tbaeder. Herald added a project: All. hazohelet requested review of this revision. Herald added a project: clang. This patch warns on `snprintf` calls whose `n` argument is known to be s

[PATCH] D152093: [clang][Analysis] Handle && and || against variable and its negation as tautology

2023-07-28 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 545213. hazohelet added a comment. Address comments from Aaron - Reworded diagnostic message CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152093/new/ https://reviews.llvm.org/D152093 Files: clang/docs/ReleaseNotes.rst clang/include/clang/An

[PATCH] D152093: [clang][Analysis] Handle && and || against variable and its negation as tautology

2023-07-28 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet marked 2 inline comments as done. hazohelet added a comment. Thanks for the review Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:9743-9748 +def warn_tautological_negation_and_compare: Warning< + "'&&' against a variable and its negation always evaluate

[PATCH] D154366: [clang][ExprConstant] Print template arguments when describing stack frame

2023-07-28 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 545216. hazohelet added a comment. Added missing tests for method function templates before landing this CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154366/new/ https://reviews.llvm.org/D154366 Files: clang/docs/ReleaseNotes.rst clang/lib/A

[PATCH] D154366: [clang][ExprConstant] Print template arguments when describing stack frame

2023-07-31 Thread Takuya Shimizu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGe90f4fc6acaf: [clang][ExprConstant] Print template arguments when describing stack frame (authored by hazohelet). Repository: rG LLVM Github Monor

[PATCH] D155610: [Clang][ExprConstant] Print integer instead of character on static assertion failure

2023-07-31 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Thanks everyone for the comments! Comment at: clang/test/Lexer/cxx1z-trigraphs.cpp:24 // expected-error@11 {{}} expected-warning@11 {{trigraph ignored}} -// expected-error@13 {{failed}} expected-warning@13 {{trigraph ignored}} expected-note@13 {{eva

[PATCH] D155610: [Clang][ExprConstant] Print integer instead of character on static assertion failure

2023-07-31 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 545582. hazohelet added a comment. Address review comments - Print the character representation only when the type of the expressions is `char` or `char8_t` - Use `pushEscapedString` in the printing so that we can reuse its escaping logic - Use `escapeCSt

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-07-31 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. @ldionne @philnik @Mordante Is this way of fixing libc++ tests OK from libc++ side? If there's better way to fix them I am happy to follow it. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155064/new/ https://reviews.llvm.org/D155064

[PATCH] D155610: [Clang][ExprConstant] Print integer instead of character on static assertion failure

2023-07-31 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added inline comments. Comment at: clang/lib/Basic/Diagnostic.cpp:838-858 + if (UseUCN) +OutStream << "\\u" + << llvm::format_hex_no_prefix(CodepointValue, /*Width=*/4, +/*Upper=*/false); +

[PATCH] D156604: [clang][ExprConst] Use call source range for 'in call to' diags

2023-08-01 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D156604#4549524 , @tbaeder wrote: > @hazohelet I changed this to just return `CallExpr->getSourceRange()` and to > not save a source range separately. Can you give this a look please? I was thinking about removing `CallLoc`

[PATCH] D153969: [clang][ExprConstant] Fix crash on uninitialized base class subobject

2023-08-01 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Ping CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153969/new/ https://reviews.llvm.org/D153969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D153969: [clang][ExprConstant] Fix crash on uninitialized base class subobject

2023-08-01 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:2422 + << BS.getType(); + Info.Note(BS.getBeginLoc(), diag::note_constexpr_base_inherited_here); + return false; aaron.ballman wrote: > aaron.ballman wrote

[PATCH] D155610: [Clang][ExprConstant] Print integer instead of character on static assertion failure

2023-08-02 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D155610#4550346 , @cor3ntin wrote: > I've been thinking about it and I think I have a cleaner design for the > printing of characters: > > We need a `CharToString(unsigned, Qualtype) -> SmallString` method that takes > a va

[PATCH] D155610: [Clang][ExprConstant] Print integer instead of character on static assertion failure

2023-08-03 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 546782. hazohelet added a comment. Address comments from Corentin - Use default `pushEscapedString` escaping (``) instead of UCN representation `\u0001` - Convert multi-byte characters (`wchar_t`, `char16_t`, `char32_t`) to UTF-8 and prints them. - Added

[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

2023-08-03 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 546832. hazohelet marked 2 inline comments as done. hazohelet retitled this revision from "[Clang][ExprConstant] Print integer instead of character on static assertion failure" to "[Clang][Sema] Fix display of characters on static assertion failure". hazohe

[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

2023-08-03 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. One concern from my side is that some unicode characters like `U+FEFF` (I added in test) are invisible, but it may not be a big concern because we also display integer representation in parens. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155610/new/ https:

[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

2023-08-04 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added inline comments. Comment at: clang/docs/ReleaseNotes.rst:103-137 +- When describing the failure of static assertion of `==` expression, clang prints the integer + representation of the value as well as its character representation when + the user-provided expre

[PATCH] D152495: [Clang][SemaCXX] Add unused warning for variables declared in condition expressions

2023-08-06 Thread Takuya Shimizu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGbd0ed0abc31f: [Clang][SemaCXX] Add unused warning for variables declared in condition… (authored by hazohelet). Changed prior to commit: https://r

[PATCH] D152495: [Clang][SemaCXX] Add unused warning for variables declared in condition expressions

2023-08-06 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. I reverted this change because it broke sanitizer buildbots. https://lab.llvm.org/buildbot/#/builders/19/builds/18369 The cause of the errors here are relatively clear and I can speculatively replace `if (std::error_code EC = makeCanonical(Path))` with `if (makeCanonic

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-08-07 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. I've noticed several shortcoming/limitations of this patch. 1. Function arguments: When we parse the arguments to a function call, the callee isn't still resolved, so we don't know whether it's consteval. If the callee is consteval, its argument is known to be constan

[PATCH] D153969: [clang][ExprConstant] Fix crash on uninitialized base class subobject

2023-08-07 Thread Takuya Shimizu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG24c91d443222: [clang][ExprConstant] Fix crash on uninitialized base class subobject (authored by hazohelet). Changed prior to commit: https://revi

[PATCH] D152495: [Clang][SemaCXX] Add unused warning for variables declared in condition expressions

2023-08-08 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D152495#4566634 , @aaron.ballman wrote: > In D152495#4563520 , @hazohelet > wrote: > >> I reverted this change because it broke sanitizer buildbots. >> https://lab.llvm.org/buildbot

[PATCH] D157383: [clang][Diagnostics] Provide source range to integer-overflow warnings

2023-08-08 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet created this revision. hazohelet added reviewers: aaron.ballman, tbaeder, cjdb. Herald added a project: All. hazohelet requested review of this revision. Herald added a project: clang. BEFORE: overflow.cpp:1:21: warning: overflow in expression; result is -2147483648 with type 'int' [

[PATCH] D157383: [clang][Diagnostics] Provide source range to integer-overflow warnings

2023-08-08 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added inline comments. Comment at: clang/lib/AST/Interp/Interp.h:530-535 if (S.checkingForUndefinedBehavior()) { SmallString<32> Trunc; APResult.trunc(Result.bitWidth()).toString(Trunc, 10); auto Loc = E->getExprLoc(); -S.report(Loc, diag::warn_int

[PATCH] D157383: [clang][Diagnostics] Provide source range to integer-overflow warnings

2023-08-08 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added inline comments. Comment at: clang/lib/AST/Interp/Interp.h:530-535 if (S.checkingForUndefinedBehavior()) { SmallString<32> Trunc; APResult.trunc(Result.bitWidth()).toString(Trunc, 10); auto Loc = E->getExprLoc(); -S.report(Loc, diag::warn_int

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-08-08 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 548197. hazohelet added a comment. - Tentatively disable the warning on macros so as not to make a fuss in libc++ tests. - Fixed incorrect output in arguments. - Fixed incorrect output in declaration of init-statement of constexpr-if condition. - Added tes

[PATCH] D156604: [clang][ExprConst] Use call source range for 'in call to' diags

2023-08-08 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. We need some tests for dtors because they are handled differently from other functions. I think the current ExprConstant part would not cover the explicitly-called dtors because the `HandleDestructorImpl` only has access to `CallLoc` and not source range. Also new int

[PATCH] D156604: [clang][ExprConst] Use call source range for 'in call to' diags

2023-08-09 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet accepted this revision. hazohelet added a comment. I think it would be helpful to point to the subobject source range when diagnosing errors in subobject dtors, so I left some suggestions. Otherwise this LGTM. Thanks! Comment at: clang/lib/AST/ExprConstant.cpp:6663

[PATCH] D157526: [clang][Sema] Remove irrelevant diagnostics from constraint satisfaction failure

2023-08-09 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet created this revision. hazohelet added reviewers: aaron.ballman, erichkeane, tbaeder, shafik. Herald added a project: All. hazohelet requested review of this revision. Herald added a project: clang. BEFORE this patch, when clang handles constraints like `C1 || C2` where `C1` evaluates t

[PATCH] D156604: [clang][ExprConst] Use call source range for 'in call to' diags

2023-08-10 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. In D156604#4572994 , @tbaeder wrote: > While both of those suggestions are probably improvements (I haven't > checked), they also seem out of scope for this patch. This is just adding > source ranges. We can improve them later

[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

2023-08-10 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 548948. hazohelet marked 2 inline comments as done. hazohelet added a comment. Address comments from Aaron - Use hex code for integer representation of textual types - NFC stylistic changes CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155610/new/

[PATCH] D157526: [clang][Sema] Remove irrelevant diagnostics from constraint satisfaction failure

2023-09-07 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 556227. hazohelet marked an inline comment as done. hazohelet added a comment. Added comment and FIXME CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157526/new/ https://reviews.llvm.org/D157526 Files: clang/docs/ReleaseNotes.rst clang/lib/Sem

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-09-08 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Ping CHANGES SINCE LAST ACTION https://reviews.llvm.org/D159138/new/ https://reviews.llvm.org/D159138 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D156045: [clang][Interp] Enable existing source_location tests

2023-09-08 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. I was rebasing D155064 locally and saw test failures for the new interpreter in this file. The cause seems to me that the new interpreter is not handling some cases of `SourceLocExpr` correctly when they appear inside constant-evaluat

[PATCH] D156045: [clang][Interp] Enable existing source_location tests

2023-09-09 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. @tbaeder Now it's working correctly. Thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156045/new/ https://reviews.llvm.org/D156045 ___ cfe-commits mailing list cfe-commits

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-09-09 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet marked 4 inline comments as done. hazohelet added a comment. Thanks for the review! Comment at: clang/docs/ReleaseNotes.rst:125 * ``-Woverriding-t-option`` is renamed to ``-Woverriding-option``. * ``-Winterrupt-service-routine`` is renamed to ``-Wexcessive-regsave``

[PATCH] D157526: [clang][Sema] Remove irrelevant diagnostics from constraint satisfaction failure

2023-09-09 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. When I first ran `git clang-format` locally, it somehow forced 4-space indent. After starting to use clang-format from the trunk, I haven't seen the suspicious behavior locally, but the CI format check failure might be caused by that. The format seems okay as-is, so I'

[PATCH] D159138: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with alternative form

2023-09-11 Thread Takuya Shimizu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. hazohelet marked an inline comment as done. Closed by commit rG72f6abb9bca6: [clang][Sema] Fix format size estimator's handling of %o, %x, %X with… (authored by hazohel

[PATCH] D158472: [clang][Diagnostics] Emit fix-it hint separately on overload resolution failure

2023-09-13 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Ping CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158472/new/ https://reviews.llvm.org/D158472 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D158472: [clang][Diagnostics] Emit fix-it hint separately on overload resolution failure

2023-09-18 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet abandoned this revision. hazohelet added a comment. In D158472#4645378 , @aaron.ballman wrote: > In D158472#4605228 , @hazohelet > wrote: > >> This breaks the one-note-for-one-overload-candidate rule o

[PATCH] D157526: [clang][Sema] Remove irrelevant diagnostics from constraint satisfaction failure

2023-09-18 Thread Takuya Shimizu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGb2cd9db58933: [clang][Sema] Remove irrelevant diagnostics from constraint satisfaction failure (authored by hazohelet). Changed prior to commit: h

[PATCH] D155064: [clang][SemaCXX] Diagnose tautological uses of consteval if and is_constant_evaluated

2023-09-18 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet updated this revision to Diff 556946. hazohelet added a comment. After discussion in https://github.com/llvm/llvm-project/pull/66222, I noticed I had misunderstood the recursiveness of constant-evaluated context. I was pushing constant-evaluating on the lambda body when it appears insid

[PATCH] D152093: [clang][Analysis] Handle && and || against variable and its negation as tautology

2023-07-03 Thread Takuya Shimizu via Phabricator via cfe-commits
hazohelet added a comment. Ping CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152093/new/ https://reviews.llvm.org/D152093 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   >