[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-08-25 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman auto_merge_disabled https://github.com/llvm/llvm-project/pull/150028 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] disallow # operators in attribute argument lists (PR #147308)

2025-08-22 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. Removing my request changes, LGTM! https://github.com/llvm/llvm-project/pull/147308 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [Clang] disallow # operators in attribute argument lists (PR #147308)

2025-08-22 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: The changes look good to me, but I'm leaving final sign-off to @erichkeane https://github.com/llvm/llvm-project/pull/147308 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang] [Clang] disallow # operators in attribute argument lists (PR #147308)

2025-08-22 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @AaronBallman I’ve moved the diagnostic under the > `-Wattribute-preprocessor-tokens` warning flag and made it a `pedantic` > diagnostic, which will be triggered in C++. Is that the behavior you were > aiming for? Yup, this matches what I was thinking, thank you! https:

[clang] [llvm] [docs] Fix debug and strict aliasing typo (#140071) (PR #154861)

2025-08-22 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/154861 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][AST] Added assert to prevent infinite recursion in computing layout (PR #154134)

2025-08-22 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Because this can be hit by user-written expressions, I think an assert is actually the wrong fix; we should handle it gracefully. Otherwise, in asserts builds this is effectively a crash and in non-asserts builds it's still an infinite recursion. CC

[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-08-22 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman auto_merge_enabled https://github.com/llvm/llvm-project/pull/150028 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-22 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: I was unable to get to the bottom of this and have run out of time before heading out for WG14/sabbatical. If anyone wants to commandeer this PR and get it across the finish line, that's perfectly fine by me. Otherwise I'll try to get back on it in October. https://github.

[clang] [Clang]Throw frontend error for target feature mismatch when using flatten attribute (PR #154801)

2025-08-22 Thread Aaron Ballman via cfe-commits
@@ -287,6 +287,11 @@ def err_function_needs_feature : Error< "always_inline function %1 requires target feature '%2', but would " "be inlined into function %0 that is compiled without support for '%2'">; +def err_flatten_function_needs_feature +: Error<"flatten functio

[clang] [Clang]Throw frontend error for target feature mismatch when using flatten attribute (PR #154801)

2025-08-22 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM aside from a formatting nit https://github.com/llvm/llvm-project/pull/154801 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

[clang] [Clang]Throw frontend error for target feature mismatch when using flatten attribute (PR #154801)

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

[clang] [clang] Fix Variable Length Array `_Countof` Crash (PR #154627)

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

[clang] [clang] Fix Variable Length Array `_Countof` Crash (PR #154627)

2025-08-22 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -std=c2y -verify %s +// RUN: %clang_cc1 -std=c2y -verify -fexperimental-new-constant-interpreter %s +// expected-no-diagnostics + +void gh152826(char (*a)[*][5], int (*x)[_Countof (*a)]); AaronBallman wrote: I thought there was

[clang] [clang] Fix Variable Length Array `_Countof` Crash (PR #154627)

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

[clang] [llvm] [docs] Fix debug and strict aliasing typo (#140071) (PR #154861)

2025-08-22 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! Do you need someone to land this on your behalf? https://github.com/llvm/llvm-project/pull/154861 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -16,7 +16,8 @@ #define _NULLPTR_T #ifdef __cplusplus -#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) +#if __cplusplus >= 201103L || \ +(defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED))

[clang-tools-extra] [clang-tidy] New bugprone-method-hiding check (PR #154746)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -4,6 +4,9 @@ // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// SPDX-FileCopyrightText: Portions Copyright 2025 Siemens and/or its affiliates +// May 2025 modified by Siemens and/or its affiliates b

[clang] [Clang]Throw frontend error for target feature mismatch when using `flatten` attribute (PR #150044)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - AaronBallman wrote: ```suggestion // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -verify -o /dev/null ``` https://github.com/llvm/llvm-project/pull/150044 ___

[clang] [Clang]Throw frontend error for target feature mismatch when using `flatten` attribute (PR #150044)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -287,6 +287,10 @@ def err_function_needs_feature : Error< "always_inline function %1 requires target feature '%2', but would " "be inlined into function %0 that is compiled without support for '%2'">; +def err_flatten_function_needs_feature +: Error<"flatten functio

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-21 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Thanks! I can try to investigate from my side but I'm on Windows and I don't typically build libc++ so it's possible I won't get very far. Due to timing, I may not get back to this before October, so assistance is very much appreciated. https://github.com/llvm/llvm-project/

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-21 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I'm pretty sure the libc++ failure is related. We're getting consistent > failures on the premerge buildbot after this change landed: > > 1. https://lab.llvm.org/staging/#/builders/192/builds/1329 > > 2. https://lab.llvm.org/staging/#/builders/192/builds/1330 > >

[clang] [Clang]Throw frontend error for target feature mismatch when using `flatten` attribute (PR #150044)

2025-08-21 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Also, the changes should come with a release note to `clang/docs/ReleaseNotes.rst` so users know about the fix. https://github.com/llvm/llvm-project/pull/150044 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [Clang]Throw frontend error for target feature mismatch when using `flatten` attribute (PR #150044)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - AaronBallman wrote: ```suggestion // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -verify -o /dev/null ``` https://github.com/llvm/llvm-project/pull/150044 ___

[clang] [Clang]Throw frontend error for target feature mismatch when using `flatten` attribute (PR #150044)

2025-08-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Can you also add a test where the diagnostic is correctly suppressed because the target does support the feature? https://github.com/llvm/llvm-project/pull/150044 ___ cfe-commits mailing list cfe-commits@list

[clang] [Clang]Throw frontend error for target feature mismatch when using `flatten` attribute (PR #150044)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -target-feature +sse4.1 -S -verify -o - AaronBallman wrote: ```suggestion // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -target-feature +sse4.1 -emit-llvm -verify -o /dev/null ``` https://github

[clang] [Clang]Throw frontend error for target feature mismatch when using `flatten` attribute (PR #150044)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -287,6 +287,10 @@ def err_function_needs_feature : Error< "always_inline function %1 requires target feature '%2', but would " "be inlined into function %0 that is compiled without support for '%2'">; +def err_flatten_function_needs_feature +: Error<"flatten functio

[clang] [Clang]Throw frontend error for target feature mismatch when using `flatten` attribute (PR #150044)

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

[clang] Revert "[C++] Expose nullptr_t from stddef.h in C++ mode" (PR #154767)

2025-08-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/154767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -16,7 +16,8 @@ #define _NULLPTR_T #ifdef __cplusplus -#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) +#if __cplusplus >= 201103L || \ +(defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED))

[clang] Revert "[C++] Expose nullptr_t from stddef.h in C++ mode" (PR #154767)

2025-08-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/154767 Reverts llvm/llvm-project#154599 It seems to be causing staging failures: https://lab.llvm.org/staging/#/builders/192/builds/1329 https://lab.llvm.org/staging/#/builders/192/builds/1330 >From d72a

[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

2025-08-21 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > do we need to update CFG and add tests for named loops with things like > > reachability diagnostics? And do we need to update anything in the static > > analyzer for this? > > I’m not too familiar w/ the static analyser but I can take a look at the CFG > and see if th

[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -215,6 +215,8 @@ def warn_c23_compat_case_range : Warning< DefaultIgnore, InGroup; def ext_c2y_case_range : Extension< "case ranges are a C2y extension">, InGroup; +def err_c2y_labeled_break_continue +: Error<"labeled %select{'break'|'continue'}0 is only supported in

[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -7213,7 +7213,8 @@ class Parser : public CodeCompletionHandler { /// 'while', or 'for'). StmtResult ParseStatement(SourceLocation *TrailingElseLoc = nullptr, - ParsedStmtContext StmtCtx = ParsedStmtContext::SubStmt); + ParsedStmtContext

[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -3056,26 +3045,50 @@ class IndirectGotoStmt : public Stmt { } }; -/// ContinueStmt - This represents a continue. -class ContinueStmt : public Stmt { -public: - ContinueStmt(SourceLocation CL) : Stmt(ContinueStmtClass) { -setContinueLoc(CL); +/// Base class for BreakS

[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

2025-08-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: I was only able to do a partial review, but once question I have is: do we need to update CFG and add tests for named loops with things like reachability diagnostics? And do we need to update anything in the static analyzer for this? https://github.co

[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -215,6 +215,8 @@ def warn_c23_compat_case_range : Warning< DefaultIgnore, InGroup; def ext_c2y_case_range : Extension< "case ranges are a C2y extension">, InGroup; +def err_c2y_labeled_break_continue +: Error<"labeled %select{'break'|'continue'}0 is only supported in

[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

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

[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -10796,6 +10796,11 @@ def err_continue_not_in_loop : Error< "'continue' statement not in loop statement">; def err_break_not_in_loop_or_switch : Error< "'break' statement not in loop or switch statement">; +def err_break_continue_label_not_found +: Error<"'%select{br

[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,147 @@ +// RUN: %clang_cc1 -std=c2y -verify -fsyntax-only -fblocks %s +// RUN: %clang_cc1 -std=c23 -verify -fsyntax-only -fblocks -fnamed-loops %s +// RUN: %clang_cc1 -x c++ -verify -fsyntax-only -fblocks -fnamed-loops %s + +void f1() { + l1: while (true) { +break

[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -255,6 +255,10 @@ class Scope { /// available for this variable in the current scope. llvm::SmallPtrSet ReturnSlots; + /// If this scope belongs to a loop or switch statement, the label that names AaronBallman wrote: ```suggestion /// If this scope

[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-08-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! Please give @erichkeane a chance to sign off before landing, though https://github.com/llvm/llvm-project/pull/150028 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/154599 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] New bugprone-method-hiding check (PR #154746)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -4,6 +4,9 @@ // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// SPDX-FileCopyrightText: Portions Copyright 2025 Siemens and/or its affiliates +// May 2025 modified by Siemens and/or its affiliates b

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -16,7 +16,8 @@ #define _NULLPTR_T #ifdef __cplusplus -#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) +#if __cplusplus >= 201103L || \ +(defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED))

[clang] [C99] Update documentation for scope of variables in loops; NFC (PR #154744)

2025-08-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/154744 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C99] Update documentation for scope of variables in loops; NFC (PR #154744)

2025-08-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman auto_merge_enabled https://github.com/llvm/llvm-project/pull/154744 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] New bugprone-method-hiding check (PR #154746)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,148 @@ +//===--- MethodHidingCheck.cpp - clang-tidy ===// +// +// SPDX-FileCopyrightText: 2025 Siemens Corporation and/or its affiliates AaronBallman wrote: And here (I'll stop commenting) https://github.com/llvm/llvm-proje

[clang-tools-extra] [clang-tidy] New bugprone-method-hiding check (PR #154746)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -1,3 +1,9 @@ +# 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: Apache-2.0 WITH LLVM-exception +# SPDX-FileCopyrightText: Portions Copyright 2025 Siemens and/o

[clang-tools-extra] [clang-tidy] New bugprone-method-hiding check (PR #154746)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -4,6 +4,9 @@ // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// SPDX-FileCopyrightText: Portions Copyright 2025 Siemens and/or its affiliates +// May 2025 modified by Siemens and/or its affiliates b

[clang] [C99] Update documentation for scope of variables in loops; NFC (PR #154744)

2025-08-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/154744 I tracked down the document which changed the way variables are handled in for loops for C99, it was the same document that allowed mixing code and declarations but the editor's report made it seem like th

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-21 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > libc++ failure appears to be unrelated: > > ``` > > FAIL: llvm-libc++-shared.cfg.in :: > > libcxx/utilities/tuple/no_specializations.verify.cpp (9116 of 10798) > > TEST 'llvm-libc++-shared.cfg.in :: > > libcxx/utilities/tuple/no_specializations.ve

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-21 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: libc++ failure appears to be unrelated: ``` FAIL: llvm-libc++-shared.cfg.in :: libcxx/utilities/tuple/no_specializations.verify.cpp (9116 of 10798) TEST 'llvm-libc++-shared.cfg.in :: libcxx/utilities/tuple/no_specializations.verify.cpp' FAILED **

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -16,7 +16,8 @@ #define _NULLPTR_T #ifdef __cplusplus -#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) +#if __cplusplus >= 201103L || \ +(defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED))

[clang] [clang] Remove hasValue() check in `RecordExprEvaluator::VisitCXXConstructExpr()` (PR #154610)

2025-08-21 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM, thank you for checking the performance characteristics of the change! I think we need a release note, though. https://github.com/llvm/llvm-project/pull/154610 ___ cfe-commits mailing li

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -16,7 +16,8 @@ #define _NULLPTR_T #ifdef __cplusplus -#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) +#if __cplusplus >= 201103L || \ +(defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED))

[clang] [Clang][Codegen][NFC] Apply rule of three to some classes (PR #154671)

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

[clang] [clang] Fix Variable Length Array `_Countof` Crash (PR #154627)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -15345,6 +15345,13 @@ bool IntExprEvaluator::VisitUnaryExprOrTypeTraitExpr( const auto *VAT = Info.Ctx.getAsVariableArrayType(Ty); assert(VAT); if (VAT->getElementType()->isArrayType()) { + // Variable array size expression could be missing (e.g. int a[*][10

[clang] [clang] Fix Variable Length Array `_Countof` Crash (PR #154627)

2025-08-21 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -std=c2y -verify %s +// RUN: %clang_cc1 -std=c2y -verify -fexperimental-new-constant-interpreter %s +// expected-no-diagnostics + +void gh152826(char (*a)[*][5], int (*x)[_Countof (*a)]); AaronBallman wrote: We should also add

[clang] [Clang][Codegen][NFC] Add nullptr check in fillOutputFields (PR #154623)

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

[clang] [C++] Expose nullptr_t from stddef.h in C++ mode (PR #154599)

2025-08-20 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/154599 The C++ standard requires stddef.h to declare all of its contents in the global namespace. We were only doing it when trying to be compatible with Microsoft extensions. Now we expose in C++11 or later, in

[clang] Do not trigger -Wmissing-noreturn on lambdas prior to C++23 (PR #154545)

2025-08-20 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. Thanks for the fix! LGTM modulo the test request from @zwuis https://github.com/llvm/llvm-project/pull/154545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] [Clang][NFC] Clarify some SourceManager related code (PR #153527)

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

[clang] Revert "[Clang] improve -Wstring-concatenation to warn on every missing comma in initializer lists" (PR #154369)

2025-08-19 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! Though it would be helpful to add some information about why it's being reverted to the PR summary/commit message. https://github.com/llvm/llvm-project/pull/154369 ___ cfe-commits maili

[clang] [C] Fix issue with -Wimplicit-void-ptr-cast (PR #154351)

2025-08-19 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: /cherry-pick ae434cd https://github.com/llvm/llvm-project/pull/154351 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Only remove lambda scope after computing evaluation context (PR #154106)

2025-08-19 Thread Aaron Ballman via cfe-commits
@@ -2170,6 +2172,12 @@ ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, PopExpressionEvaluationContext(); +sema::AnalysisBasedWarnings::Policy WP = +AnalysisWarnings.getPolicyInEffectAt(EndLoc); +// We cannot release LSI un

[clang] [C] Fix issue with -Wimplicit-void-ptr-cast (PR #154351)

2025-08-19 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/154351 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C] Fix issue with -Wimplicit-void-ptr-cast (PR #154351)

2025-08-19 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/154351 >From 2dabc7de6840fb092c411a3e494ced6e970f5c47 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 19 Aug 2025 10:43:35 -0400 Subject: [PATCH 1/2] [C] Fix issue with -Wimplicit-void-ptr-cast The change

[clang] [C] Fix issue with -Wimplicit-void-ptr-cast (PR #154351)

2025-08-19 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Windows failures are unrelated, other PRs are having the same issue: https://github.com/llvm/llvm-project/pull/154342 https://github.com/llvm/llvm-project/pull/154347 https://github.com/llvm/llvm-project/pull/154351 ___ cfe-commits

[clang] [C] Fix issue with -Wimplicit-void-ptr-cast (PR #154351)

2025-08-19 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: I believe the Windows failure is unrelated, but we'll see what precommit CI comes back with this time. I wasn't able to reproduce the crash locally on my Windows machine, though. https://github.com/llvm/llvm-project/pull/154351 __

[clang] [C] Fix issue with -Wimplicit-void-ptr-cast (PR #154351)

2025-08-19 Thread Aaron Ballman via cfe-commits
@@ -9317,14 +9317,14 @@ AssignConvertType Sema::CheckAssignmentConstraints(QualType LHSType, // If we have an atomic type, try a non-atomic assignment, then just add an // atomic qualification step. if (const AtomicType *AtomicTy = dyn_cast(LHSType)) { -AssignConvert

[clang] [C] Fix issue with -Wimplicit-void-ptr-cast (PR #154351)

2025-08-19 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman updated https://github.com/llvm/llvm-project/pull/154351 >From 2dabc7de6840fb092c411a3e494ced6e970f5c47 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 19 Aug 2025 10:43:35 -0400 Subject: [PATCH 1/2] [C] Fix issue with -Wimplicit-void-ptr-cast The change

[clang] [C] Add (new) -Wimplicit-void-ptr-cast to -Wc++-compat (PR #136855)

2025-08-19 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I think the conversion is dropped in `Sema::CheckAssignmentConstraints`. It > isn't assigning `CK_NonAtomicToAtomic` to `Kind` because `result` is > `AssignConvertType::CompatibleVoidPtrToNonVoidPtr`, not > `AssignConvertType::Compatible`. > > ``` > // If we have an at

[clang] [C] Fix issue with -Wimplicit-void-ptr-cast (PR #154351)

2025-08-19 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Because this is fixing an issue introduced in Clang 21, there's no release note because I plan to backport the fix to the release branch. https://github.com/llvm/llvm-project/pull/154351 ___ cfe-commits mailing list cfe-commits@lis

[clang] [C] Fix issue with -Wimplicit-void-ptr-cast (PR #154351)

2025-08-19 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/154351 The changes from https://github.com/llvm/llvm-project/pull/136855 missed a change with atomic assignment constraints. This fixes a bug where we'd accidentally drop a non-atomic-to-atomic conversion step.

[clang] [C] Fix issue with -Wimplicit-void-ptr-cast (PR #154351)

2025-08-19 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman milestoned https://github.com/llvm/llvm-project/pull/154351 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] improve -Wstring-concatenation to warn on every missing comma in initializer lists (PR #154018)

2025-08-19 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > For what it's worth, this causes `-Wstring-concatenation` to pop up a few > times in the Linux kernel. Two of the instances are simple enough to resolve > under the kernel's "Do not split user visible strings regardless of length" > rule. > > ``` > drivers/scsi/lpfc/lpfc

[clang] [Clang][ASTMatchers] Make `hasConditionVariableStatement` support `for` loop, `while` loop and `switch` statement (PR #154298)

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

[clang] [Clang][ASTMatchers] Make `hasConditionVariableStatement` support `for` loop, `while` loop and `switch` statement (PR #154298)

2025-08-19 Thread Aaron Ballman via cfe-commits
@@ -322,6 +322,9 @@ AST Matchers - Add a boolean member ``IgnoreSystemHeaders`` to ``MatchFinderOptions``. This allows it to ignore nodes in system headers when traversing the AST. +- ``hasConditionVariableStatement`` now supports ``for`` loop, ``while`` loop + and ``switch

[clang] [Clang][ASTMatchers] Make `hasConditionVariableStatement` support `for` loop, `while` loop and `switch` statement (PR #154298)

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

[clang] [clang-tools-extra] [clang] Improve nested name specifier AST representation (PR #147835)

2025-08-19 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > The comments in this area are confusing me, FWIW: > > ``` > > /// Stores the TagDecl associated with this type. The decl may point to > > any > > /// TagDecl that declares the entity. > > TagDecl *decl; > > > > ... > > > > TagDecl *getOriginalDecl() const { re

[clang] Thread Safety Analysis: Graduate ACQUIRED_BEFORE() and ACQUIRED_AFTER() from beta features (PR #152853)

2025-08-19 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! I think we're ready to make the jump now. But I'd love to hear if @aaronpuchert or @delesley have any concerns, so give them a chance to weigh in before landing. https://github.com/llvm/llvm-project/pull/152853 _

[clang] [clang][PAC] ptrauth_qualifier and ptrauth_intrinsic should only be available on Darwin (PR #153912)

2025-08-18 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM modulo release note nit. https://github.com/llvm/llvm-project/pull/153912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [C] Fix failing assertion with designated inits (PR #154120)

2025-08-18 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/154120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C] Fix failing assertion with designated inits (PR #154120)

2025-08-18 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman auto_merge_enabled https://github.com/llvm/llvm-project/pull/154120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C] Fix failing assertion with designated inits (PR #154120)

2025-08-18 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/154120 Incompatible pointer to integer conversion diagnostic checks would trigger an assertion when the designated initializer is for an array of unknown bounds. Fixes #154046 >From bd8afef4c8eb29f001b9e06fb35aa

[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-08-18 Thread Aaron Ballman via cfe-commits
@@ -3684,6 +3684,11 @@ def warn_alloca_align_alignof : Warning< "second argument to __builtin_alloca_with_align is supposed to be in bits">, InGroup>; +def warn_alloc_size +: Warning< + "allocation of insufficient size '%0' for type %1 with size '%2'">, +

[clang] [clang][PAC] ptrauth_qualifier and ptrauth_intrinsic should only be available on Darwin (PR #153912)

2025-08-18 Thread Aaron Ballman via cfe-commits
@@ -144,6 +144,11 @@ New Compiler Flags Deprecated Compiler Flags - +- Use of ``__has_feature`` to detect the ``ptrauth_qualifier`` and ``ptrauth_intrinsics`` AaronBallman wrote: This isn't really a deprecated compiler flag. Perhaps w

[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-08-18 Thread Aaron Ballman via cfe-commits
@@ -7818,6 +7819,35 @@ ExprResult Sema::CheckExtVectorCast(SourceRange R, QualType DestTy, return prepareVectorSplat(DestTy, CastExpr); } +/// Check that a call to alloc_size function specifies sufficient space for the +/// destination type. +static void CheckSufficientAllo

[clang] [Clang] improve -Wstring-concatenation to warn on every missing comma in initializer lists (PR #154018)

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

[clang-tools-extra] [doc] Add documentation for clang-change-namespace (PR #148277)

2025-08-18 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @AaronBallman @tJener I've addressed all of you comments and hope this PR is > now good to merge. Could you give it one last review? Am I supposed to mark > the discussions we had as Resolved or is that up to you? I gave it a review and my LG, but let's wait a bit for @tJ

[clang-tools-extra] [doc] Add documentation for clang-change-namespace (PR #148277)

2025-08-18 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. The new docs look awesome to me, thank you! https://github.com/llvm/llvm-project/pull/148277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] Basic: Update the rule for whether to use FEATURE or EXTENSION. (PR #153104)

2025-08-18 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: After the latest discussions, I think this PR can be closed? https://github.com/llvm/llvm-project/pull/153104 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][PAC] ptrauth_qualifier and ptrauth_intrinsic should only be available on Darwin (PR #153912)

2025-08-18 Thread Aaron Ballman via cfe-commits
@@ -1528,6 +1528,9 @@ static void InitializePredefinedMacros(const TargetInfo &TI, #undef TARGET_OS } + if (LangOpts.PointerAuthIntrinsics) +Builder.defineMacro("__PTRAUTH__"); AaronBallman wrote: I'm happy with `__PTRAUTH__`; do we want it to expand

[clang] [clang][PAC] ptrauth_qualifier and ptrauth_intrinsic should only be available on Darwin (PR #153912)

2025-08-18 Thread Aaron Ballman via cfe-commits
@@ -144,6 +144,11 @@ New Compiler Flags Deprecated Compiler Flags - +- Use of `__has_feature` to detect the `ptrauth_qualifier` and `ptrauth_intrinsics` + features has been deprecated, and is restricted to the arm64e target only. The + correct metho

[clang] [clang][PAC] ptrauth_qualifier and ptrauth_intrinsic should only be available on Darwin (PR #153912)

2025-08-18 Thread Aaron Ballman via cfe-commits
@@ -1089,6 +1089,7 @@ static void ComputeDATE_TIME(SourceLocation &DATELoc, SourceLocation &TIMELoc, /// specified by the identifier as a standard language feature. static bool HasFeature(const Preprocessor &PP, StringRef Feature) { const LangOptions &LangOpts = PP.getLangOp

[clang] [NFC][Clang][Docs] Update Pointer Authentication documentation (PR #152596)

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

[clang] [NFC][Clang][Docs] Update Pointer Authentication documentation (PR #152596)

2025-08-18 Thread Aaron Ballman via cfe-commits
@@ -500,12 +707,892 @@ type. Implementations are not required to make all bits of the result equally significant; in particular, some implementations are known to not leave meaningful data in the low bits. +Standard ``__ptrauth`` qualifiers +^

[clang] [Clang][Bytecode][NFS] Init Semantics non-static member of class Floating (PR #153671)

2025-08-18 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > > Static analysis flagged that the non-static member Semantics was not > > > initialized by the default default constructor. Fix is to initialize it > > > using in class member initialization. > > > > > > Yeah, this might be one better to mark as Intentional in the sta

[clang] [clang-tools-extra] [clang] Improve nested name specifier AST representation (PR #147835)

2025-08-18 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > Thanks! However, for the following piece of code > > `getOriginalDecl()` called on the pointed-to type gives the > > forward-declaration from the 3rd line, and the forward-declaration from the > > 1st line for its canonical type. > > Yes that is correct. > > The 3rd li

[clang] [C] Add (new) -Wimplicit-void-ptr-cast to -Wc++-compat (PR #136855)

2025-08-18 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Hi @AaronBallman I noticed that this commit makes a difference on the example > below. > > ``` > #include > typedef const struct T * T_Ref; > static T_Ref _Atomic x = ATOMIC_VAR_INIT((void*)NULL); > ``` > > After this commit, the AST of the global variable declaration ch

  1   2   3   4   5   6   7   8   9   10   >