[clang] [clang][Interp] Implement __builtin_rotate{right, left} (PR #72984)

2023-12-06 Thread Aaron Ballman via cfe-commits
@@ -331,3 +331,17 @@ namespace bitreverse { char bitreverse3[__builtin_bitreverse32(0x12345678) == 0x1E6A2C48 ? 1 : -1]; char bitreverse4[__builtin_bitreverse64(0x0123456789ABCDEFULL) == 0xF7B3D591E6A2C480 ? 1 : -1]; } + +namespace rotateleft { + char rotateleft1[__builti

[clang] [clang][Interp] Implement __builtin_ffs (PR #72988)

2023-12-06 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: https://github.com/AaronBallman approved this pull request. It looks like the rotate changes made it into here as well, but otherwise LGTM https://github.com/llvm/llvm-project/pull/72988 ___ cfe-c

[clang] [Clang] Mark WG14 N2939 (Identifier Syntax Fixes) as available in Clang 15 (PR #74666)

2023-12-07 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/74666 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Mark WG14 N2939 (Identifier Syntax Fixes) as available in Clang 15 (PR #74666)

2023-12-07 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,83 @@ +// RUN: %clang_cc1 -x c -std=c2x -fsyntax-only -verify %s +// RUN: %clang_cc1 -x c -std=c2x -E -DPP_ONLY=1 %s | FileCheck %s --strict-whitespace + +/* WG14 N2863: Clang 15 AaronBallman wrote: ```suggestion /* WG14 N2836: Clang 15 ``` https://g

[clang] [Clang] Mark WG14 N2939 (Identifier Syntax Fixes) as available in Clang 15 (PR #74666)

2023-12-07 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM aside from a typo in a comment. https://github.com/llvm/llvm-project/pull/74666 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe

[clang] 3293c08 - Remove dead code; NFC

2023-12-07 Thread Aaron Ballman via cfe-commits
Author: Aaron Ballman Date: 2023-12-07T08:26:33-05:00 New Revision: 3293c088c25db5be6042d20bd95c80a0863a88d0 URL: https://github.com/llvm/llvm-project/commit/3293c088c25db5be6042d20bd95c80a0863a88d0 DIFF: https://github.com/llvm/llvm-project/commit/3293c088c25db5be6042d20bd95c80a0863a88d0.diff

[clang] [clang][Diagnostics] Highlight code snippets (PR #66514)

2023-12-07 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= ,

[clang] [clang][Diagnostics] Highlight code snippets (PR #66514)

2023-12-07 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= ,

[clang] [clang][Diagnostics] Highlight code snippets (PR #66514)

2023-12-07 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= ,

[clang] [clang] Add separate C++23 extension flag for attrs on lambda (PR #74553)

2023-12-07 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM, thank you! https://github.com/llvm/llvm-project/pull/74553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Catch missing format attributes (PR #70024)

2023-12-07 Thread Aaron Ballman via cfe-commits
@@ -6849,6 +6849,71 @@ static void handleSwiftAsyncAttr(Sema &S, Decl *D, const ParsedAttr &AL) { checkSwiftAsyncErrorBlock(S, D, ErrorAttr, AsyncAttr); } +// Warn if parent function misses format attribute. Parent function misses +// format attribute if there is an argum

[clang] 11dfb3c - Work around an ICE in MSVC; NFC

2023-12-08 Thread Aaron Ballman via cfe-commits
Author: Aaron Ballman Date: 2023-12-08T10:20:31-05:00 New Revision: 11dfb3cb3237a081ad711b06f1e8efbc7fff7a81 URL: https://github.com/llvm/llvm-project/commit/11dfb3cb3237a081ad711b06f1e8efbc7fff7a81 DIFF: https://github.com/llvm/llvm-project/commit/11dfb3cb3237a081ad711b06f1e8efbc7fff7a81.diff

Re: [clang] 46a5693 - [FlowSensitive] Fix warnings

2023-12-08 Thread Aaron Ballman via cfe-commits
Thank you for the fix, sorry for the trouble! ~Aaron On Fri, Dec 8, 2023 at 10:56 AM Kazu Hirata via cfe-commits wrote: > > > Author: Kazu Hirata > Date: 2023-12-08T07:56:45-08:00 > New Revision: 46a56931251eba767929f6a2110da5b1bcbc5eb9 > > URL: > https://github.com/llvm/llvm-project/commit/46a

[clang] [clang][Interp] Implement __builtin_rotate{right, left} (PR #72984)

2023-12-08 Thread Aaron Ballman via cfe-commits
@@ -331,3 +331,17 @@ namespace bitreverse { char bitreverse3[__builtin_bitreverse32(0x12345678) == 0x1E6A2C48 ? 1 : -1]; char bitreverse4[__builtin_bitreverse64(0x0123456789ABCDEFULL) == 0xF7B3D591E6A2C480 ? 1 : -1]; } + +namespace rotateleft { + char rotateleft1[__builti

[clang] [clang][Interp] Implement inc/dec for IntegralAP (PR #69597)

2023-12-08 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: https://github.com/AaronBallman approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/69597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang] [clang][Interp] Implement IntegralAP::{div, rem} (PR #72614)

2023-12-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM aside from a test request. https://github.com/llvm/llvm-project/pull/72614 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[clang] [clang][Interp] Implement IntegralAP::{div, rem} (PR #72614)

2023-12-08 Thread Aaron Ballman via cfe-commits
@@ -44,6 +44,24 @@ static_assert(MulA * MulB == 50, ""); // ref-error {{not an integral constant ex static_assert(MulA * 5 == 25, ""); static_assert(-1 * MulB == -7, ""); + +constexpr _BitInt(4) DivA = 2; +constexpr _BitInt(2) DivB = 1; +static_assert(DivA / DivB == 2, ""); +

[clang] [clang][Interp] Implement IntegralAP::{div, rem} (PR #72614)

2023-12-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/72614 ___ 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 Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: I'm really liking the direction here -- this was a much more simple solution than I was expecting. Aside from some tiny nits, this looks good to me, but I leave it to Erich for the final sign-off. https://github.com/llvm/llvm-project/pull/71300 __

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

2023-12-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman 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-08 Thread Aaron Ballman 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 Aaron Ballman 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

[llvm] [clang] [Sema] Implement support for -Wformat-signedness (PR #74440)

2023-12-08 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I have started to implement defining the -Wformat-signedness option config in > clang/include/clang/Basic/DiagnosticSemaKinds.td as suggested originally by > @hazohelet and I agree that the implementation is a lot cleaner that way. > However before finishing implementing

[clang-tools-extra] [llvm] [clang] [clang] Fix false positive -Wmissing-field-initializer for anonymous unions (PR #70829)

2023-12-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM, but please wait until sometime mid-next week to land in case Richard has concerns. https://github.com/llvm/llvm-project/pull/70829 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[clang] [clang][Interp] Fix float->int casts overflowing (PR #72658)

2023-12-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/72658 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Decay arrays to the first element (PR #72660)

2023-12-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/72660 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Decay arrays to the first element (PR #72660)

2023-12-08 Thread Aaron Ballman via cfe-commits
@@ -27,6 +27,9 @@ static_assert(foo[2][3] == &m, ""); static_assert(foo[2][4] == nullptr, ""); +const int SomeInt[] = {1}; +int getSomeInt() { return *SomeInt; } AaronBallman wrote: ```suggestion constexpr int SomeInt[] = {1}; constexpr int getSomeInt() { re

[clang] [clang][Interp] Decay arrays to the first element (PR #72660)

2023-12-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM with a testing nit https://github.com/llvm/llvm-project/pull/72660 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Diagnose reads from non-const global variables (PR #71919)

2023-12-08 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -1005,12 +1008,23 @@ bool SetThisField(InterpState &S, CodePtr OpPC, uint32_t I) { template ::T> bool GetGlobal(InterpState &S, CodePtr OpPC, uint32_t I) { const Block *B = S.P.getGlobal(I); + + if (!CheckConstant(S, OpP

[clang] [clang][Interp] Handle std::move etc. builtins (PR #70772)

2023-12-08 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -378,3 +378,92 @@ namespace Packs { static_assert(foo() == 2, ""); static_assert(foo<>() == 0, ""); } + +namespace std { +template struct remove_reference { using type = T; }; +template struct remove_reference { using

[clang] [clang][Interp] Handle std::move etc. builtins (PR #70772)

2023-12-08 Thread Aaron Ballman via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: https://github.com/AaronBallman approved this pull request. LGTM assuming no surprises come up from the additional test coverage. https://github.com/llvm/llvm-project/pull/70772 ___ cfe-commits ma

[clang] [clang][Sema] Always clear UndefinedButUsed (PR #73955)

2023-12-08 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. I'm okay landing these changes without test coverage, though tests are always preferred. LGTM https://github.com/llvm/llvm-project/pull/73955 ___ cfe-commits mailing list cfe-commits@lists.ll

[clang-tools-extra] [clang] [libc] [flang] [llvm] Fix clang to recognize new C23 modifiers %w and %wf when printing (PR #71771)

2023-11-14 Thread Aaron Ballman via cfe-commits
@@ -417,6 +419,7 @@ class FormatSpecifier { /// http://www.opengroup.org/onlinepubs/009695399/functions/printf.html bool UsesPositionalArg; unsigned argIndex; + unsigned size; AaronBallman wrote: I think it might be more clear to call this `ExplicitlyF

[clang] [flang] [libc] [llvm] [clang-tools-extra] Fix clang to recognize new C23 modifiers %w and %wf when printing (PR #71771)

2023-11-14 Thread Aaron Ballman via cfe-commits
@@ -780,6 +791,9 @@ bool parseFormatStringHasFormattingSpecifiers(const char *Begin, const LangOptions &LO, const TargetInfo &Target); +ArgType wToArgType(int size, bool fast, ASTConte

[libc] [llvm] [clang-tools-extra] [clang] [flang] Fix clang to recognize new C23 modifiers %w and %wf when printing (PR #71771)

2023-11-14 Thread Aaron Ballman via cfe-commits
@@ -286,7 +286,33 @@ clang::analyze_format_string::ParseLengthModifier(FormatSpecifier &FS, lmKind = LengthModifier::AsInt3264; break; case 'w': - lmKind = LengthModifier::AsWide; ++I; break; + ++I; + if (I == E) return false; + if (*I == 'f

[clang-tools-extra] [clang] [flang] [libc] [llvm] Fix clang to recognize new C23 modifiers %w and %wf when printing (PR #71771)

2023-11-14 Thread Aaron Ballman via cfe-commits
@@ -484,6 +484,26 @@ bool clang::analyze_format_string::parseFormatStringHasFormattingSpecifiers( return false; } +ArgType clang::analyze_format_string::wToArgType( +int size, bool fast, ASTContext &C) { + ArgType fastType = C.getTargetInfo().getTriple().isArch64Bit()

[libc] [flang] [llvm] [clang] [clang-tools-extra] Fix clang to recognize new C23 modifiers %w and %wf when printing (PR #71771)

2023-11-14 Thread Aaron Ballman via cfe-commits
@@ -85,4 +86,31 @@ void z_test(void *p) { scanf("%Z", p); // expected-warning{{invalid conversion specifier 'Z'}} } +void w_int_test(void) { AaronBallman wrote: The printed result will depend on the C standard library used, so there's no way to verify that

[flang] [libcxx] [lldb] [compiler-rt] [libc] [clang] [clang-tools-extra] [llvm] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman converted_to_draft https://github.com/llvm/llvm-project/pull/68620 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Stub out gcc_struct attribute (PR #71148)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -7482,3 +7482,26 @@ generation of the other destruction cases, optimizing the above `foo.destroy` to }]; } + +def MSStructDocs : Documentation { + let Category = DocCatDecl; + let Content = [{ +The ``ms_struct`` and ``gcc_struct`` attributes request the compiler to ent

[clang] [clang] Stub out gcc_struct attribute (PR #71148)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -3643,7 +3643,14 @@ def CFGuard : InheritableAttr, TargetSpecificAttr { def MSStruct : InheritableAttr { let Spellings = [GCC<"ms_struct">]; let Subjects = SubjectList<[Record]>; - let Documentation = [Undocumented]; + let Documentation = [MSStructDocs]; + let Simple

[clang] [clang][NFC] Refactor Builtins.def to be a tablegen file (PR #68324)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,333 @@ +//=- ClangDiagnosticsEmitter.cpp - Generate Clang diagnostics tables -*- C++ -*- +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [clang][NFC] Refactor Builtins.def to be a tablegen file (PR #68324)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/68324 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Refactor Builtins.def to be a tablegen file (PR #68324)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: I'm in favor of the changes in this patch, but precommit CI is currently failing with relevant failures that should be addressed. https://github.com/llvm/llvm-project/pull/68324 ___ cfe-commits mailing list c

[clang] [clang][NFC] Refactor Builtins.def to be a tablegen file (PR #68324)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,333 @@ +//=- ClangDiagnosticsEmitter.cpp - Generate Clang diagnostics tables -*- C++ -*- AaronBallman wrote: ```suggestion //=- ClangBuiltinsEmitter.cpp - Generate Clang builtins tables -*- C++ -*- ``` May need to adjust formatting. https://github.c

[clang] [clang][NFC] Refactor Builtins.def to be a tablegen file (PR #68324)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,333 @@ +//=- ClangDiagnosticsEmitter.cpp - Generate Clang diagnostics tables -*- C++ -*- +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [clang][NFC] Refactor Builtins.def to be a tablegen file (PR #68324)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,121 @@ +//===--- BuiltinsBase.td - common structured used by builtins ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [clang][NFC] Refactor Builtins.def to be a tablegen file (PR #68324)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,121 @@ +//===--- BuiltinsBase.td - common structured used by builtins ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [clang][NFC] Refactor Builtins.def to be a tablegen file (PR #68324)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,121 @@ +//===--- BuiltinsBase.td - common structured used by builtins ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] Fix to attribute plugins reaching an unreachable (PR #70877)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. > ping for review? My apologies for the delay! The changes LGTM but there is a precommit CI failure with libc++. As best I can tell, that looks to be a transient issue and not caused by your patch, but it would be good to verify that

[clang] [clang] Stub out gcc_struct attribute (PR #71148)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: The attribute bits LGTM, but I added some more reviewers to double-check the driver changes. https://github.com/llvm/llvm-project/pull/71148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] [clang][Interp] Implement bitwise operations for IntegralAP (PR #71807)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/71807 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Implement bitwise operations for IntegralAP (PR #71807)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM but asking for some extra tests. https://github.com/llvm/llvm-project/pull/71807 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] [clang][Interp] Implement bitwise operations for IntegralAP (PR #71807)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -157,4 +157,13 @@ namespace Bitfields { // expected-warning {{changes value from 100 to 0}} } +namespace BitOps { + constexpr unsigned __int128 UZero = 0; + constexpr unsigned __int128 Max = ~UZero; + static_assert(Max == ~0, ""); + static_assert

[clang] [clang][Interp] Implement IntegralAP subtraction (PR #71648)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/71648 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/72197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -296,10 +296,16 @@ bool CodeGen::isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays, return false; // If this is a C++ record, check the bases first. - if (const CXXRecordDecl *CXXRD = dyn_cast(RD)) + if (const CXXRecordDecl *CXXRD = dyn_cast(RD)) { --

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for this! Please be sure to add a release note to `clang/docs/ReleaseNotes.rst` as well so users know about the change in behavior. https://github.com/llvm/llvm-project/pull/72197 ___ cfe-commits m

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -65,3 +65,9 @@ EXTERNC struct SortOfEmpty sort_of_empty_ret(void) { struct SortOfEmpty e; return e; } + +// CHECK-GNU-CXX: define{{.*}} i32 @empty_align_arg(i128 %a.coerce, i32 noundef %b) +struct EmptyAlign { long long int __attribute__((aligned)) : 0; }; -

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -65,3 +65,9 @@ EXTERNC struct SortOfEmpty sort_of_empty_ret(void) { struct SortOfEmpty e; return e; } + +// CHECK-GNU-CXX: define{{.*}} i32 @empty_align_arg(i128 %a.coerce, i32 noundef %b) +struct EmptyAlign { long long int __attribute__((aligned)) : 0; }; +EXTERNC int

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -296,10 +296,16 @@ bool CodeGen::isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays, return false; // If this is a C++ record, check the bases first. - if (const CXXRecordDecl *CXXRD = dyn_cast(RD)) + if (const CXXRecordDecl *CXXRD = dyn_cast(RD)) {

[clang] [clang][Interp] Implement __builtin_bitreverse (PR #71687)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/71687 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Implement __builtin_bitreverse (PR #71687)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. The changes seem reasonable to me but I think we should start putting some effort in to support _BitInt because I have a sneaking suspicion that will be hard to support with all the power-of-two literals being used, and the more integ

[clang] [clang][Interp] Implement __builtin_bitreverse (PR #71687)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -59,13 +59,54 @@ static void pushInt(InterpState &S, int32_t Val) { llvm_unreachable("Int isn't 16 or 32 bit?"); } -static bool retInt(InterpState &S, CodePtr OpPC, APValue &Result) { - PrimType IntType = getIntPrimType(S); - if (IntType == PT_Sint32) -return Ret(

[clang] [clang][Interp] Implement __builtin_parity (PR #71662)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/71662 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Implement __builtin_clrsb (PR #72243)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/72243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add bitint classification for __builtin_classify_type (PR #72036)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -11486,6 +11486,7 @@ bool IntExprEvaluator::CheckReferencedDecl(const Expr* E, const Decl* D) { /// Values returned by __builtin_classify_type, chosen to match the values /// produced by GCC's builtin. +/// The values can be found in gcc/typeclass.h in the GCC repository.

[clang] [clang] Add bitint classification for __builtin_classify_type (PR #72036)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/72036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add bitint classification for __builtin_classify_type (PR #72036)

2023-11-15 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/72036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add bitint classification for __builtin_classify_type (PR #72036)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -217,6 +217,8 @@ Non-comprehensive list of changes in this release (e.g., ``uint16x8_t``), this returns the constant number of elements at compile-time. For scalable vectors, e.g., SVE or RISC-V V, the number of elements is not known at compile-time and is determined

[clang] [clang][Interp] Implement __builtin_classify_type (PR #71972)

2023-11-15 Thread Aaron Ballman via cfe-commits
@@ -439,6 +439,194 @@ static bool interp__builtin_popcount(InterpState &S, CodePtr OpPC, return true; } +// Values returned by __builtin_classify_type, chosen to match the values +/// produced by GCC's builtin. +enum class GCCTypeClass { + None = -1, + Void = 0, + Intege

[clang] [clang] Add bitint classification for __builtin_classify_type (PR #72036)

2023-11-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/72036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add bitint classification for __builtin_classify_type (PR #72036)

2023-11-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. https://github.com/llvm/llvm-project/pull/72036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add bitint classification for __builtin_classify_type (PR #72036)

2023-11-16 Thread Aaron Ballman via cfe-commits
@@ -217,6 +217,8 @@ Non-comprehensive list of changes in this release (e.g., ``uint16x8_t``), this returns the constant number of elements at compile-time. For scalable vectors, e.g., SVE or RISC-V V, the number of elements is not known at compile-time and is determined

[clang] [clang][Interp] Implement IntegralAP::mul() (PR #72491)

2023-11-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/72491 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Implement __builtin_classify_type (PR #71972)

2023-11-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/71972 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Implement __builtin_bitreverse (PR #71687)

2023-11-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/71687 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Implement __builtin_bitreverse (PR #71687)

2023-11-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/71687 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Implement __builtin_bitreverse (PR #71687)

2023-11-16 Thread Aaron Ballman via cfe-commits
@@ -59,13 +59,54 @@ static void pushInt(InterpState &S, int32_t Val) { llvm_unreachable("Int isn't 16 or 32 bit?"); } -static bool retInt(InterpState &S, CodePtr OpPC, APValue &Result) { - PrimType IntType = getIntPrimType(S); - if (IntType == PT_Sint32) -return Ret(

[clang] Fix to attribute plugins reaching an unreachable (PR #70877)

2023-11-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Oh wow, same failure a second time... Ohh, this looks familiar now, but... it was already fixed, so why are we still hitting this failure? ``` | expected: clang::TreeTransform<(anonymous namespace)::CurrentInstantiationRebuilder>::RebuildArrayType(clang::QualType, clang::A

[clang] [clang-tools-extra] [clang][AST] Fix crash in MatchChildASTVisitor::TraverseLambdaExpr (PR #70962)

2023-11-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Would be nice to simply not crash in such case, whatever someone will fix > origin issue later is up to debate. I would like to see this change on 17.0.6 > (that means 2 weeks left to merge this). Unless someone fixes this somewere > in lower layers. The worry with pushi

[clang] [compiler-rt] [flang] [llvm] [clang-tools-extra] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-16 Thread Aaron Ballman via cfe-commits
@@ -322,6 +322,71 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) UnlikelyAttr(S.Context, A); } +CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI, +Expr *E) { + if

[clang] Fix to attribute plugins reaching an unreachable (PR #70877)

2023-11-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM assuming precommit CI is now fixed. https://github.com/llvm/llvm-project/pull/70877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[compiler-rt] [flang] [clang] [clang-tools-extra] [llvm] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-16 Thread Aaron Ballman via cfe-commits
@@ -322,6 +322,71 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) UnlikelyAttr(S.Context, A); } +CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI, +Expr *E) { + if

[compiler-rt] [llvm] [flang] [clang] [clang-tools-extra] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-16 Thread Aaron Ballman via cfe-commits
@@ -322,6 +322,61 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) UnlikelyAttr(S.Context, A); } +CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI, +Expr *E) { + if

[compiler-rt] [llvm] [flang] [clang] [clang-tools-extra] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-16 Thread Aaron Ballman via cfe-commits
@@ -322,6 +322,71 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) UnlikelyAttr(S.Context, A); } +CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI, +Expr *E) { + if

[compiler-rt] [llvm] [flang] [clang] [clang-tools-extra] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-16 Thread Aaron Ballman via cfe-commits
@@ -322,6 +322,59 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) UnlikelyAttr(S.Context, A); } +CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI, +Expr *E) { + if

[clang] [Clang] Warn on deprecated specializations used in system headers. (PR #70353)

2023-11-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/70353 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Warn on deprecated specializations used in system headers. (PR #70353)

2023-11-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/70353 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Warn on deprecated specializations used in system headers. (PR #70353)

2023-11-17 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#ifdef BE_THE_HEADER +#pragma clang system_header + +template +struct traits; + +template <> +struct [[ deprecated]] traits {}; // expected-note {{'traits' has been explicitly marked deprecated here}} -

[clang] [Clang] Warn on deprecated specializations used in system headers. (PR #70353)

2023-11-17 Thread Aaron Ballman via cfe-commits
@@ -11615,3 +11615,25 @@ void Sema::checkSpecializationReachability(SourceLocation Loc, Sema::AcceptableKind::Reachable) .check(Spec); } + +/// Returns the top most location responsible for the definition of \p N. +/// If \p N is

[compiler-rt] [flang] [clang] [llvm] [clang-tools-extra] [libc] [libcxx] [C23] Complete support for WG14 N2508 (PR #71398)

2023-11-17 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Ping https://github.com/llvm/llvm-project/pull/71398 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libcxx] [clang-tools-extra] [flang] [libc] [llvm] [compiler-rt] [clang] [C23] Complete support for WG14 N2508 (PR #71398)

2023-11-19 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/71398 >From 1d54a5cc6b34aca0e34ab57d7ee62815707d9153 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Mon, 6 Nov 2023 08:54:40 -0500 Subject: [PATCH 1/4] [C23] Complete support for WG14 N2508 In Clang 16, we im

[clang-tools-extra] [flang] [llvm] [clang] [libc] [libcxx] [compiler-rt] [C23] Complete support for WG14 N2508 (PR #71398)

2023-11-20 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/71398 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Assert not llvm_unreachable (PR #70149)

2023-10-28 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/70149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Diagnose defaulted assignment operator with incompatible object parameter (PR #70176)

2023-10-30 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Per https://eel.is/c++draft/dcl.fct.def.default#2.2, the explicit object > parameter of a defaulted special member function must be of the same type as > the one of an equivalent implicitly defaulted function, ignoring references. I could use an explanation as to how they

[clang] [Clang] Diagnose defaulted assignment operator with incompatible object parameter (PR #70176)

2023-10-30 Thread Aaron Ballman via cfe-commits
@@ -7748,6 +7748,24 @@ bool Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD, HadError = true; } } +// [C++23][dcl.fct.def.default]/p2.2 AaronBallman wrote: This requirement seems to be a general one but you've implemented i

[clang] [Clang] Diagnose defaulted assignment operator with incompatible object parameter (PR #70176)

2023-10-30 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > > Per https://eel.is/c++draft/dcl.fct.def.default#2.2, the explicit object > > > parameter of a defaulted special member function must be of the same type > > > as the one of an equivalent implicitly defaulted function, ignoring > > > references. > > > > > > I could u

[clang] [Clang] Diagnose defaulted assignment operator with incompatible object parameter (PR #70176)

2023-10-30 Thread Aaron Ballman via cfe-commits
@@ -7748,6 +7748,24 @@ bool Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD, HadError = true; } } +// [C++23][dcl.fct.def.default]/p2.2 AaronBallman wrote: Oh! I was thinking that spaceship was also a special member functio

[clang] [Clang] Diagnose defaulted assignment operator with incompatible object parameter (PR #70176)

2023-10-30 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM though something seems to be amiss with precommit CI and so it might be nice to get a clean run of that before landing (I don't insist). https://github.com/llvm/llvm-project/pull/70176 _

[clang] [time-trace] Add a new time trace scope variable named "ParseDeclarationOrFunctionDefinition". (PR #65268)

2023-10-30 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/65268 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    2   3   4   5   6   7   8   9   10   11   >