[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-09 Thread Richard Dzenis via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -verify=supported %s RIscRIpt wrote: Opened #74932. https://github.com/llvm/llvm-project/pull/71300 ___ cfe-commits

[clang] [clang] Fix '__cdecl' CC is not supported for this target (PR #74932)

2023-12-09 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt created https://github.com/llvm/llvm-project/pull/74932 Fixes regression introduced in b3e6ff331925dde24a4707452d657da0fdf7f588 .---command stderr | error: 'supported-warning' diagnostics seen but not expected: | File

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-09 Thread Richard Dzenis via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -verify=supported %s RIscRIpt wrote: We can just remove `__cdecl` altogether. I put it there to replicate Microsoft's STL. MSVC accepts that test case without

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-09 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: Suggested commit message: ``` Add support for 'msvc::constexpr' C++11 attribute This commit adds support for MSVC-specific C++11-style attribute `[[msvc::constexpr]]`, which was added in MSVC 14.33. The semantics of this attribute is enabled only under MSVC compatibility

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-09 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: I don't have write access, but I believe it is ready to be merged. https://github.com/llvm/llvm-project/pull/71300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-08 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: Thank you! https://github.com/llvm/llvm-project/pull/71300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-08 Thread Richard Dzenis via cfe-commits
@@ -2884,6 +2884,12 @@ def warn_cxx11_compat_constexpr_body_multiple_return : Warning< InGroup, DefaultIgnore; def note_constexpr_body_previous_return : Note< "previous return statement is here">; +def err_ms_constexpr_not_distinct : Error< + "[[msvc::constexpr]] cannot

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-08 Thread Richard Dzenis via cfe-commits
@@ -3657,6 +3657,21 @@ an error: }]; } +def MSConstexprDocs : Documentation { + let Category = DocCatStmt; + let Content = [{ +The ``[[msvc::constexpr]]`` attribute can be applied only to a function +definition or a ``return`` statement. It does not impact function

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-08 Thread Richard Dzenis via cfe-commits
@@ -5546,11 +5563,14 @@ static EvalStmtResult EvaluateStmt(StmtResult , EvalInfo , case Stmt::LabelStmtClass: return EvaluateStmt(Result, Info, cast(S)->getSubStmt(), Case); - case Stmt::AttributedStmtClass: -// As a general principle, C++11 attributes can be

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-08 Thread Richard Dzenis via cfe-commits
@@ -235,6 +235,7 @@ Non-comprehensive list of changes in this release except that it returns the size of a type ignoring tail padding. * ``__builtin_classify_type()`` now classifies ``_BitInt`` values as the return value ``18`` and vector types as return value ``19``, to

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-08 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: > Also, please don't 'force-push', just push an additional commit to your > review. It erases history and makes reviewing it about 3x harder since > history/context gets lost. Sorry. I did this, because I am used to such workflow and reviewing

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-08 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt updated https://github.com/llvm/llvm-project/pull/71300 >From 3be36c6100801195f8f1f5167bdaa289bc8cb175 Mon Sep 17 00:00:00 2001 From: Richard Dzenis Date: Thu, 20 Jul 2023 00:18:50 +0300 Subject: [PATCH 1/4] [clang-cl] Add support for [[msvc::constexpr]] C++11

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt updated https://github.com/llvm/llvm-project/pull/71300 >From 3be36c6100801195f8f1f5167bdaa289bc8cb175 Mon Sep 17 00:00:00 2001 From: Richard Dzenis Date: Thu, 20 Jul 2023 00:18:50 +0300 Subject: [PATCH 1/2] [clang-cl] Add support for [[msvc::constexpr]] C++11

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt edited https://github.com/llvm/llvm-project/pull/71300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
@@ -2861,8 +2861,8 @@ def warn_cxx17_compat_constexpr_local_var_no_init : Warning< "is incompatible with C++ standards before C++20">, InGroup, DefaultIgnore; def ext_constexpr_function_never_constant_expr : ExtWarn< - "%select{constexpr|consteval}1

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
@@ -3612,6 +3612,22 @@ an error: }]; } +def MSConstexprDocs : Documentation { + let Category = DocCatStmt; + let Content = [{ +The ``[[msvc::constexpr]]`` attribute can be applied only to a function +definition or a ``return`` statement. It does not impact function

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
@@ -217,6 +217,8 @@ C23 Feature Support Non-comprehensive list of changes in this release - +- The default value of `_MSC_VER` was raised from 1920 to 1933. + MSVC 19.33 added undocumented attribute ``[[msvc::constexpr]]``.

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
@@ -2884,6 +2884,12 @@ def warn_cxx11_compat_constexpr_body_multiple_return : Warning< InGroup, DefaultIgnore; def note_constexpr_body_previous_return : Note< "previous return statement is here">; +def err_ms_constexpr_not_distinct : Error< + "[[msvc::constexpr]] cannot

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
@@ -2884,6 +2884,12 @@ def warn_cxx11_compat_constexpr_body_multiple_return : Warning< InGroup, DefaultIgnore; def note_constexpr_body_previous_return : Note< "previous return statement is here">; +def err_ms_constexpr_not_distinct : Error< + "[[msvc::constexpr]] cannot

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
@@ -2884,6 +2884,12 @@ def warn_cxx11_compat_constexpr_body_multiple_return : Warning< InGroup, DefaultIgnore; def note_constexpr_body_previous_return : Note< "previous return statement is here">; +def err_ms_constexpr_not_distinct : Error< + "[[msvc::constexpr]] cannot

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
@@ -2884,6 +2884,12 @@ def warn_cxx11_compat_constexpr_body_multiple_return : Warning< InGroup, DefaultIgnore; def note_constexpr_body_previous_return : Note< "previous return statement is here">; +def err_ms_constexpr_not_distinct : Error< + "[[msvc::constexpr]] cannot

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt edited https://github.com/llvm/llvm-project/pull/71300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt commented: Addressed review comments; updated my tests to use changed diagnostic messages. Next I'll upload my branch rebased onto main. https://github.com/llvm/llvm-project/pull/71300 ___ cfe-commits mailing list

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-12-07 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt updated https://github.com/llvm/llvm-project/pull/71300 >From d2b4e14210d7ac24e4a48407e8dc7dac9d97a549 Mon Sep 17 00:00:00 2001 From: Richard Dzenis Date: Thu, 20 Jul 2023 00:18:50 +0300 Subject: [PATCH 1/2] [clang-cl] Add support for [[msvc::constexpr]] C++11

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-25 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: Rebased onto main, resolved conflicts, re-run lit locally. Please let me know if I could speed-up review in any way. https://github.com/llvm/llvm-project/pull/71300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-25 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt updated https://github.com/llvm/llvm-project/pull/71300 >From 65c306e94e9b749ef0d38ef709ddb8b23dac987a Mon Sep 17 00:00:00 2001 From: Richard Dzenis Date: Thu, 20 Jul 2023 00:18:50 +0300 Subject: [PATCH 1/2] [clang-cl] Add support for [[msvc::constexpr]] C++11

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-13 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: Oof, sorry, I forgot I should push new changes and rebased changes separately (otherwise "Compare" link does not make sense). If you had checkout `829f8098af96` locally, you can see the diff diff as follows: ``` git range-diff 829f8098af96~2..829f8098af96

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-13 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt updated https://github.com/llvm/llvm-project/pull/71300 >From 93be428cb8af34292305741a891ddffe362e9a20 Mon Sep 17 00:00:00 2001 From: Richard Dzenis Date: Thu, 20 Jul 2023 00:18:50 +0300 Subject: [PATCH 1/2] [clang-cl] Add support for [[msvc::constexpr]] C++11

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-13 Thread Richard Dzenis via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -verify %s +// expected-no-diagnostics + +[[msvc::constexpr]] int log2(int x) { [[msvc::constexpr]] return x > 1 ? 1 + log2(x / 2) : 0; } +constexpr bool test_log2() {

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-13 Thread Richard Dzenis via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -verify %s +// expected-no-diagnostics + +[[msvc::constexpr]] int log2(int x) { [[msvc::constexpr]] return x > 1 ? 1 + log2(x / 2) : 0; } +constexpr bool test_log2() {

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-13 Thread Richard Dzenis via cfe-commits
@@ -7337,6 +7337,27 @@ static void handleDeclspecThreadAttr(Sema , Decl *D, const ParsedAttr ) { D->addAttr(::new (S.Context) ThreadAttr(S.Context, AL)); } +static void handleMSConstexprAttr(Sema , Decl *D, const ParsedAttr ) { + if

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-04 Thread Richard Dzenis via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -verify %s +// expected-no-diagnostics + +[[msvc::constexpr]] int log2(int x) { [[msvc::constexpr]] return x > 1 ? 1 + log2(x / 2) : 0; } +constexpr bool test_log2() {

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-04 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt edited https://github.com/llvm/llvm-project/pull/71300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-04 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: Discussion initiated by @AaronBallman of one of important design decisions, which was forgotten (?): > @AaronBallman: > It's a good question as to whether we want to support that only when passing > `-fms-extensions` or not (it seems like a generally useful attribute); we >

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-04 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: Initially I replicated semantics of `[[msvc::constexpr]]` from MSVC, so that it was possible to use it the same way as in MSVC, even `[[msvc::constexpr]] return ::new` from non-std namespace. E.g. https://godbolt.org/z/7eKh5Envz ```cpp // RUN: %clang_cc1 -fms-compatibility

[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

2023-11-04 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt created https://github.com/llvm/llvm-project/pull/71300 As per agreement with @AaronBallman and @erichkeane, I am re-opening this patch here. The current version of the patch has undergone numerous revisions before it became the version I am sending to GitHub.