[clang] [alpha.webkit.RetainPtrCtorAdoptChecker] Don't treat assignment to an +1 out argument as a leak (PR #161633)

2025-10-02 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/161633 Make RetainPtrCtorAdoptChecker recognize an assignment to an +1 out argument so that it won't emit a memory leak warning. >From 35ae9ac455dac75db1745984dc740cf276a9dcc8 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa

[clang] [CFG] Add a BuildOption to consider default branch of switch on covered enumerations. (PR #161345)

2025-10-02 Thread Balazs Benics via cfe-commits
@@ -1251,6 +1251,7 @@ class CFG { bool MarkElidedCXXConstructors = false; bool AddVirtualBaseBranches = false; bool OmitImplicitValueInitializers = false; +bool SwitchKeepDefaultCoveredEnum = false; steakhal wrote: I know we don't really have a

[clang] [analyzer] Harden RegionStoreManager::bindArray (PR #153177)

2025-10-02 Thread Marco Borgeaud via cfe-commits
https://github.com/marco-antognini-sonarsource edited https://github.com/llvm/llvm-project/pull/153177 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CFG] Add a BuildOption to consider default branch of switch on covered enumerations. (PR #161345)

2025-10-02 Thread Balazs Benics via cfe-commits
@@ -93,6 +93,158 @@ TEST(CFG, DependantBaseAddImplicitDtors) { .getStatus()); } +TEST(CFG, SwitchCoveredEnumNoDefault) { + const char *Code = R"( +enum class E {E1, E2}; +int f(E e) { + switch(e) { +case E::E1: + return 1; +

[clang] [clang][Dependency Scanning] Refactor Scanning Compiler Instance Initialization (PR #161300)

2025-10-02 Thread Jan Svoboda via cfe-commits
@@ -355,44 +355,149 @@ void clang::tooling::dependencies::sanitizeDiagOpts( .Default(true); }); } +} // namespace -bool DependencyScanningAction::runInvocation( -std::shared_ptr Invocation, -IntrusiveRefCntPtr FS, -std::shared_ptr PCHContainerOps, -D

[clang] [clang-tools-extra] [compiler-rt] [flang] [libcxx] [libcxxabi] [lld] [lldb] [llvm] [Inclusive Language] migrate "sanity" checks to "soundness" checks (PR #156995)

2025-10-02 Thread Louis Dionne via cfe-commits
https://github.com/ldionne closed https://github.com/llvm/llvm-project/pull/156995 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Thread Safety Analysis: Optimize LocalVariableMap's canonical reference computation (PR #161600)

2025-10-02 Thread via cfe-commits
bgra8 wrote: To be clearer about the improvement: the same file that was previously compiling in 200s compiles now in 54s on the exact same machine. https://github.com/llvm/llvm-project/pull/161600 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - Allow AVX/AVX512 IFMA madd52 intrinsics to be used in constexpr (PR #161056)

2025-10-02 Thread Simon Pilgrim via cfe-commits
@@ -19,52 +19,55 @@ __attribute__((__always_inline__, __nodebug__, __target__("avx512ifma"), \ __min_vector_width__(512))) -static __inline__ __m512i __DEFAULT_FN_ATTRS -_mm512_madd52hi_epu64 (__m512i __X, __m512i __Y, __m512i __Z) -{ - return (__m512i

[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - Allow AVX/AVX512 IFMA madd52 intrinsics to be used in constexpr (PR #161056)

2025-10-02 Thread Simon Pilgrim via cfe-commits
https://github.com/RKSimon requested changes to this pull request. https://github.com/llvm/llvm-project/pull/161056 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - Allow AVX/AVX512 IFMA madd52 intrinsics to be used in constexpr (PR #161056)

2025-10-02 Thread Simon Pilgrim via cfe-commits
https://github.com/RKSimon requested changes to this pull request. avx512ifmavlintrin.h ? https://github.com/llvm/llvm-project/pull/161056 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [Sema] Don't call isNonConstantStorage on incomplete variable types (PR #161590)

2025-10-02 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak created https://github.com/llvm/llvm-project/pull/161590 The code that applies section attributes to global variables was crashing when it encountered a variable whose type was incomplete. This change adds a check to ensure the variable's type is complete before cal

[clang] [X86] Allow PSHUFD/PSHUFLW/PSHUFW intrinsics in constexpr. (PR #161210)

2025-10-02 Thread Nagraj Gaonkar via cfe-commits
NagrajMG wrote: @RKSimon The test and the builtin def files undergo massive structural change if I run formatter on them? I need to ignore them right? https://github.com/llvm/llvm-project/pull/161210 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang] Thread Safety Analysis: Optimize LocalVariableMap's canonical reference computation (PR #161600)

2025-10-02 Thread via cfe-commits
bgra8 wrote: Thanks a lot for this optimization @melver ! It greatly reduces the compilation time! https://github.com/llvm/llvm-project/pull/161600 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

[clang] [X86] Allow PSHUFD/PSHUFLW/PSHUFW intrinsics in constexpr. (PR #161210)

2025-10-02 Thread Nagraj Gaonkar via cfe-commits
@@ -2773,6 +2773,64 @@ static bool interp__builtin_blend(InterpState &S, CodePtr OpPC, return true; } +enum class Half { None, Low, High }; + +static bool interp__builtin_ia32_pshuf(InterpState &S, CodePtr OpPC, + const CallExpr *Call,

[clang] [analyzer] Harden RegionStoreManager::bindArray (PR #153177)

2025-10-02 Thread Marco Borgeaud via cfe-commits
@@ -2654,14 +2654,19 @@ RegionStoreManager::bindArray(LimitedRegionBindingsConstRef B, SVal V = getBinding(B.asStore(), *MRV, R->getValueType()); return bindAggregate(B, R, V); } + if (auto const *Value = Init.getAsInteger()) { +auto SafeValue = StateMgr.getBasi

[clang] [analyzer] Harden RegionStoreManager::bindArray (PR #153177)

2025-10-02 Thread Marco Borgeaud via cfe-commits
@@ -610,3 +610,44 @@ void top() { consume(parseMatchComponent()); } } // namespace elementwise_copy_small_array_from_post_initializer_of_cctor + +namespace gh147686 { +// The problem reported in https://github.com/llvm/llvm-project/issues/147686 +// is sensitive to the initia

[clang] [analyzer] Harden RegionStoreManager::bindArray (PR #153177)

2025-10-02 Thread Marco Borgeaud via cfe-commits
https://github.com/marco-antognini-sonarsource commented: @NagyDonat I appreciate your patience on this PR. I've managed to find time to address your feedback. Let me know if you have more of course. https://github.com/llvm/llvm-project/pull/153177 __

[clang] [analyzer] Harden RegionStoreManager::bindArray (PR #153177)

2025-10-02 Thread Marco Borgeaud via cfe-commits
@@ -2654,14 +2654,19 @@ RegionStoreManager::bindArray(LimitedRegionBindingsConstRef B, SVal V = getBinding(B.asStore(), *MRV, R->getValueType()); return bindAggregate(B, R, V); } + if (auto const *Value = Init.getAsInteger()) { marco-antognini-sonar

[clang] [clang] Preserve `externs` following broken declarations (PR #161641)

2025-10-02 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Alejandro Álvarez Ayllón (alejandro-alvarez-sonarsource) Changes Treat them as namespaces: if they are at the beginning of the line, they are likely a good recovery point. For instance, in ```cpp 1.3.0 extern "C" { extern int foo();

[clang] 8aa64ed - [Flang] Add -ffast-real-mod and direct code for MOD on REAL types (#160660)

2025-10-02 Thread via cfe-commits
Author: Michael Klemm Date: 2025-10-02T10:50:05+02:00 New Revision: 8aa64edb34ec6b30e1e7d0dbcc86236a6290eb0c URL: https://github.com/llvm/llvm-project/commit/8aa64edb34ec6b30e1e7d0dbcc86236a6290eb0c DIFF: https://github.com/llvm/llvm-project/commit/8aa64edb34ec6b30e1e7d0dbcc86236a6290eb0c.diff

[clang] [analyzer] Harden RegionStoreManager::bindArray (PR #153177)

2025-10-02 Thread Marco Borgeaud via cfe-commits
@@ -2654,14 +2654,19 @@ RegionStoreManager::bindArray(LimitedRegionBindingsConstRef B, SVal V = getBinding(B.asStore(), *MRV, R->getValueType()); return bindAggregate(B, R, V); } + if (auto const *Value = Init.getAsInteger()) { +auto SafeValue = StateMgr.getBasi

[clang] [clang] Preserve `externs` following broken declarations (PR #161641)

2025-10-02 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource edited https://github.com/llvm/llvm-project/pull/161641 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Preserve `externs` following broken declarations (PR #161641)

2025-10-02 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource edited https://github.com/llvm/llvm-project/pull/161641 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [Flang] Add -ffast-real-mod and direct code for MOD on REAL types (PR #160660)

2025-10-02 Thread Michael Klemm via cfe-commits
https://github.com/mjklemm closed https://github.com/llvm/llvm-project/pull/160660 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] CStringChecker: do not branch assuming the arguments of `str(n)cmp` are equal (PR #161644)

2025-10-02 Thread via cfe-commits
https://github.com/guillem-bartrina-sonarsource created https://github.com/llvm/llvm-project/pull/161644 Upon running into `str(n)cmp` with unknown symbolic parameters, `CStringChecker` forks the analysis assuming that the two arguments are EQUAL in one branch. There is no explicit motivation

[clang] [analyzer] CStringChecker: do not branch assuming the arguments of `str(n)cmp` are equal (PR #161644)

2025-10-02 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-static-analyzer-1 Author: None (guillem-bartrina-sonarsource) Changes Upon running into `str(n)cmp` with unknown symbolic arguments, `CStringChecker` forks the analysis assuming that the two arguments are EQUAL in one branch. There is no explicit

[clang] [analyzer] CStringChecker: do not branch assuming the arguments of `str(n)cmp` are equal (PR #161644)

2025-10-02 Thread via cfe-commits
https://github.com/guillem-bartrina-sonarsource edited https://github.com/llvm/llvm-project/pull/161644 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [X86] Allow PSHUFD/PSHUFLW/PSHUFW intrinsics in constexpr. (PR #161210)

2025-10-02 Thread Simon Pilgrim via cfe-commits
https://github.com/RKSimon edited https://github.com/llvm/llvm-project/pull/161210 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Thread Safety Analysis: Optimize LocalVariableMap's canonical reference computation (PR #161600)

2025-10-02 Thread Utkarsh Saxena via cfe-commits
https://github.com/usx95 approved this pull request. https://github.com/llvm/llvm-project/pull/161600 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [X86] Allow PSHUFD/PSHUFLW/PSHUFW intrinsics in constexpr. (PR #161210)

2025-10-02 Thread Simon Pilgrim via cfe-commits
@@ -2773,6 +2773,62 @@ static bool interp__builtin_blend(InterpState &S, CodePtr OpPC, return true; } +enum class Half { None, Low, High }; + +static bool interp__builtin_ia32_pshuf(InterpState &S, CodePtr OpPC, + const CallExpr *Call,

[clang] [X86] Allow PSHUFD/PSHUFLW/PSHUFW intrinsics in constexpr. (PR #161210)

2025-10-02 Thread Simon Pilgrim via cfe-commits
@@ -2773,6 +2773,62 @@ static bool interp__builtin_blend(InterpState &S, CodePtr OpPC, return true; } +enum class Half { None, Low, High }; + +static bool interp__builtin_ia32_pshuf(InterpState &S, CodePtr OpPC, + const CallExpr *Call,

[clang] [X86] Allow PSHUFD/PSHUFLW/PSHUFW intrinsics in constexpr. (PR #161210)

2025-10-02 Thread Simon Pilgrim via cfe-commits
@@ -2773,6 +2773,62 @@ static bool interp__builtin_blend(InterpState &S, CodePtr OpPC, return true; } +enum class Half { None, Low, High }; + +static bool interp__builtin_ia32_pshuf(InterpState &S, CodePtr OpPC, + const CallExpr *Call,

[clang] [X86] Allow PSHUFD/PSHUFLW/PSHUFW intrinsics in constexpr. (PR #161210)

2025-10-02 Thread Simon Pilgrim via cfe-commits
@@ -2773,6 +2773,62 @@ static bool interp__builtin_blend(InterpState &S, CodePtr OpPC, return true; } +enum class Half { None, Low, High }; RKSimon wrote: this seems unnecessary - why not just `bool IsShufHW`? https://github.com/llvm/llvm-project/pull/161

[clang] [CFG] Add a BuildOption to consider default branch of switch on covered enumerations. (PR #161345)

2025-10-02 Thread Fred Tingaud via cfe-commits
https://github.com/frederic-tingaud-sonarsource updated https://github.com/llvm/llvm-project/pull/161345 >From 4af057dd6b5709d7de819108a14949ad5a0445fd Mon Sep 17 00:00:00 2001 From: Fred Tingaud Date: Mon, 29 Sep 2025 18:37:48 +0200 Subject: [PATCH 1/2] CFG: Add a BuildOption to consider defau

[clang] [X86] Allow PSHUFD/PSHUFLW/PSHUFW intrinsics in constexpr. (PR #161210)

2025-10-02 Thread Simon Pilgrim via cfe-commits
https://github.com/RKSimon requested changes to this pull request. Thanks for this - the shuffle decode looks like it can be simplified quite a bit https://github.com/llvm/llvm-project/pull/161210 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] 7ccb5c0 - Thread Safety Analysis: Optimize LocalVariableMap's canonical reference computation (#161600)

2025-10-02 Thread via cfe-commits
Author: Marco Elver Date: 2025-10-02T12:05:43+02:00 New Revision: 7ccb5c08f0685d4787f12c3224a72f0650c5865e URL: https://github.com/llvm/llvm-project/commit/7ccb5c08f0685d4787f12c3224a72f0650c5865e DIFF: https://github.com/llvm/llvm-project/commit/7ccb5c08f0685d4787f12c3224a72f0650c5865e.diff L

[clang] Thread Safety Analysis: Optimize LocalVariableMap's canonical reference computation (PR #161600)

2025-10-02 Thread Marco Elver via cfe-commits
https://github.com/melver closed https://github.com/llvm/llvm-project/pull/161600 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] `SValBuilder::evalBinOpLN`: try simplifying the RHS first (PR #161537)

2025-10-02 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,60 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify -Wno-tautological-compare -analyzer-config eagerly-assume=false %s steakhal wrote: Could you break the RUN line to honor the 80 char col rule? https://github.com/ll

[clang] [clang] Convert second arg of __builtin_assume_aligned to ConstantExpr (PR #161314)

2025-10-02 Thread Alan Zhao via cfe-commits
alanzhao1 wrote: Reduced repro: ```cpp constexpr long kAlignment = 128; long AllocateAlignedBytes_payload; void AllocateAlignedBytes() { __builtin_assume_aligned( reinterpret_cast(AllocateAlignedBytes_payload), kAlignment); } ``` https://github.com/llvm/llvm-project/pull/161314

[clang] [llvm] [Clang][CMake] Add CSSPGO support to LLVM_BUILD_INSTRUMENTED (PR #79942)

2025-10-02 Thread Amir Ayupov via cfe-commits
@@ -1217,6 +1217,15 @@ if (LLVM_BUILD_INSTRUMENTED) CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS) endif() + elseif(uppercase_LLVM_BUILD_INSTRUMENTED STREQUAL "CSSPGO") +append("-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-optimize-sibl

[clang] [clang] Preserve `externs` following broken declarations (PR #161641)

2025-10-02 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource created https://github.com/llvm/llvm-project/pull/161641 Treat them as namespaces: if they are at the beginning of the line, they are likely a good recovery point. For instance, in ```cpp 1.3.0 extern "C" { extern int foo(); extern "C

[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow element extraction/insertion intrinsics to be used in constexpr #159753 (PR #161302)

2025-10-02 Thread Simon Pilgrim via cfe-commits
@@ -2878,6 +2878,60 @@ static bool interp__builtin_x86_insert_subvector(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_vec_ext(InterpState &S, CodePtr OpPC, +const CallExpr *Call, unsigned ID) { + assert(Call->

[clang] [Clang] Instantiate variables referenced in `decltype` with an undeduced type. (PR #161231)

2025-10-02 Thread Corentin Jabot via cfe-commits
@@ -20108,8 +20108,9 @@ static void DoMarkVarDeclReferenced( bool NeededForConstantEvaluation = isPotentiallyConstantEvaluatedContext(SemaRef) && UsableInConstantExpr; - bool NeedDefinition = - OdrUse == OdrUseContext::Used || NeededForConstantEvaluation; + bool

[clang] [X86] Allow PSHUFD/PSHUFLW/PSHUFW intrinsics in constexpr. (PR #161210)

2025-10-02 Thread Simon Pilgrim via cfe-commits
@@ -11615,6 +11615,72 @@ static bool evalPackBuiltin(const CallExpr *E, EvalInfo &Info, APValue &Result, return true; } +static bool evalPshufBuiltin(EvalInfo &Info, const CallExpr *Call, + unsigned ElemBits, unsigned HalfBase, R

[clang] [Clang] Fix a crash when using ctad with a template template parameter. (PR #161488)

2025-10-02 Thread Corentin Jabot via cfe-commits
https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/161488 >From 6d84b97524b0565846a69b0e56c05234c8311d0f Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Wed, 1 Oct 2025 10:02:28 +0200 Subject: [PATCH 1/2] [Clang] Fix a crash when using ctad with a template templa

[clang] 2daa2f1 - [Clang] Fix a crash when using ctad with a template template parameter. (#161488)

2025-10-02 Thread via cfe-commits
Author: Corentin Jabot Date: 2025-10-02T10:33:39Z New Revision: 2daa2f1538b7d0b4fa874ffc16940460da77767b URL: https://github.com/llvm/llvm-project/commit/2daa2f1538b7d0b4fa874ffc16940460da77767b DIFF: https://github.com/llvm/llvm-project/commit/2daa2f1538b7d0b4fa874ffc16940460da77767b.diff LOG

[clang] [NFC][Clang Improve performance of `DoMarkVarDeclReferenced` (PR #161648)

2025-10-02 Thread Corentin Jabot via cfe-commits
https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/161648 Address post commit feedback from #161231 >From 47fe92b868a2d9dc2a1a0760ff728f73e2c18cd2 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Thu, 2 Oct 2025 12:30:42 +0200 Subject: [PATCH] [NFC][Clang Improve

[clang] [Clang] Fix a crash when using ctad with a template template parameter. (PR #161488)

2025-10-02 Thread Corentin Jabot via cfe-commits
https://github.com/cor3ntin closed https://github.com/llvm/llvm-project/pull/161488 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add new check `modernize-use-structured-binding` (PR #158462)

2025-10-02 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,411 @@ +//===--===// +// +// 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: Apa

[clang-tools-extra] [clang-tidy] Add new check `modernize-use-structured-binding` (PR #158462)

2025-10-02 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,622 @@ +// RUN: %check_clang_tidy -check-suffix=ALL,CPP20ORLATER -std=c++20-or-later %s modernize-use-structured-binding %t -- -- -I %S/Inputs/use-structured-binding/ +// RUN: %check_clang_tidy -check-suffix=ALL -std=c++17 %s modernize-use-structured-binding %t -- --

[clang-tools-extra] [clang-tidy] Add new check `modernize-use-structured-binding` (PR #158462)

2025-10-02 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,622 @@ +// RUN: %check_clang_tidy -check-suffix=ALL,CPP20ORLATER -std=c++20-or-later %s modernize-use-structured-binding %t -- -- -I %S/Inputs/use-structured-binding/ +// RUN: %check_clang_tidy -check-suffix=ALL -std=c++17 %s modernize-use-structured-binding %t -- --

[clang-tools-extra] [clang-tidy] Add new check `modernize-use-structured-binding` (PR #158462)

2025-10-02 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,411 @@ +//===--===// +// +// 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: Apa

[clang-tools-extra] [clang-tidy] Add new check `modernize-use-structured-binding` (PR #158462)

2025-10-02 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,411 @@ +//===--===// +// +// 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: Apa

[clang-tools-extra] [clang-tidy] Add new check `modernize-use-structured-binding` (PR #158462)

2025-10-02 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,622 @@ +// RUN: %check_clang_tidy -check-suffix=ALL,CPP20ORLATER -std=c++20-or-later %s modernize-use-structured-binding %t -- -- -I %S/Inputs/use-structured-binding/ +// RUN: %check_clang_tidy -check-suffix=ALL -std=c++17 %s modernize-use-structured-binding %t -- --

[clang] [NFC][Clang Improve performance of `DoMarkVarDeclReferenced` (PR #161648)

2025-10-02 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Corentin Jabot (cor3ntin) Changes Address post commit feedback from #161231 --- Full diff: https://github.com/llvm/llvm-project/pull/161648.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaExpr.cpp (+4-3) ``diff diff --

[clang] [CFG] Add a BuildOption to consider default branch of switch on covered enumerations. (PR #161345)

2025-10-02 Thread Balazs Benics via cfe-commits
@@ -93,6 +93,159 @@ TEST(CFG, DependantBaseAddImplicitDtors) { .getStatus()); } +TEST(CFG, SwitchCoveredEnumNoDefault) { + const char *Code = R"( +enum class E {E1, E2}; +int f(E e) { + switch(e) { +case E::E1: + return 1; +

[clang] [analyzer] Harden RegionStoreManager::bindArray (PR #153177)

2025-10-02 Thread Donát Nagy via cfe-commits
@@ -610,3 +610,44 @@ void top() { consume(parseMatchComponent()); } } // namespace elementwise_copy_small_array_from_post_initializer_of_cctor + +namespace gh147686 { +// The problem reported in https://github.com/llvm/llvm-project/issues/147686 +// is sensitive to the initia

[clang] [CIR] Upstream handling of integral-to-pointer casts (PR #161653)

2025-10-02 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Shawn K (kimsh02) Changes Fix #153658 Handle integral to pointer casts and port the relevant `cast.cpp` test cases from incubator. --- Full diff: https://github.com/llvm/llvm-project/pull/161653.diff 3 Files Affected: - (modified) cla

[clang] [CIR] Upstream handling of integral-to-pointer casts (PR #161653)

2025-10-02 Thread Shawn K via cfe-commits
https://github.com/kimsh02 created https://github.com/llvm/llvm-project/pull/161653 Fix #153658 Handle integral to pointer casts and port the relevant `cast.cpp` test cases from incubator. >From eec6869a048bb92fd58efbe811412196a8d9d783 Mon Sep 17 00:00:00 2001 From: kimsh02 Date: Thu, 2 Oct

[clang] [CIR] Upstream handling of integral-to-pointer casts (PR #161653)

2025-10-02 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff origin/main HEAD --extensions cpp,h -- clang/include/clang/CIR/Dialect/IR/CIRDataLayo

[clang] [CFG] Add a BuildOption to consider default branch of switch on covered enumerations (PR #161345)

2025-10-02 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/161345 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Harden RegionStoreManager::bindArray (PR #153177)

2025-10-02 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/153177 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Harden RegionStoreManager::bindArray (PR #153177)

2025-10-02 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, thanks for the updates! It's a bit unfortunate that `test3Bis` doesn't show the ideal behavior, but this commit is a clear step forward and there is no expectation to fix everything with one commit. https://github.com/llvm/llvm-pr

[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - add SSE/AVX VPTEST/VTESTPD/VTESTPS intrinsics to be used in constexpr (PR #160428)

2025-10-02 Thread Simon Pilgrim via cfe-commits
@@ -2889,6 +2889,66 @@ static bool interp__builtin_blend(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_ia32_test_op( +InterpState &S, CodePtr OpPC, const CallExpr *Call, +llvm::function_ref Fn) { + const Pointer &RHS = S.Stk.pop(); + co

[clang] [X86] Add MMX/SSE/AVX PHADD/SUB & HADDPS/D intrinsics to be used in constexpr (PR #156822)

2025-10-02 Thread via cfe-commits
@@ -485,36 +485,60 @@ __m256i test_mm256_hadd_epi16(__m256i a, __m256i b) { // CHECK: call <16 x i16> @llvm.x86.avx2.phadd.w(<16 x i16> %{{.*}}, <16 x i16> %{{.*}}) return _mm256_hadd_epi16(a, b); } +TEST_CONSTEXPR(match_v16hi(_mm256_hadd_epi16( +(__m256i)(__v16hi){1,2

[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - add SSE/AVX VPTEST/VTESTPD/VTESTPS intrinsics to be used in constexpr (PR #160428)

2025-10-02 Thread Simon Pilgrim via cfe-commits
@@ -2889,6 +2889,66 @@ static bool interp__builtin_blend(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_ia32_test_op( +InterpState &S, CodePtr OpPC, const CallExpr *Call, +llvm::function_ref Fn) { + const Pointer &RHS = S.Stk.pop(); + co

[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - add SSE/AVX VPTEST/VTESTPD/VTESTPS intrinsics to be used in constexpr (PR #160428)

2025-10-02 Thread Simon Pilgrim via cfe-commits
https://github.com/RKSimon requested changes to this pull request. https://github.com/llvm/llvm-project/pull/160428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - add SSE/AVX VPTEST/VTESTPD/VTESTPS intrinsics to be used in constexpr (PR #160428)

2025-10-02 Thread Shawn K via cfe-commits
https://github.com/kimsh02 updated https://github.com/llvm/llvm-project/pull/160428 >From 68df3b7879fe7a167cba1108b64bfdd9283bb02d Mon Sep 17 00:00:00 2001 From: kimsh02 Date: Thu, 2 Oct 2025 05:44:38 -0700 Subject: [PATCH 1/2] Squash --- clang/include/clang/Basic/BuiltinsX86.td | 27 +--

[clang] [HLSL] [SPIR-V] Add counter member for typed buffer (PR #161414)

2025-10-02 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/161414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement __builtin_stdc_rotate_left, __builtin_stdc_rotate_right (PR #160259)

2025-10-02 Thread Andrew Pinski via cfe-commits
@@ -767,12 +767,24 @@ def RotateLeft : BitInt8_16_32_64BuiltinsTemplate, Builtin { let Prototype = "T(T, T)"; } +def StdcRotateLeft : Builtin { + let Spellings = ["__builtin_stdc_rotate_left"]; + let Attributes = [NoThrow, Const, Constexpr, CustomTypeChecking]; + let Pro

[clang] [HLSL] [SPIR-V] Add counter member for typed buffer (PR #161414)

2025-10-02 Thread Helena Kotas via cfe-commits
@@ -722,8 +790,32 @@ BuiltinTypeDeclBuilder::addMemberVariable(StringRef Name, QualType Type, return *this; } +BuiltinTypeDeclBuilder & +BuiltinTypeDeclBuilder::addBufferHandles(ResourceClass RC, bool IsROV, + bool RawBuffer, bool Has

[clang] [libcxx] [Clang] Normalize constraints before checking for satisfaction (PR #161671)

2025-10-02 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff origin/main HEAD --extensions h,cpp -- clang/include/clang/AST/ASTConcept.h clang/inc

[clang] [HLSL] [SPIR-V] Add counter member for typed buffer (PR #161414)

2025-10-02 Thread Helena Kotas via cfe-commits
@@ -583,6 +613,44 @@ BuiltinTypeMethodBuilder::setHandleFieldOnResource(ResourceT ResourceRecord, return *this; } +template +BuiltinTypeMethodBuilder & +BuiltinTypeMethodBuilder::accessCounterHandleFieldOnResource(T ResourceRecord) { + ensureCompleteDecl(); + + Expr *Re

[clang] f3f9e7b - [CIR] Make all opt tests verify roundtrip (#161439)

2025-10-02 Thread via cfe-commits
Author: Henrich Lauko Date: 2025-10-02T13:02:16+02:00 New Revision: f3f9e7b928c2fb3828498e328c83bac14a9b46fe URL: https://github.com/llvm/llvm-project/commit/f3f9e7b928c2fb3828498e328c83bac14a9b46fe DIFF: https://github.com/llvm/llvm-project/commit/f3f9e7b928c2fb3828498e328c83bac14a9b46fe.diff

[clang] [CIR] Upstream handling of integral-to-pointer casts (PR #161653)

2025-10-02 Thread Shawn K via cfe-commits
https://github.com/kimsh02 updated https://github.com/llvm/llvm-project/pull/161653 >From eec6869a048bb92fd58efbe811412196a8d9d783 Mon Sep 17 00:00:00 2001 From: kimsh02 Date: Thu, 2 Oct 2025 04:37:05 -0700 Subject: [PATCH 1/6] [CIR] Upstream handling of integral-to-pointer casts --- .../clan

[clang] [CIR] Upstream handling of integral-to-pointer casts (PR #161653)

2025-10-02 Thread Shawn K via cfe-commits
kimsh02 wrote: Thanks for all the helpful feedback! I've applied the suggested commits, and I'll revisit the headers and IR checks. https://github.com/llvm/llvm-project/pull/161653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [HLSL] Add support for elementwise and aggregate splat casting struct types with bitfields (PR #161263)

2025-10-02 Thread Sarah Spall via cfe-commits
@@ -85,3 +85,41 @@ export void call5() { int1 A = {1}; S s = (S)A; } + +struct BFields { + double D; + int E: 15; + int : 8; + float F; +}; + +struct Derived : BFields { + int G; +}; + +// derived struct with bitfields splat from scalar +// CHECK-LABEL: call6 +// CHECK

[clang] 847e1e1 - [clang-format][NFC] Introduce isNoneOf (#161021)

2025-10-02 Thread via cfe-commits
Author: Björn Schäpers Date: 2025-10-02T20:52:45+02:00 New Revision: 847e1e18902d1bedb9d7df8cbec84dbda8042e47 URL: https://github.com/llvm/llvm-project/commit/847e1e18902d1bedb9d7df8cbec84dbda8042e47 DIFF: https://github.com/llvm/llvm-project/commit/847e1e18902d1bedb9d7df8cbec84dbda8042e47.diff

[clang-tools-extra] [clang-tidy] Add modernize-make-direct check (PR #118120)

2025-10-02 Thread Helmut Januschka via cfe-commits
hjanuschka wrote: @localspook damn, i missed that one, kind of like forgot about it! not sure, if i can back into the zone (brain reset 😂), to finish it, i am fine if you take it and finish it! https://github.com/llvm/llvm-project/pull/118120 ___ cfe-

[clang] [HLSL] Add support for elementwise and aggregate splat casting struct types with bitfields (PR #161263)

2025-10-02 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/161263 >From 34d95372ceaab6919f816a8f305abd2db698e818 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 12 Sep 2025 13:44:19 -0700 Subject: [PATCH 1/2] flatten LValues instead of addresses to reuse existing code to

[clang] Revert "[clang] Convert second arg of __builtin_assume_aligned to ConstantExpr (#161314)" (PR #161719)

2025-10-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/161719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Dependency Scanning] Refactor Scanning Compiler Instance Initialization (PR #161300)

2025-10-02 Thread Qiongsi Wu via cfe-commits
@@ -453,24 +580,41 @@ bool DependencyScanningAction::runInvocation( ScanInstance.getPreprocessorOpts().ImplicitPCHInclude, ScanInstance, ScanInstance.getHeaderSearchOpts().PrebuiltModuleFiles, PrebuiltModulesASTMap, ScanInstance.getDiagnosti

[clang] [lldb] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-10-02 Thread Justin Stitt via cfe-commits
JustinStitt wrote: OK, I'll work on scaling back my custom promotion/conversion rules. Might take a couple days because every test needs to be rewritten too. https://github.com/llvm/llvm-project/pull/148914 ___ cfe-commits mailing list cfe-commits@lis

[clang] [OpenACC][CIR] Impl reduction recipe pointer/array bound lowering (PR #161726)

2025-10-02 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Erich Keane (erichkeane) Changes Just like with private, the lowering for these bounds are all pretty trivial. This patch enables them for reduction, which has everything in common except the init pattern, but that is handled/managed by

[clang] [libcxx] Revert "[Clang] Normalize constraints before checking for satisfaction" (PR #161669)

2025-10-02 Thread Corentin Jabot via cfe-commits
https://github.com/cor3ntin closed https://github.com/llvm/llvm-project/pull/161669 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenACC][CIR] Impl reduction recipe pointer/array bound lowering (PR #161726)

2025-10-02 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir Author: Erich Keane (erichkeane) Changes Just like with private, the lowering for these bounds are all pretty trivial. This patch enables them for reduction, which has everything in common except the init pattern, but that is handled/managed b

[clang] [clang] Implement __builtin_stdc_rotate_left, __builtin_stdc_rotate_right (PR #160259)

2025-10-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Needs: - Better commit message (in github top-thing) - Release note https://github.com/llvm/llvm-project/pull/160259 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [NFC][OpenACC] Remove 'initExpr' from AST/etc. (PR #161674)

2025-10-02 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir @llvm/pr-subscribers-clang Author: Erich Keane (erichkeane) Changes I originally expected that we were going to need the initExpr stored separately from the allocaDecl when doing arrays/pointers, however after implementing it, we found that the

[clang] [CIR] Upstream handling of integral-to-pointer casts (PR #161653)

2025-10-02 Thread Shawn K via cfe-commits
https://github.com/kimsh02 updated https://github.com/llvm/llvm-project/pull/161653 >From eec6869a048bb92fd58efbe811412196a8d9d783 Mon Sep 17 00:00:00 2001 From: kimsh02 Date: Thu, 2 Oct 2025 04:37:05 -0700 Subject: [PATCH 1/3] [CIR] Upstream handling of integral-to-pointer casts --- .../clan

[clang] [X86][Clang] Allow SSE/AVX COMI/UCOMI/CMPS/CMPP fp comparison intrinsics to be used in constexpr (PR #160876)

2025-10-02 Thread via cfe-commits
https://github.com/zeyi2 edited https://github.com/llvm/llvm-project/pull/160876 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream handling of integral-to-pointer casts (PR #161653)

2025-10-02 Thread Shawn K via cfe-commits
https://github.com/kimsh02 updated https://github.com/llvm/llvm-project/pull/161653 >From eec6869a048bb92fd58efbe811412196a8d9d783 Mon Sep 17 00:00:00 2001 From: kimsh02 Date: Thu, 2 Oct 2025 04:37:05 -0700 Subject: [PATCH 1/7] [CIR] Upstream handling of integral-to-pointer casts --- .../clan

[clang] [CIR] Upstream handling of integral-to-pointer casts (PR #161653)

2025-10-02 Thread Shawn K via cfe-commits
https://github.com/kimsh02 updated https://github.com/llvm/llvm-project/pull/161653 >From eec6869a048bb92fd58efbe811412196a8d9d783 Mon Sep 17 00:00:00 2001 From: kimsh02 Date: Thu, 2 Oct 2025 04:37:05 -0700 Subject: [PATCH 1/4] [CIR] Upstream handling of integral-to-pointer casts --- .../clan

[clang] [HLSL] [SPIR-V] Add counter member for typed buffer (PR #161414)

2025-10-02 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/161414 >From 9736c86391d9b293be38e20bba5b144edb43c1cc Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 27 Aug 2025 14:54:28 -0400 Subject: [PATCH 1/4] [HLSL] [SPIR-V] Add initial support for typed buffer count

[clang] [HLSL] [SPIR-V] Add counter member for typed buffer (PR #161414)

2025-10-02 Thread Steven Perron via cfe-commits
https://github.com/s-perron auto_merge_enabled https://github.com/llvm/llvm-project/pull/161414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Rename members in AutoVarEmission (PR #161668)

2025-10-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane closed https://github.com/llvm/llvm-project/pull/161668 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] [SPIR-V] Add counter member for typed buffer (PR #161414)

2025-10-02 Thread Steven Perron via cfe-commits
@@ -583,6 +613,44 @@ BuiltinTypeMethodBuilder::setHandleFieldOnResource(ResourceT ResourceRecord, return *this; } +template +BuiltinTypeMethodBuilder & +BuiltinTypeMethodBuilder::accessCounterHandleFieldOnResource(T ResourceRecord) { + ensureCompleteDecl(); + + Expr *Re

[clang] [HLSL] [SPIR-V] Add counter member for typed buffer (PR #161414)

2025-10-02 Thread Steven Perron via cfe-commits
@@ -722,8 +790,32 @@ BuiltinTypeDeclBuilder::addMemberVariable(StringRef Name, QualType Type, return *this; } +BuiltinTypeDeclBuilder & +BuiltinTypeDeclBuilder::addBufferHandles(ResourceClass RC, bool IsROV, + bool RawBuffer, bool Has

[clang] [CIR] Update ComplexImagOp to work on scalar type (PR #161571)

2025-10-02 Thread Amr Hesham via cfe-commits
https://github.com/AmrDeveloper updated https://github.com/llvm/llvm-project/pull/161571 >From b6e720dcff7e2e681e58c8393b247b48ca6e69fd Mon Sep 17 00:00:00 2001 From: Amr Hesham Date: Wed, 1 Oct 2025 21:27:33 +0200 Subject: [PATCH] [CIR] Update ComplexImagOp to work on scalar type --- .../CIR

[clang] [clang] Convert second arg of __builtin_assume_aligned to ConstantExpr (PR #161314)

2025-10-02 Thread Erich Keane via cfe-commits
erichkeane wrote: @Fznamznon : Your patch 9ad72df55cb74 seems at least closely related here: in CGExprScalar.cpp in VisitConstantExpr. This patch is unfortunately just revealing a bug there, where the type of the constant expression is a L value constant but isn't getting the 'pointer' type

[clang] [HLSL] Add support for elementwise and aggregate splat casting struct types with bitfields (PR #161263)

2025-10-02 Thread Sarah Spall via cfe-commits
@@ -6784,74 +6784,104 @@ LValue CodeGenFunction::EmitPseudoObjectLValue(const PseudoObjectExpr *E) { return emitPseudoObjectExpr(*this, E, true, AggValueSlot::ignored()).LV; } -void CodeGenFunction::FlattenAccessAndType( -Address Addr, QualType AddrType, -SmallVecto

  1   2   3   4   5   6   >