[clang] Fix clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp for x86 (PR #119986)

2024-12-14 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt closed https://github.com/llvm/llvm-project/pull/119986 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp for x86 (PR #119986)

2024-12-14 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: I reproduced the problem locally by adding `-m32` flag to `%clang_cl`. Changes in this PR fix the test failure. https://github.com/llvm/llvm-project/pull/119986 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang] Fix clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp for x86 (PR #119986)

2024-12-14 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt created https://github.com/llvm/llvm-project/pull/119986 Fix test failure from #119719 84b0f0145887bbfe49fd4dc85490b14108a72cee Closes #119979 >From 876efed487603b450c56cd4c282449f5bfef52ad Mon Sep 17 00:00:00 2001 From: Richard Dzenis Date: Sat, 14 Dec 2024 23:32:

[clang] Fix SemaCXX/msvc-pragma-function-no-builtin-attr.cpp test (PR #119873)

2024-12-13 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: > I'm seeing this on Linux: ... Yes, the same problem. It should be fixed now. https://github.com/llvm/llvm-project/pull/119873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] Fix SemaCXX/msvc-pragma-function-no-builtin-attr.cpp test (PR #119873)

2024-12-13 Thread Richard Dzenis via cfe-commits
DzenIsRich wrote: > I'm seeing this on Linux: ... Yes, the same problem. It should be fixed now. https://github.com/llvm/llvm-project/pull/119873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] Fix SemaCXX/msvc-pragma-function-no-builtin-attr.cpp test (PR #119873)

2024-12-13 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt closed https://github.com/llvm/llvm-project/pull/119873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix SemaCXX/msvc-pragma-function-no-builtin-attr.cpp test (PR #119873)

2024-12-13 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt approved this pull request. LGTM, this fixes `clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp` on macOS. https://github.com/llvm/llvm-project/pull/119873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang] Fix SemaCXX/msvc-pragma-function-no-builtin-attr.cpp test (PR #119873)

2024-12-13 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: This should fix https://lab.llvm.org/buildbot/#/builders/190/builds/11300 I am compiling clang locally to verify that there would be no other problems with the test on macOS. > I suppose this is the reason check-clang fails today. Are there other test failures related to 84b0

[clang] [Clang] allow usage of placement new operator in [[msvc::constexpr]] context outside of the std namespace (PR #119153)

2024-12-09 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/119153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] allow [[msvc::constexpr]] usage outside the std namespace (PR #119153)

2024-12-09 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: > allow [[msvc::constexpr]] usage outside the std namespace By the way, to be precisely correct, these changes actually allow usage of "placement new" in `[[msvc::constexpr]]` context outside of the std namespace. https://github.com/llvm/llvm-project/pull/119153 _

[clang] [Clang] allow [[msvc::constexpr]] usage outside the std namespace (PR #119153)

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

[clang] [Clang] allow [[msvc::constexpr]] usage outside the std namespace (PR #119153)

2024-12-09 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: I don't think so. Ah, I forgot I previously added `clang/test/AST/ms-constexpr.cpp`, so having your new `ms-constexpr-new.cpp` makes sense (sorry for confusion). But I still would like to see a test in `clang/test/SemaCXX/ms-constexpr-new.cpp

[clang] [Clang] allow [[msvc::constexpr]] usage outside the std namespace (PR #119153)

2024-12-09 Thread Richard Dzenis via cfe-commits
https://github.com/RIscRIpt requested changes to this pull request. https://github.com/llvm/llvm-project/pull/119153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] allow [[msvc::constexpr]] usage outside the std namespace (PR #119153)

2024-12-09 Thread Richard Dzenis via cfe-commits
RIscRIpt wrote: Instead of adding this new test, could you please modify behavior of existing test: [`clang/test/SemaCXX/ms-constexpr-new.cpp`](https://github.com/llvm/llvm-project/pull/71300/files#diff-b0e33c7c54dd10b988b2badcc60be091e69ff3aeaf86c95cb2bb9bec1

[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 m

[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 C:\buildbot\as-builder

[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 (`-fms-c

[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 b

[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 declarati

[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 &Result, EvalInfo &Info, case Stmt::LabelStmtClass: return EvaluateStmt(Result, Info, cast(S)->getSubStmt(), Case); - case Stmt::AttributedStmtClass: -// As a general principle, C++11 attributes

[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 m

[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 [range-diff](https://github.com/l

[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 attri

[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 attri

[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 %select{function|const

[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 declarati

[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 b

[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 b

[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 b

[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 b

[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 cfe-commi

[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 attri

[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 https://lists.l

[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 attri

[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 7d8b1c0fae42~2..7d8b1c

[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 attri

[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() { [[msvc::con

[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() { [[msvc::con

[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 &S, Decl *D, const ParsedAttr &AL) { D->addAttr(::new (S.Context) ThreadAttr(S.Context, AL)); } +static void handleMSConstexprAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + if (!S.getLangOpts().isCompatible

[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() { [[msvc::con

[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 > do

[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 -fms-

[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. Bel