[PATCH] D134136: [Clang] Support constexpr for builtin fmax, fmin, ilogb, logb, scalbn

2022-09-18 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/test/Sema/constant-builtins-math.cpp:16-17 + +// TODO: investigate why this is `INT_MIN + 1` instead of `INT_MIN` +static_assert(__builtin_ilogb(0.0) == -2147483647); +static_assert(__builtin_ilogb(__builtin_inf()) == 2147483647); -

[PATCH] D133887: [Clang] Support label at end of compound statement

2022-09-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. In D133887#3799310 , @aaron.ballman wrote: > Thank you for working on this! I spotted an issue where we're not quite > complete with this implementation work. I pushed up a new test case in > https://github.com/llvm/llvm-project

[PATCH] D133887: [Clang] Support label at end of compound statement

2022-09-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. In D133887#3799399 , @aaron.ballman wrote: > I can fix up the C++ status page as well if you'd like, or I can hold off if > you're already working on this, it's up to you! Thank you! I'll support empty labels in switch statement

[PATCH] D134207: [Clang] Support case and default labels at end of compound statement

2022-09-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: clang-language-wg, aaron.ballman, cor3ntin. Herald added a project: All. Izaron requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Direct continuation of https://reviews.llvm.org/D133887

[PATCH] D134207: [Clang] Support case and default labels at end of compound statement

2022-09-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:298-299 "and have an empty entry in the selector">; -def err_switch_label_end_of_compound_statement : Error< - "label at end of switch compound statement: expected statement">; def ex

[PATCH] D134136: [Clang] Support constexpr for builtin fmax, fmin, ilogb, logb, scalbn

2022-09-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 461312. Izaron added a comment. Removed whitespaces in comments. P.S. I wonder if smaller review requests will make things better? Say a review request for `fmax`+`fmin`, then a new one for `ilogb`+`logb`, then for `scalbn`. This may lead to a more understand

[PATCH] D134207: [Clang] Support case and default labels at end of compound statement

2022-09-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 461347. Izaron added a comment. Fix corresponding FixIt clang test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134207/new/ https://reviews.llvm.org/D134207 Files: clang/include/clang/Basic/DiagnosticParseKi

[PATCH] D134136: [Clang] Support constexpr for builtin fmax, fmin, ilogb, logb, scalbn

2022-09-20 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron abandoned this revision. Izaron added a comment. In D134136#3801495 , @efriedma wrote: > These patches are hard to review, yes; the reviewer has to go through and > verify for each function that the substitutes you've written actually match > the

[PATCH] D134369: [Clang] Support constexpr builtin fmax

2022-09-21 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: efriedma, cor3ntin, aaron.ballman. Herald added a project: All. Izaron requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Support constexpr version of __builtin_fmax and its variations. R

[PATCH] D134369: [Clang] Support constexpr builtin fmax

2022-09-21 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. This patch is derived from https://reviews.llvm.org/D134136 (which was abandoned due to poor tests and overcomplication) The constexpr version of `fmax` matches the libc realization: the libc realization is here

[PATCH] D134207: [Clang] Support case and default labels at end of compound statement

2022-09-21 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 461942. Izaron added a comment. Add helper method `DiagnoseLabelAtEndOfCompoundStatement` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134207/new/ https://reviews.llvm.org/D134207 Files: clang/include/clang/

[PATCH] D134207: [Clang] Support case and default labels at end of compound statement

2022-09-21 Thread Evgeny Shulgin 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 rG3285f9a2392f: [Clang] Support case and default labels at end of compound statement (authored by Izaron). Repository: rG LLVM Github Monorepo CHAN

[PATCH] D134369: [Clang] Support constexpr builtin fmax

2022-09-28 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:14033-14034 +!EvaluateFloat(E->getArg(1), RHS, Info)) + return false; +if (Result.isNaN() || RHS > Result) + Result = RHS; jcranmer-intel wrote: > If I'm reading APFloa

[PATCH] D134369: [Clang] Support constexpr builtin fmax

2022-09-28 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 463715. Izaron added a comment. Rebase and fix windows __float128 failure Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134369/new/ https://reviews.llvm.org/D134369 Files: clang/docs/LanguageExtensions.rst

[PATCH] D134369: [Clang] Support constexpr builtin fmax

2022-10-04 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 464990. Izaron added a comment. Fix corner case with pos/neg zeroes Fix tests for pos/neg zeroes with __builtin_copysign Thanks to @efriedma and @jcranmer-intel! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D13

[PATCH] D134369: [Clang] Support constexpr builtin fmax

2022-10-04 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 465106. Izaron added a comment. Fix comment wording. Thanks to @aaron.ballman! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134369/new/ https://reviews.llvm.org/D134369 Files: clang/docs/LanguageExtensions.

[PATCH] D135476: [clang-tidy] Support concepts in `bugprone-forwarding-reference-overload`

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: hokein, aaron.ballman, LegalizeAdulthood, njames93. Herald added subscribers: carlosgalvezp, xazax.hun. Herald added a project: All. Izaron requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscriber:

[PATCH] D135476: [clang-tidy] Support concepts in `bugprone-forwarding-reference-overload`

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 466147. Izaron added a comment. Fixes https://github.com/llvm/llvm-project/issues/58230 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135476/new/ https://reviews.llvm.org/D135476 Files: clang-tools-extra/clan

[PATCH] D134369: [Clang] Support constexpr builtin fmax

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 466151. Izaron added a comment. Add TODO comment about sNaN. Thanks to @jcranmer-intel! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134369/new/ https://reviews.llvm.org/D134369 Files: clang/docs/LanguageExt

[PATCH] D134369: [Clang] Support constexpr builtin fmax

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG0edff6faa266: [Clang] Support constexpr builtin fmax (authored by Izaron). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134369/new/ https://reviews.llvm.or

[PATCH] D134369: [Clang] Support constexpr builtin fmax

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. I've got an email about "Buildbot failure" with this link: https://lab.llvm.org/buildbot/#/builders/216/builds/10955 Line 51: 'static_assert' with no message is a C++17 extension Why is it failing if pre-merge checks has been passed? =( Repository: rG LLVM Github M

[PATCH] D135486: [Clang] Use C++17 in constant-builtins-fmax.cpp test

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: efriedma, jcranmer-intel, aaron.ballman, cor3ntin. Herald added a project: All. Izaron requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Add `-std=c++17` to the test so that buildbot won't

[PATCH] D135486: [Clang] Use C++17 in constant-builtins-fmax.cpp test

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. ASAP fix from previous review request, see comment: https://reviews.llvm.org/D134369#3843824 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135486/new/ https://reviews.llvm.org/D135486 __

[PATCH] D134369: [Clang] Support constexpr builtin fmax

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. In D134369#3843824 , @efriedma wrote: > You might need to explicitly specify -std=c++17 in the RUN line. (That bot > has a different target triple, and I think with that triple the default C++ > standard isn't C++17?) Thanks @e

[PATCH] D135476: [clang-tidy] Support concepts in `bugprone-forwarding-reference-overload`

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 466175. Izaron added a comment. Follow 80 characters limit. Thanks to @Eugene.Zelenko! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135476/new/ https://reviews.llvm.org/D135476 Files: clang-tools-extra/clang

[PATCH] D135476: [clang-tidy] Support concepts in `bugprone-forwarding-reference-overload`

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron marked an inline comment as done. Izaron added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/forwarding-reference-overload.rst:54 constructor could hide in this case. We also suppress warnings for constructors -like C3 and C4 that are gua

[PATCH] D135486: [Clang] Use C++17 in constant-builtins-fmax.cpp test

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. Thanks, will land the patch after `Build 288902: pre-merge checks` is passed =) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135486/new/ https://reviews.llvm.org/D135486 ___ cfe-

[PATCH] D135486: [Clang] Use C++17 in constant-builtins-fmax.cpp test

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGc585a44651f4: [Clang] Use C++17 in constant-builtins-fmax.cpp test (authored by Izaron). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135486/new/ https://r

[PATCH] D135493: [Clang] Support constexpr builtin fmin

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: efriedma, jcranmer-intel, aaron.ballman, cor3ntin. Herald added a project: All. Izaron requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Support constexpr version of __builtin_fmin and its

[PATCH] D135493: [Clang] Support constexpr builtin fmin

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. This is a mirror of my previous patch about builtin **max**. I promised to make the patch for builtin **min** =) Here: https://reviews.llvm.org/D134369#3806131 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135493/new/ https

[PATCH] D135493: [Clang] Support constexpr builtin fmin

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 466193. Izaron added a comment. Aligned slashes in defines Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135493/new/ https://reviews.llvm.org/D135493 Files: clang/docs/LanguageExtensions.rst clang/lib/AST/E

[PATCH] D122078: [clang-tidy] Ignore concepts in `misc-redundant-expression`

2022-10-07 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. Hi! A friendly ping =) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122078/new/ https://reviews.llvm.org/D122078 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[PATCH] D122078: [clang-tidy] Ignore concepts in `misc-redundant-expression`

2022-10-08 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 466271. Izaron added a comment. Removed redundant comment Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122078/new/ https://reviews.llvm.org/D122078 Files: clang-tools-extra/clang-tidy/misc/RedundantExpressio

[PATCH] D122078: [clang-tidy] Ignore concepts in `misc-redundant-expression`

2022-10-08 Thread Evgeny Shulgin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGa8fbd1157deb: [clang-tidy] Ignore concepts in `misc-redundant-expression` (authored by Izaron). Changed prior to commit: https://reviews.llvm.org/D122078?vs=466271&id=466273#toc Repository: rG LLVM G

[PATCH] D135493: [Clang] Support constexpr builtin fmin

2022-10-10 Thread Evgeny Shulgin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGec3238640440: [Clang] Support constexpr builtin fmin (authored by Izaron). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135493/new/ https://reviews.llvm.or

[PATCH] D118743: [clang-tidy] Add `modernize-use-inline-const-variables-in-headers` check

2022-10-10 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 40. Izaron added a comment. Rebased onto main (after a long long time). Thanks to @LegalizeAdulthood for instructions! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D118743/new/ https://reviews.llvm.org/D118

[PATCH] D118743: [clang-tidy] Add `modernize-use-inline-const-variables-in-headers` check

2022-10-10 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 41. Izaron added a comment. Removed excessive newline. Thanks to @Eugene.Zelenko! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D118743/new/ https://reviews.llvm.org/D118743 Files: clang-tools-extra/clang

[PATCH] D135822: [clang-tidy] Add option `IgnoreVoidReturnType` to `modernize-use-trailing-return-type`

2022-10-12 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: salman-javed-nz, aaron.ballman, bernhardmgruber, bkramer, kbobyrev. Herald added subscribers: carlosgalvezp, xazax.hun. Herald added a project: All. Izaron requested review of this revision. Herald added a project: clang-tools-extra. Herald add

[PATCH] D135822: [clang-tidy] Add option `IgnoreVoidReturnType` to `modernize-use-trailing-return-type`

2022-10-12 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp:398-400 + auto F = functionDecl(unless(anyOf(hasTrailingReturn(), cxxConstructorDecl(), + cxxDestructorDecl(), cxxConversionDecl()

[PATCH] D135822: [clang-tidy] Add option `IgnoreVoidReturnType` to `modernize-use-trailing-return-type`

2022-10-13 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 467590. Izaron added a comment. Change `IgnoreVoidReturnType` to `RewriteVoidReturn` type. Check the cheaper condition first. A big thank to @bernhardmgruber for nice comments! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://review

[PATCH] D136022: [clang] Add time profile for constant evaluation

2022-10-15 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: aaron.ballman, cor3ntin, anton-afanasyev, mbs-modular, jloser. Herald added a project: All. Izaron requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Add time profiler for various constexp

[PATCH] D136022: [clang] Add time profile for constant evaluation

2022-10-15 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. We can use this file as an example: `ConstProfiler.cpp` https://reviews.llvm.org/P8296 The code does a really big constant evaluation. This is the generated json **before** the patch: `before.json` https://reviews.llvm.org/P8294 Giving this json to https://www.speedscope

[PATCH] D136036: [Clang] Add __has_builtin_constexpr support

2022-10-16 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: rsmith, aaron.ballman, cor3ntin, philnik, yaxunl, tra, cjdb. Herald added a project: All. Izaron requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. The `__has_builtin_constexpr` macro can

[PATCH] D136036: [Clang] Add __has_builtin_constexpr support

2022-10-16 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. A builtin is considered "constexpr" if it has `E` in its attributes in `Builtins.def`. The list of constexpr builtins is consistent, the code in `ExprConstant.cpp` (where the actual constant evaluation of builtins is being done) guards it. If builtin is not marked with `

[PATCH] D136036: [Clang] Add __has_builtin_constexpr support

2022-10-16 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 468063. Izaron added a comment. Slightly changed the test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136036/new/ https://reviews.llvm.org/D136036 Files: clang/include/clang/Basic/Builtins.def clang/incl

[PATCH] D136036: [Clang] Add __has_constexpr_builtin support

2022-10-16 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 468068. Izaron added a comment. Changed `llvm_unreachable` to just `return false`. I thought it is more secure. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136036/new/ https://reviews.llvm.org/D136036 Files:

[PATCH] D136036: [Clang] Add __has_constexpr_builtin support

2022-10-17 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 468314. Izaron marked 2 inline comments as done. Izaron added a comment. Add more parsing tests. Fix unrelated formatting changes. Add release notes and docs. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136036

[PATCH] D136036: [Clang] Add __has_constexpr_builtin support

2022-10-17 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/lib/Lex/PPMacroExpansion.cpp:370 // Clang Extensions. - Ident__FILE_NAME__ = RegisterBuiltinMacro(*this, "__FILE_NAME__"); - Ident__has_feature = RegisterBuiltinMacro(*this, "__has_feature"); - Ident__has_extension

[PATCH] D136036: [Clang] Add __has_constexpr_builtin support

2022-10-17 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. In D136036#3862065 , @aaron.ballman wrote: > Can you also add documentation and a release note for the new feature testing > macro? In D136036#3862649 , @shafik wrote: > Please add so

[PATCH] D136036: [Clang] Add __has_constexpr_builtin support

2022-10-17 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/docs/LanguageExtensions.rst:96 +the constant evaluation of the corresponding builtin (for example, +``std::fmax`` calls ``__builtin_fmax``) is supported in Clang. + Just to be clear: this isn't a true statement now

[PATCH] D136036: [Clang] Add __has_constexpr_builtin support

2022-10-17 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/docs/LanguageExtensions.rst:96 +the constant evaluation of the corresponding builtin (for example, +``std::fmax`` calls ``__builtin_fmax``) is supported in Clang. + Izaron wrote: > Just to be clear: this isn't a tru

[PATCH] D136036: [Clang] Add __has_constexpr_builtin support

2022-10-17 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. > It looks like unrelated formatting changes snuck in to this file. @aaron.ballman JFYI after I reverted what `git clang-format HEAD~1` did to the code, the build has failed ERROR git-clang-format returned an non-zero exit code 1 Build completed with failures http

[PATCH] D118743: [clang-tidy] Add `modernize-use-inline-const-variables-in-headers` check

2023-01-01 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. In D118743#3965423 , @Lounarok wrote: > I tried this patch and it's really helpful! You're welcome! > According to this , "A > `constexpr` specifier used in a function or `s

[PATCH] D152713: [clang-tidy] Correct sizeof/alignas handling in misc-redundant-expression

2023-07-01 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron accepted this revision. Izaron added a comment. This revision is now accepted and ready to land. LGTM! Thank you for the fix! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152713/new/ https://reviews.llvm.org/D152713 ___

[PATCH] D146393: [Clang] Support free positioning of labels inside compound statements in C

2023-03-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: aaron.ballman, cor3ntin. Herald added a project: All. Izaron requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Implements part of paper P2324R2 https://www.open-std.org/jtc1/sc22/wg14/www/

[PATCH] D146393: [Clang] Support free positioning of labels inside compound statements in C

2023-03-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. A big TODO: rename `ext_c_label_end_of_compound_statement` to something like `ext_c_label_free_positioning`. Since we found out it is more complete than just the end of statements. Comment at: clang/lib/Parse/ParseStmt.cpp:695-697 - // The substatemen

[PATCH] D144334: [Clang] Add C++2b attribute [[assume(expression)]]

2023-02-18 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: clang-language-wg, aaron.ballman, rsmith, nikic. Herald added a subscriber: StephenFan. Herald added a project: All. Izaron requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Clang already

[PATCH] D144334: [Clang] Add C++2b attribute [[assume(expression)]]

2023-02-18 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 498622. Izaron added a comment. A small fix for `def FutureAttrs` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D144334/new/ https://reviews.llvm.org/D144334 Files: clang/docs/ReleaseNotes.rst clang/include/

[PATCH] D144334: [Clang] Add C++2b attribute [[assume(expression)]]

2023-02-18 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/include/clang/Basic/Attr.td:1448 +def Assume : StmtAttr { + let Spellings = [CXX11<"", "assume", 202302>]; + let Documentation = [AssumeDocs]; Honestly I don't have a clue what these numbers `202302` (apparently t

[PATCH] D144334: [Clang] Add C++2b attribute [[assume(expression)]]

2023-02-18 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 498625. Izaron added a comment. More thorough AST test. Set the right macros number - thanks to @philnik! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D144334/new/ https://reviews.llvm.org/D144334 Files: cla

[PATCH] D144334: [Clang] Add C++2b attribute [[assume(expression)]]

2023-02-18 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. If you are not familiar with the `[[assume(expr]]` concept and want to know more, I wrote a small article about it recently, with a lot of additional links (including to the author of the proposal) - https://izaron.github.io/posts/assume/ Repository: rG LLVM Github M

[PATCH] D118743: [clang-tidy] Add `modernize-use-inline-const-variables-in-headers` check

2023-02-18 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 498637. Izaron added a comment. Use the common `isInAnonymousNamespace` matcher. Split the test into two files. Thanks to @carlosgalvezp for advices! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D118743/new/ h

[PATCH] D118743: [clang-tidy] Add `modernize-use-inline-const-variables-in-headers` check

2023-02-18 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron marked 2 inline comments as done. Izaron added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize/use-inline-const-variables-in-headers.hpp:1 +// RUN: %check_clang_tidy %s -std=c++17 modernize-use-inline-const-variables-in-headers %t +

[PATCH] D144334: [Clang] Add C++2b attribute [[assume(expression)]]

2023-02-21 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. In D144334#4141646 , @erichkeane wrote: > I'm on the fence as to whether we want to implement this feature at all. As > was discussed extensively during the EWG meetings on this: multiple > implementers are against this attribu

[PATCH] D144334: [Clang] Add C++2b attribute [[assume(expression)]]

2023-02-21 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron marked an inline comment as done. Izaron added a comment. In D144334#4142490 , @erichkeane wrote: > Just deliberately not support a part of C++2b. Implementers have veto'ed > features in the past exactly that way. That's sad. Let's at least wri

[PATCH] D117613: [ASTMatchers] Add `isConsteval` matcher

2022-01-18 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added a reviewer: aaron.ballman. Izaron requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Support C++20 `consteval` functions and C++2b `if consteval` for AST Matchers. Repository: rG LLVM Github Monor

[PATCH] D117613: [ASTMatchers] Add `isConsteval` matcher

2022-01-18 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp:1807 +TEST_P(ASTMatchersTest, IsConsteval_MatchesIfConsteval) { + if (!GetParam().isCXX20OrLater()) { +return; Actually `if consteval` is a C++23 feature, but

[PATCH] D117613: [ASTMatchers] Add `isConsteval` matcher

2022-01-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 401363. Izaron added a comment. Fixed commit Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117613/new/ https://reviews.llvm.org/D117613 Files: clang/docs/LibASTMatchersReference.html clang/include/clang/AST

[PATCH] D117613: [ASTMatchers] Add `isConsteval` matcher

2022-01-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 401365. Izaron added a comment. Fixed commit (with clang-format) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117613/new/ https://reviews.llvm.org/D117613 Files: clang/docs/LibASTMatchersReference.html cla

[PATCH] D117613: [ASTMatchers] Add `isConsteval` matcher

2022-01-19 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron marked 4 inline comments as done. Izaron added inline comments. Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:5179 +/// consteval int bar(); +/// void baz() { if consteval {} } +/// \endcode aaron.ballman wrote: > It'd be good to show an ex

[PATCH] D117613: [ASTMatchers] Add `isConsteval` matcher

2022-01-20 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 401679. Izaron added a comment. Fixed: make docs more explicit Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117613/new/ https://reviews.llvm.org/D117613 Files: clang/docs/LibASTMatchersReference.html clang

[PATCH] D117613: [ASTMatchers] Add `isConsteval` matcher

2022-01-20 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. Thanks! Let's see if docs are more explicit and nicer now. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117613/new/ https://reviews.llvm.org/D117613 ___ cfe-commits mailing list

[PATCH] D117613: [ASTMatchers] Add `isConsteval` matcher

2022-01-20 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. In D117613#3258854 , @aaron.ballman wrote: > LGTM! Do you need someone to commit on your behalf? If so, what name and > email address would you like used for patch attribution? Sorry, I should have set the Author property of the

[PATCH] D117846: [ASTMatchers] Add `isConstinit` matcher

2022-01-20 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: aaron.ballman, cor3ntin. Izaron requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Support C++20 constinit variables for AST Matchers. Repository: rG LLVM Github Monorepo https://revie

[PATCH] D117846: [ASTMatchers] Add `isConstinit` matcher

2022-01-20 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. I'm going to use this matcher very soon in my new `clang-tidy` check. If you're interested and want to read more, I have a design document about my ne check - here (gist.github.com)

[PATCH] D117846: [ASTMatchers] Add `isConstinit` matcher

2022-01-20 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 401817. Izaron added a comment. Removed the brackets in `{ return }` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117846/new/ https://reviews.llvm.org/D117846 Files: clang/docs/LibASTMatchersReference.html

[PATCH] D117846: [ASTMatchers] Add `isConstinit` matcher

2022-01-20 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 401872. Izaron added a comment. Fix clang-format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117846/new/ https://reviews.llvm.org/D117846 Files: clang/docs/LibASTMatchersReference.html clang/docs/ReleaseN

[PATCH] D117846: [ASTMatchers] Add `isConstinit` matcher

2022-01-21 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 402111. Izaron added a comment. Fix: accept only keyword, not the attribute itself Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117846/new/ https://reviews.llvm.org/D117846 Files: clang/docs/LibASTMatchersRe

[PATCH] D117846: [ASTMatchers] Add `isConstinit` matcher

2022-01-21 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron marked an inline comment as done. Izaron added inline comments. Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:5223 +/// matches the declaration of foo and bar. +AST_MATCHER(VarDecl, isConstinit) { return Node.hasAttr(); } + aaron.ballman wrot

[PATCH] D118010: [clang-tidy] Fix nested namespaces in `readability-static-definition-in-anonymous-namespace` check

2022-01-23 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: hokein, alexfh. Herald added subscribers: carlosgalvezp, xazax.hun. Izaron requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscriber: cfe-commits. The check previously inspected only the immediate p

[PATCH] D118010: [clang-tidy] Fix nested namespaces in `readability-static-definition-in-anonymous-namespace` check

2022-01-26 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. In D118010#3273716 , @LegalizeAdulthood wrote: > If there is an open github issue on this, please put "Fixes #" in the > commit description before pushing. Thanks! I didn't file a github issue. Just searched on github - no o

[PATCH] D118743: [clang-tidy] Add `modernize-use-inline-const-variables-in-headers` check

2022-02-01 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: alexfh, rsmith, LegalizeAdulthood. Herald added subscribers: carlosgalvezp, xazax.hun, mgorny. Izaron requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscriber: cfe-commits. C++17 `inline variables`

[PATCH] D118743: [clang-tidy] Add `modernize-use-inline-const-variables-in-headers` check

2022-02-01 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. For example, Google Code Style strongly advises C++17 `inline variables`. There are company guides how to use them: `https://abseil.io/tips/168`, `https://abseil.io/tips/140`. I believe other codestyles also use the feature. //P.S. If this review is eventually approved,

[PATCH] D117435: [clang] Warning for inline constexpr functions

2022-01-16 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: rjmccall, rsmith. Izaron requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. "inline constexpr" and "inline consteval" function declarations are redundant and shall be written rather as "co

[PATCH] D117435: [clang] Warning for inline constexpr functions

2022-01-16 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. I will provide more context in this comment. **Why this patch?** Clang currently has a warning for duplicating specifiers (`inline inline`, `extern extern`, `consteval consteval`, etc.), but has no warnings for redundant weaker specifiers. I suggest to add such a group o

[PATCH] D117435: [clang] Warning for inline constexpr functions

2022-01-16 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 400399. Izaron added a comment. Herald added a reviewer: jdoerfert. Herald added a subscriber: sstefan1. Fix tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117435/new/ https://reviews.llvm.org/D117435 File

[PATCH] D117435: [clang] Warning for inline constexpr functions

2022-01-16 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/test/Headers/x86-intrinsics-headers-clean.cpp:4-5 // RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -Wsystem-headers \ -// RUN: -Wcast-qual -fsyntax-only -flax-vector-conversions=none -x c++ -verify %s +// RUN:

[PATCH] D117435: [clang] Warning for inline constexpr functions

2022-01-16 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. In D117435#3247137 , @rjmccall wrote: > I don't remember if this is written up anywhere, but clang has a longstanding > policy that style enforcement belongs in a linter rather than the compiler. > One programmer's "redundant" i

[PATCH] D18914: [clang-tidy] new readability-redundant-inline

2022-01-16 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. In D18914#2399705 , @chfast wrote: > This check can be useful in other case like this: > > inline constexpr const int x = 1; > > where `inline` and `const` are redundant. In your case `inline` is not actually redundant (at least

<    1   2