[clang] [Feat] Allow Finding across only parts of an AST. (PR #127423)

2025-02-20 Thread via cfe-commits
matts1 wrote: > I'm not a modules or matcher expert, but this doesn't match my (perhaps > uninformed) understanding. I thought that when we import a module, it _is_ > part of our TU, similarly to when we include a header. You are correct. I phrased it very poorly. I'll reclarify - if we have a

[clang] [Clang][CodeGen] Bail out on constexpr unknown values in ConstantEmitter (PR #127525)

2025-02-20 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > Does it even make sense for evaluateValue to return a constexpr-unknown > value? If I'm following correctly, we can't actually do anything useful with > such a result: we don't actually know what the value is. It would make things > simpler if we kept such APValues as an inter

[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)

2025-02-20 Thread Teresa Johnson via cfe-commits
teresajohnson wrote: > > I'm fine with DTLTO as a shorthand for "integrated distributed ThinLTO". > > Great! I'm glad that you support this acronim too. :) > > > BTW thanks for sending the LLVM patch, I will review that tonight or more > > likely tomorrow. > > Teresa, when reviewing, could you

[clang] [HLSL] Implement default constant buffer `$Globals` (PR #125807)

2025-02-20 Thread LLVM Continuous Integration via cfe-commits
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `sanitizer-aarch64-linux-bootstrap-hwasan` running on `sanitizer-buildbot11` while building `clang` at step 2 "annotate". Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/7360 Here is the rel

[clang] [clang][Index] Use HeuristicResolver in IndexTypeSourceInfo as well (PR #128106)

2025-02-20 Thread Nathan Ridge via cfe-commits
https://github.com/HighCommander4 updated https://github.com/llvm/llvm-project/pull/128106 >From 84fac9adf5ab366c85eac3a3abd4e52e0d3532d0 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Thu, 20 Feb 2025 20:44:52 -0500 Subject: [PATCH] [clang][Index] Use HeuristicResolver in IndexTypeSourceInf

[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-20 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > > Adding metadata to an instruction should never be required for correctness > > I figured the existing use and the fact that it only needs to survive until > CoroSplit made it good enough. But you're right, we should do better. > > I do think we need an explicit way to tel

[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)

2025-02-20 Thread via cfe-commits
bd1976bris wrote: > I don't have a strong opinion on this but I have basically the same concerns > with completely opposite conclusions. To me, the distributed thinLTO makes > you think there is a distributed full LTO, while just call it distributed LTO > will eliminate that confusion. Distrib

[clang] [flang] [flang] Align `-x f95[-cpp-input]` language modes with `gfortran` (PR #127986)

2025-02-20 Thread Iñaki Amatria Barral via cfe-commits
https://github.com/inaki-amatria edited https://github.com/llvm/llvm-project/pull/127986 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] default clause replaced by otherwise clause for metadirective in OpenMP 5.2 (PR #125648)

2025-02-20 Thread Urvi Rav via cfe-commits
https://github.com/ravurvi20 updated https://github.com/llvm/llvm-project/pull/125648 >From 189dd3cc2230ea5752969f02f119b6ee30e3df69 Mon Sep 17 00:00:00 2001 From: Urvi Rav Date: Tue, 4 Feb 2025 01:35:41 -0600 Subject: [PATCH 1/6] default clause replaced by otherwise clause for metadirective

[clang] [Clang] Default the warning for chained comparison to an error. (PR #128145)

2025-02-20 Thread via cfe-commits
https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/128145 Boolean constructs of the form `a < b < c` never express the likely intent of the user and we have been warning on them since clang 19. WG21 is likely to deprecate or make that construct in the future. To gain

[clang] [Clang] Default the warning for chained comparison to an error. (PR #128145)

2025-02-20 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: cor3ntin (cor3ntin) Changes Boolean constructs of the form `a < b < c` never express the likely intent of the user and we have been warning on them since clang 19. WG21 is likely to deprecate or make that construct in the future. To gain m

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-20 Thread Carlos Galvez via cfe-commits
@@ -0,0 +1,69 @@ +//===--- UnintendedCharOstreamOutputCheck.cpp - clang-tidy ===// +// +// 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] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-20 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/127773 >From 2d9c248c70b6d24f277982a32f36e2ef1bde2829 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 19 Feb 2025 17:13:56 +0800 Subject: [PATCH 1/2] [Clang] Implement CWG2918 'Consideration of constraints for

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-20 Thread Balázs Benics via cfe-commits
@@ -359,7 +326,80 @@ class RegionBindingsRef : public llvm::ImmutableMapRefhttps://github.com/llvm/llvm-project/pull/127602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[clang] [clang] more useful error message for decomposition declaration missing initializer (PR #127924)

2025-02-20 Thread Erich Keane via cfe-commits
@@ -14058,7 +14058,17 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) { // C++1z [dcl.dcl]p1 grammar implies that an initializer is mandatory. if (isa(RealDecl)) { - Diag(Var->getLocation(), diag::err_decomp_decl_requires_init) << Var; + Preprocessor &PP

[clang] [Clang] Add BuiltinTemplates.td to generate code for builtin templates (PR #123736)

2025-02-20 Thread Erich Keane via cfe-commits
@@ -0,0 +1,46 @@ +//===--- BuiltinTemplates.td - Clang builtin template aliases ---*- 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: Apa

[clang] [Clang] use constant evaluation context for constexpr if conditions (PR #123667)

2025-02-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. This now lacks my concerns, as this is only applying to the singular expression. But parsing isn't my expertise, so @cor3ntin or @Endilll should probably think about this for a minute or two. https://github.com/llvm/llvm-project/pull/1

[clang] [MS][clang] Add support for vector deleting destructors (PR #126240)

2025-02-20 Thread Mariya Podchishchaeva via cfe-commits
@@ -1366,9 +1372,9 @@ bool ItaniumCXXABI::isZeroInitializable(const MemberPointerType *MPT) { /// at entry -2 in the vtable. void ItaniumCXXABI::emitVirtualObjectDelete(CodeGenFunction &CGF, const CXXDeleteExpr *DE, -

[clang] [MS][clang] Add support for vector deleting destructors (PR #126240)

2025-02-20 Thread Mariya Podchishchaeva via cfe-commits
@@ -1433,6 +1433,83 @@ static bool CanSkipVTablePointerInitialization(CodeGenFunction &CGF, return true; } +namespace { +llvm::Value *LoadThisForDtorDelete(CodeGenFunction &CGF, + const CXXDestructorDecl *DD) { + if (Expr *ThisArg = DD->ge

[clang] [Clang] Mark P1061 (Structured Bindings can introduce a Pack) as implemented (PR #127980)

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

[clang] [MS][clang] Add support for vector deleting destructors (PR #126240)

2025-02-20 Thread Mariya Podchishchaeva via cfe-commits
@@ -4053,6 +4063,19 @@ void MicrosoftCXXABI::emitCXXStructor(GlobalDecl GD) { if (GD.getDtorType() == Dtor_Base && !CGM.TryEmitBaseDestructorAsAlias(dtor)) return; + if (GD.getDtorType() == Dtor_VectorDeleting && + !CGM.classNeedsVectorDestructor(dtor->getParent())

[clang] [MS][clang] Add support for vector deleting destructors (PR #126240)

2025-02-20 Thread Mariya Podchishchaeva via cfe-commits
@@ -1433,6 +1433,83 @@ static bool CanSkipVTablePointerInitialization(CodeGenFunction &CGF, return true; } +namespace { +llvm::Value *LoadThisForDtorDelete(CodeGenFunction &CGF, Fznamznon wrote: I moved it back. It seems in some earlier iteration of the pa

[clang] [clang][analyzer] Add checker 'alpha.core.FixedAddressDereference' (PR #127191)

2025-02-20 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/127191 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang] [clang][analyzer] Add checker 'alpha.core.FixedAddressDereference' (PR #127191)

2025-02-20 Thread Balazs Benics via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= , =?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= , =?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. I'm happy with your PR. I think it looks great. https://github.com/llvm/llvm-project/pull/127191

[clang] [clang][analyzer] Add checker 'alpha.core.FixedAddressDereference' (PR #127191)

2025-02-20 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -0,0 +1,77 @@ +// RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -analyzer-checker=core,alpha.core -std=gnu99 -analyzer-config suppress-all-address-spaces=false -verif

[clang] [clang][analyzer] Add checker 'alpha.core.FixedAddressDereference' (PR #127191)

2025-02-20 Thread Balazs Benics via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= , =?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= , =?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: @@ -2919,6 +2916,38 @@ Check for assignment of a fixed address to a pointer. p = (int *) 0x1; // warn } +.. _alpha-core-FixedAddressDer

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-20 Thread Younan Zhang via cfe-commits
@@ -60,6 +60,90 @@ struct S { #endif } // namespace cwg2917 +namespace cwg2918 { // cwg2918: 21 + +#if __cplusplus >= 202002L zyn0217 wrote: Done. Now it tests `Example3` in C++11 onwards (Example 1 contains constraint expressions so it needs c++20) https://

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-20 Thread Balázs Benics via cfe-commits
balazs-benics-sonarsource wrote: > As I thought a bit more about the reorganization that I suggested, I realized > that it can be summarized as **we should synchronize adding the default > `Unknown` binding and calling `escapeValue`** -- because they correspond to > the two end-points of the s

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-20 Thread Balázs Benics via cfe-commits
@@ -359,7 +326,80 @@ class RegionBindingsRef : public llvm::ImmutableMapRefhttps://github.com/llvm/llvm-project/pull/127602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-20 Thread Younan Zhang via cfe-commits
@@ -13252,6 +13273,33 @@ class AddressOfFunctionResolver { } } + void EliminateLessPartialOrderingConstrainedMatches() { +// C++ [over.over]p5: +// [...] Any given non-template function F0 is eliminated if the set +// contains a second non-template funct

[clang] [clang-format] Fix a bug in BCIS_AfterColon and `ColumnLimit: 0` (PR #127964)

2025-02-20 Thread via cfe-commits
https://github.com/mydeveloperday approved this pull request. https://github.com/llvm/llvm-project/pull/127964 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Fix] Speedup -Wunsafe-buffer-usage when using clang modules. (PR #127161)

2025-02-20 Thread Hans Wennborg via cfe-commits
zmodem wrote: +cc @haoNoQ and @ivanaivanovska for -Wunsafe-buffer-usage https://github.com/llvm/llvm-project/pull/127161 ___ 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 bugprone-unintended-char-ostream-output (PR #127720)

2025-02-20 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/127720 >From b69bb465a24f2175f2f9f91f220252d3bcb27bde Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Wed, 19 Feb 2025 07:38:37 +0800 Subject: [PATCH 1/7] [clang-tidy]add new check bugprone-unintended-char-ostre

[clang] [flang] [flang][OpenMP] Upstream `do concurrent` loop-nest detection. (PR #127595)

2025-02-20 Thread Sergio Afonso via cfe-commits
@@ -53,6 +53,79 @@ that: * It has been tested in a very limited way so far. * It has been tested mostly on simple synthetic inputs. +### Loop nest detection + +On the `FIR` dialect level, the following loop: +```fortran + do concurrent(i=1:n, j=1:m, k=1:o) +a(i,j,k) = i +

[clang] [flang] [flang][OpenMP] Upstream `do concurrent` loop-nest detection. (PR #127595)

2025-02-20 Thread Sergio Afonso via cfe-commits
@@ -31,6 +158,14 @@ class DoConcurrentConversion : public mlir::OpConversionPattern { mlir::LogicalResult matchAndRewrite(fir::DoLoopOp doLoop, OpAdaptor adaptor, mlir::ConversionPatternRewriter &rewriter) const override { +looputils::LoopNest loopNes

[clang] [flang] [flang][OpenMP] Upstream `do concurrent` loop-nest detection. (PR #127595)

2025-02-20 Thread Sergio Afonso via cfe-commits
https://github.com/skatrak approved this pull request. LGTM, thank you! https://github.com/llvm/llvm-project/pull/127595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [flang][OpenMP] Upstream `do concurrent` loop-nest detection. (PR #127595)

2025-02-20 Thread Sergio Afonso via cfe-commits
@@ -53,6 +53,79 @@ that: * It has been tested in a very limited way so far. * It has been tested mostly on simple synthetic inputs. +### Loop nest detection + +On the `FIR` dialect level, the following loop: +```fortran + do concurrent(i=1:n, j=1:m, k=1:o) +a(i,j,k) = i +

[clang] [flang] [flang][OpenMP] Upstream `do concurrent` loop-nest detection. (PR #127595)

2025-02-20 Thread Sergio Afonso via cfe-commits
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/127595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Feat] Allow Finding across only parts of an AST. (PR #127423)

2025-02-20 Thread Hans Wennborg via cfe-commits
zmodem wrote: > This is relevant for clang modules, as they are imported into the AST, but > are actually part of a different TU. I'm not a modules or matcher expert, but this doesn't match my (perhaps uninformed) understanding. I thought that when we import a module, it *is* part of our TU,

[clang] [Feature]: merge host and kernel dependencies for heterogeneous compilation (PR #119513)

2025-02-20 Thread Yaxun Liu via cfe-commits
@@ -798,6 +798,8 @@ def MD : Flag<["-"], "MD">, Group, HelpText<"Write a depfile containing user and system headers">; def MMD : Flag<["-"], "MMD">, Group, HelpText<"Write a depfile containing user headers">; +def MMMD : Flag<["-"], "MMMD">, Group, yxsa

[clang] [clang][Sema] Propagate `volatile` during derived-to-base conversion (PR #127824)

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

[clang] [clang][Sema] Propagate `volatile` during derived-to-base conversion (PR #127824)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -ast-dump %s | FileCheck %s AaronBallman wrote: Should we also have a CodeGen test showing that we do a `store/load volatile`? https://github.com/llvm/llvm-project/pull/127824

[clang] [clang][Sema] Propagate `volatile` during derived-to-base conversion (PR #127824)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -3107,8 +3107,11 @@ Sema::PerformObjectMemberConversion(Expr *From, /*IgnoreAccess=*/true)) return ExprError(); - return ImpCastExprToType(From, DestType, CK_UncheckedDerivedToBase, - VK, &BasePath); + if (F

[clang] [clang][Sema] Propagate `volatile` during derived-to-base conversion (PR #127824)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -ast-dump %s | FileCheck %s + +// Ensure volatile is preserved during derived-to-base conversion. +namespace PR127683 { + +struct Base { + int Val; +}; + +struct Derived : Base { }; + +volatile Derived Obj; + +// CHEC

[clang] [clang][Sema] Propagate `volatile` during derived-to-base conversion (PR #127824)

2025-02-20 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for working on this! Please be sure to add a release note to `clang/docs/ReleaseNotes.rst` so users know about the fix. https://github.com/llvm/llvm-project/pull/127824 ___ cfe-commits mailing list

[clang] [Clang] Add BuiltinTemplates.td to generate code for builtin templates (PR #123736)

2025-02-20 Thread Erich Keane via cfe-commits
@@ -0,0 +1,162 @@ +//=- ClangBuiltinsEmitter.cpp - Generate Clang builtin templates-*- 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] [MS][clang] Add support for vector deleting destructors (PR #126240)

2025-02-20 Thread Mariya Podchishchaeva via cfe-commits
@@ -2013,7 +2023,7 @@ llvm::Value *MicrosoftCXXABI::EmitVirtualDestructorCall( ASTContext &Context = getContext(); llvm::Value *ImplicitParam = llvm::ConstantInt::get( llvm::IntegerType::getInt32Ty(CGF.getLLVMContext()), - DtorType == Dtor_Deleting); + 2 * (

[clang] [MS][clang] Add support for vector deleting destructors (PR #126240)

2025-02-20 Thread Mariya Podchishchaeva via cfe-commits
https://github.com/Fznamznon updated https://github.com/llvm/llvm-project/pull/126240 >From 04636bea1b873805af02dea865637d7125cee1e5 Mon Sep 17 00:00:00 2001 From: "Podchishchaeva, Mariya" Date: Thu, 12 Dec 2024 08:57:37 -0800 Subject: [PATCH 1/3] [MS][clang] Add support for vector deleting des

[clang] Thread Safety Analysis: Improved pointer handling (PR #127396)

2025-02-20 Thread via cfe-commits
aoates wrote: As an additional data point --- I patched in these commits and have been testing with them on my C codebase and a) so far I have no found any false positives b) it has made a _huge_ difference in the effectiveness of TSA I'm a strong supporter of this independent of the Linux kern

[clang] [flang] [flang] Add -f[no-]vectorize flags (PR #119718)

2025-02-20 Thread LLVM Continuous Integration via cfe-commits
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `clang-cmake-x86_64-avx512-win` running on `avx512-intel64-win` while building `clang,flang` at step 4 "cmake stage 1". Full details are available at: https://lab.llvm.org/buildbot/#/builders/81/builds/4943 Here is the relev

[clang] default clause replaced by otherwise clause for metadirective in OpenMP 5.2 (PR #125648)

2025-02-20 Thread Jan Patrick Lehr via cfe-commits
https://github.com/jplehr approved this pull request. Thanks for all the comments and addressing concerns. https://github.com/llvm/llvm-project/pull/125648 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,79 @@ +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-core-mlir %s -o %t.mlir +// RUN: FileCheck --input-file=%t.mlir %s + +char c; +// CHECK: memref.global "public" @c : memref + +signed char sc; +// CHECK: memref.global "public" @sc :

[clang] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,201 @@ +//- LowerCIRToMLIR.cpp - Lowering from CIR to MLIR ===// +// +// 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] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,201 @@ +//- LowerCIRToMLIR.cpp - Lowering from CIR to MLIR ===// +// +// 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] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,201 @@ +//- LowerCIRToMLIR.cpp - Lowering from CIR to MLIR ===// +// +// 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] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -90,6 +92,15 @@ class CIRGenConsumer : public clang::ASTConsumer { MlirModule->print(*OutputStream, Flags); } break; +case CIRGenAction::OutputType::EmitMLIR: { + auto LoweredMlirModule = lowerFromCIRToMLIR(MlirModule, MlirCtx);

[clang] [Clang] add -Wshift-bool warning to handle shifting of bool (PR #127336)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -11246,6 +11246,12 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult &LHS, ExprResult &RHS, if (S.getLangOpts().OpenCL) return; + if (LHS.get()->IgnoreParenImpCasts()->getType()->isBooleanType()) { +S.Diag(Loc, diag::warn_shift_bool) +<< (Opc ==

[libclc] [libclc] Define macros for users of gentype.inc (PR #128012)

2025-02-20 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/128012 Several users of (mostly math/) gentype.inc rely on types other than the 'gentype'. This is commonly intN as several maths builtins expose this as a return or paramter type. We were previously explicitly de

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-20 Thread Jonas Paulsson via cfe-commits
@@ -255,4 +255,9 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) { } setLibcallName(RTLIB::MULO_I128, nullptr); } + + if (TT.isSystemZ()) { +setLibcallName(RTLIB::FPROUND_F32_F16, "__truncsfhf2"); +setLibcallName(RTLIB::FPEXT_F16_F32, "__extendhfs

[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)

2025-02-20 Thread Jonas Paulsson via cfe-commits
JonPsson1 wrote: Patch rebased as the handling of libcalls had changed on main. https://github.com/llvm/llvm-project/pull/109164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema][NFC] Move two misplaced uninit tests to clang/test/SemaCXX (PR #128013)

2025-02-20 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Donát Nagy (NagyDonat) Changes Because they are the last two remaining test files that appeared under `clang/test/Analysis` but were unrelated to the clang static analyzer. For background see the following discourse thread: https://disco

[clang] [cindex] Add API to query the class methods of a type (PR #123539)

2025-02-20 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. Thank you! LGTM aside from some very minor nits. https://github.com/llvm/llvm-project/pull/123539 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [cindex] Add API to query the class methods of a type (PR #123539)

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

[clang] [cindex] Add API to query the class methods of a type (PR #123539)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -54,6 +54,33 @@ unsigned clang_visitCXXBaseClasses(CXType PT, CXFieldVisitor visitor, return true; } +unsigned clang_visitCXXMethods(CXType PT, CXFieldVisitor visitor, + CXClientData client_data) { + CXCursor PC = clang_getTypeDeclaration(P

[clang] [cindex] Add API to query the class methods of a type (PR #123539)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -6628,6 +6628,29 @@ CINDEX_LINKAGE unsigned clang_visitCXXBaseClasses(CXType T, CXFieldVisitor visitor, CXClientData client_data); +/** + * Visit the class methods of a type

[clang] [CMake] Fix variable name (PR #127967)

2025-02-20 Thread Tom Stellard via cfe-commits
https://github.com/tstellar approved this pull request. LGTM. I confirmed this fixes the release build configuration. https://github.com/llvm/llvm-project/pull/127967 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang] [CMake] Fix variable name (PR #127967)

2025-02-20 Thread Tom Stellard via cfe-commits
tstellar wrote: > The fix is NOT correct. You need to enclose in quotes as @tstellar mentions > in #126876 ` llvm_canonicalize_cmake_booleans` converts the string to an integer so you don't need the quotes now that this function is called with the correct variable. This is what the generated

[libclc] [libclc] Define macros for users of gentype.inc (PR #128012)

2025-02-20 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/128012 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add support for template as type parameter (PR #127654)

2025-02-20 Thread via cfe-commits
ykhatav wrote: I found some gaps in my implementation. Converting this PR to draft while I work on it. https://github.com/llvm/llvm-project/pull/127654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] [analyzer] Do list initialization for CXXNewExpr with initializer list arg (PR #127702)

2025-02-20 Thread Michael Flanders via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_analyze_cc1 -w -verify %s\ +// RUN: -analyzer-checker=core\ +// RUN: -analyzer-checker=debug.ExprInspection -std=c++17 +// RUN: %clang_analyze_cc1 -w -verify %s\ +// RUN: -analyzer-checker=core\ +// RUN: -analyzer-checker=debug.ExprInspecti

[clang] [analyzer] Do list initialization for CXXNewExpr with initializer list arg (PR #127702)

2025-02-20 Thread Michael Flanders via cfe-commits
https://github.com/Flandini updated https://github.com/llvm/llvm-project/pull/127702 >From 12791f2c89f7e42bd261ac573c2497857c42b6f3 Mon Sep 17 00:00:00 2001 From: Michael Flanders Date: Tue, 18 Feb 2025 15:56:13 -0600 Subject: [PATCH 1/8] [analyzer] Do list initialization for CXXNewExpr with i

[clang] [Sema][NFC] Move two misplaced uninit tests to clang/test/SemaCXX (PR #128013)

2025-02-20 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. This makes sense to me, but I added some other folks just to sanity check. https://github.com/llvm/llvm-project/pull/128013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://list

[clang] [analyzer] Do list initialization for CXXNewExpr with initializer list arg (PR #127702)

2025-02-20 Thread Michael Flanders via cfe-commits
https://github.com/Flandini edited https://github.com/llvm/llvm-project/pull/127702 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema][NFC] Move two misplaced uninit tests to clang/test/SemaCXX (PR #128013)

2025-02-20 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/128013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] ae57854 - [libclc] Define macros for users of gentype.inc (#128012)

2025-02-20 Thread via cfe-commits
Author: Fraser Cormack Date: 2025-02-20T15:24:04Z New Revision: ae5785460dfdee82b9b3fe08fb5f2da73c91cec0 URL: https://github.com/llvm/llvm-project/commit/ae5785460dfdee82b9b3fe08fb5f2da73c91cec0 DIFF: https://github.com/llvm/llvm-project/commit/ae5785460dfdee82b9b3fe08fb5f2da73c91cec0.diff LOG

[libclc] [libclc] Define macros for users of gentype.inc (PR #128012)

2025-02-20 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed https://github.com/llvm/llvm-project/pull/128012 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema][NFC] Move two misplaced uninit tests to clang/test/SemaCXX (PR #128013)

2025-02-20 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: Looks good! I wonder if we should rename the directory to something like `clang/test/StaticAnalyzer` to avoid confusion in the future. https://github.com/llvm/llvm-project/pull/128013 ___ cfe-commits mailing list cfe-commits@lists.llv

[clang] [CMake] Fix variable name (PR #127967)

2025-02-20 Thread Madhur Amilkanthwar via cfe-commits
madhur13490 wrote: > > The fix is NOT correct. You need to enclose in quotes as @tstellar mentions > > in #126876 > > ` llvm_canonicalize_cmake_booleans` converts the string to an integer so you > don't need the quotes now that this function is called with the correct > variable. This is what

[clang] [Sema][NFC] Move two misplaced uninit tests to clang/test/SemaCXX (PR #128013)

2025-02-20 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > I wonder if we should rename the directory to something like > `clang/test/StaticAnalyzer` to avoid confusion in the future. I also considered renaming the directory to `clang/test/StaticAnalyzer` and I would definitely support this idea if it doesn't cause too many difficul

[clang] [analyzer] Do list initialization for CXXNewExpr with initializer list arg (PR #127702)

2025-02-20 Thread Michael Flanders via cfe-commits
https://github.com/Flandini updated https://github.com/llvm/llvm-project/pull/127702 >From 12791f2c89f7e42bd261ac573c2497857c42b6f3 Mon Sep 17 00:00:00 2001 From: Michael Flanders Date: Tue, 18 Feb 2025 15:56:13 -0600 Subject: [PATCH 1/9] [analyzer] Do list initialization for CXXNewExpr with i

[clang] [clang] Added warn-assignment-bool-context (PR #115234)

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

[clang] [clang] Added warn-assignment-bool-context (PR #115234)

2025-02-20 Thread Erich Keane via cfe-commits
@@ -687,6 +687,48 @@ void Sema::diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E) { << FixItHint::CreateReplacement(E->getSourceRange(), "nullptr"); } +void Sema::DiagnoseAssignmentBoolContext(Expr *E, QualType Ty) { + // Use copy to not alter original expr

[clang] [clang] Added warn-assignment-bool-context (PR #115234)

2025-02-20 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Still hasn't changed based on my previous feedback, but a few more things as I was scrolling through. https://github.com/llvm/llvm-project/pull/115234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang] [llvm] [LLVM][Triple][NFCI] Add function to test for offloading triples (PR #126956)

2025-02-20 Thread Nick Sarnie via cfe-commits
@@ -1109,6 +1109,11 @@ class Triple { Env == llvm::Triple::EABIHF; } + /// Tests if the target represents a device which can be offloaded to. + bool isOffloadingTarget() const { +return isAMDGPU() || isNVPTX() || isSPIRV(); + } sarnex wrote

[clang] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer { void Initialize(clang::ASTContext &astContext) override; bool HandleTopLevelDecl(clang::DeclGroupRef group) override; mlir::ModuleOp getModule() const; + mlir::MLIRContext &getMLIRContext() { return *mlir

[clang] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

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

[clang] [ARM, AArch64] Fix ABI bugs with over-sized bitfields (PR #126774)

2025-02-20 Thread John Brawn via cfe-commits
https://github.com/john-brawn-arm approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/126774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Do list initialization for CXXNewExpr with initializer list arg (PR #127702)

2025-02-20 Thread Michael Flanders via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_analyze_cc1 -w -verify %s\ +// RUN: -analyzer-checker=core\ +// RUN: -analyzer-checker=debug.ExprInspection -std=c++17 +// RUN: %clang_analyze_cc1 -w -verify %s\ +// RUN: -analyzer-checker=core\ +// RUN: -analyzer-checker=debug.ExprInspecti

[clang] [clang] Added warn-assignment-bool-context (PR #115234)

2025-02-20 Thread Erich Keane via cfe-commits
@@ -687,6 +687,48 @@ void Sema::diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E) { << FixItHint::CreateReplacement(E->getSourceRange(), "nullptr"); } +void Sema::DiagnoseAssignmentBoolContext(Expr *E, QualType Ty) { + // Use copy to not alter original expr

[clang] [analyzer] Do list initialization for CXXNewExpr with initializer list arg (PR #127702)

2025-02-20 Thread Michael Flanders via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_analyze_cc1 -w -verify %s\ +// RUN: -analyzer-checker=core\ +// RUN: -analyzer-checker=debug.ExprInspection -std=c++17 +// RUN: %clang_analyze_cc1 -w -verify %s\ +// RUN: -analyzer-checker=core\ +// RUN: -analyzer-checker=debug.ExprInspecti

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-20 Thread Nikita Popov via cfe-commits
nikic wrote: @zmodem Could you please check whether the clang build on windows works with the patch at https://github.com/llvm/llvm-project/pull/128020? https://github.com/llvm/llvm-project/pull/125880 ___ cfe-commits mailing list cfe-commits@lists.ll

[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-20 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem updated https://github.com/llvm/llvm-project/pull/127653 >From cde82a27139c39406a9afb5b471fa527e52e5bca Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Tue, 18 Feb 2025 15:27:37 +0100 Subject: [PATCH 1/3] [Coroutines] Mark parameter allocas with coro.outside.frame

[clang] [llvm] Add support for template as type parameter (PR #127654)

2025-02-20 Thread via cfe-commits
https://github.com/ykhatav converted_to_draft https://github.com/llvm/llvm-project/pull/127654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-20 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 6d86a8a1a12856955aba5e06a6552ddafaaa208f 26e26100711b92a946180450d31f265647cfaba4 --e

[clang] [Sema][NFC] Move two misplaced uninit tests to clang/test/SemaCXX (PR #128013)

2025-02-20 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/128013 Because they are the last two remaining test files that appeared under `clang/test/Analysis` but were unrelated to the clang static analyzer. For background see the following discourse thread: https://discou

[clang] Reland "[libclang] Always Dup in createRef(StringRef)" (PR #127078)

2025-02-20 Thread Vitaly Buka via cfe-commits
vitalybuka wrote: @fmayer Looks like my patch exposed another UAF https://lab.llvm.org/buildbot/#/builders/169/builds/8637 Looking, and will revert if there is no quick fix https://github.com/llvm/llvm-project/pull/127078 ___ cfe-commits mailing list

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -104,6 +104,7 @@ FEATURE(thread_sanitizer, LangOpts.Sanitize.has(SanitizerKind::Thread)) FEATURE(dataflow_sanitizer, LangOpts.Sanitize.has(SanitizerKind::DataFlow)) FEATURE(scudo, LangOpts.Sanitize.hasOneOf(SanitizerKind::Scudo)) FEATURE(ptrauth_intrinsics, LangOpts.Pointer

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -980,6 +980,25 @@ def err_ptrauth_indirect_goto_addrlabel_arithmetic : Error< "%select{subtraction|addition}0 of address-of-label expressions is not " "supported with ptrauth indirect gotos">; +// __ptrauth qualifier +def err_ptrauth_qualifier_invalid : Error< + "%sele

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -5017,6 +5037,10 @@ def note_ovl_candidate_bad_ownership : Note< "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership," " but parameter has %select{no|__unsafe_unretained|__strong|__weak|" "__autoreleasing}5 ownership">; +def note_ovl_cand

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -980,6 +980,25 @@ def err_ptrauth_indirect_goto_addrlabel_arithmetic : Error< "%select{subtraction|addition}0 of address-of-label expressions is not " "supported with ptrauth indirect gotos">; +// __ptrauth qualifier +def err_ptrauth_qualifier_invalid : Error< + "%sele

<    1   2   3   4   5   >