[clang-tools-extra] [tidy] add new check bugprone-return-const-ref-from-parameter (PR #89497)

2024-04-22 Thread Danny Mösch via cfe-commits
@@ -112,6 +112,13 @@ New checks Detects error-prone Curiously Recurring Template Pattern usage, when the CRTP can be constructed outside itself and the derived class. +- New :doc:`bugprone-return-const-ref-from-parameter + ` check. + + Detects return statements that

[clang-tools-extra] [tidy] add new check bugprone-return-const-ref-from-parameter (PR #89497)

2024-04-22 Thread Danny Mösch via cfe-commits
@@ -0,0 +1,40 @@ +//===--- ReturnConstRefFromParameterCheck.h - clang-tidy *- 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:

[clang-tools-extra] [tidy] add new check bugprone-return-const-ref-from-parameter (PR #89497)

2024-04-22 Thread Danny Mösch via cfe-commits
https://github.com/SimplyDanny approved this pull request. Only a few more nits from my side. https://github.com/llvm/llvm-project/pull/89497 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [tidy] add new check bugprone-return-const-ref-from-parameter (PR #89497)

2024-04-22 Thread Danny Mösch via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - bugprone-return-const-ref-from-parameter + +bugprone-return-const-ref-from-parameter + + +Detects return statements that return a constant reference parameter as constant +reference. This may cause

[clang-tools-extra] [tidy] add new check bugprone-return-const-ref-from-parameter (PR #89497)

2024-04-22 Thread Danny Mösch via cfe-commits
https://github.com/SimplyDanny edited https://github.com/llvm/llvm-project/pull/89497 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [PowerPC] Tune AIX shared library TLS model at function level (PR #84132)

2024-04-22 Thread Felix via cfe-commits
https://github.com/orcguru edited https://github.com/llvm/llvm-project/pull/84132 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Mark ill-formed partial specialization as invalid (PR #89536)

2024-04-22 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/89536 >From 58058a88305c7d4c1b1a30d8572ca481889ea3f9 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 21 Apr 2024 13:29:39 +0300 Subject: [PATCH 1/2] [clang] Mark ill-formed partial specialization as

[clang] [llvm] [CodeGen][i386] Move -mregparm storage earlier and fix Runtime calls (PR #89707)

2024-04-22 Thread Kees Cook via cfe-commits
kees wrote: This needs test cases, which I'll add tomorrow. I just wanted to get the core logic up for review before I hit EOD... https://github.com/llvm/llvm-project/pull/89707 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] [CodeGen][i386] Move -mregparm storage earlier and fix Runtime calls (PR #89707)

2024-04-22 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Kees Cook (kees) Changes When building the Linux kernel for i386, the -mregparm=3 option is enabled. Crashes were observed in the sanitizer handler functions, and the problem was found to be mismatched calling convention. As was fixed

[clang] [llvm] [CodeGen][i386] Move -mregparm storage earlier and fix Runtime calls (PR #89707)

2024-04-22 Thread Kees Cook via cfe-commits
https://github.com/kees created https://github.com/llvm/llvm-project/pull/89707 When building the Linux kernel for i386, the -mregparm=3 option is enabled. Crashes were observed in the sanitizer handler functions, and the problem was found to be mismatched calling convention. As was fixed in

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 Thread Craig Topper via cfe-commits
https://github.com/topperc updated https://github.com/llvm/llvm-project/pull/89684 >From c28f21fb93f31661f8313259f0103dc1af44f4a7 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 22 Apr 2024 13:19:26 -0700 Subject: [PATCH] [RISCV] Split code that tablegen needs out of RISCVISAInfo. This

[clang] [clang-format] Correctly annotate list init braces of class types (PR #89706)

2024-04-22 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-format Author: Owen Pan (owenca) Changes Fixes #71939. --- Full diff: https://github.com/llvm/llvm-project/pull/89706.diff 2 Files Affected: - (modified) clang/lib/Format/UnwrappedLineParser.cpp (+35-6) - (modified)

[clang] [Coverage] Handle array decomposition correctly (PR #88881)

2024-04-22 Thread Andrey Ali Khan Bolshakov via cfe-commits
bolshakov-a wrote: @efriedma-quic, would it be OK to add "subexpression" visitation with a comment that I'm not sure that it is actually needed? https://github.com/llvm/llvm-project/pull/1 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang-format] Correctly annotate list init braces of class types (PR #89706)

2024-04-22 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/89706 Fixes #71939. >From 0fab05c4ab7ac95d7c08dd23a0441dc28c2ef813 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 22 Apr 2024 21:56:31 -0700 Subject: [PATCH] [clang-format] Correctly annotate list init braces of

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,274 @@ +//===--- MinMaxUseInitializerListCheck.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:

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 Thread Pengcheng Wang via cfe-commits
https://github.com/wangpc-pp approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/89684 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 Thread Craig Topper via cfe-commits
https://github.com/topperc updated https://github.com/llvm/llvm-project/pull/89684 >From 7171df42d62ec510627f1fd6526c39c340f2e425 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 22 Apr 2024 13:19:26 -0700 Subject: [PATCH 1/2] [RISCV] Split code that tablegen needs out of RISCVISAInfo.

[clang] [clang][CodeGen][NFC] Make ConstExprEmitter a ConstStmtVisitor (PR #89041)

2024-04-22 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/89041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] e5f9de8 - [clang][CodeGen][NFC] Make ConstExprEmitter a ConstStmtVisitor (#89041)

2024-04-22 Thread via cfe-commits
Author: Timm Baeder Date: 2024-04-23T06:04:15+02:00 New Revision: e5f9de89e540b06893709d97f3ce9671071b3df0 URL: https://github.com/llvm/llvm-project/commit/e5f9de89e540b06893709d97f3ce9671071b3df0 DIFF: https://github.com/llvm/llvm-project/commit/e5f9de89e540b06893709d97f3ce9671071b3df0.diff

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-22 Thread Piotr Zegar via cfe-commits
@@ -47,7 +47,7 @@ class MinMaxUseInitializerListCheck : public ClangTidyCheck { private: bool IgnoreNonTrivialTypes; - unsigned long IgnoreTrivialTypesOfSizeAbove; + long IgnoreTrivialTypesOfSizeAbove; PiotrZSL wrote: why change into signed ? Unsigned

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,50 @@ +.. title:: clang-tidy - modernize-min-max-use-initializer-list + +modernize-min-max-use-initializer-list +== + +Replaces nested ``std::min`` and ``std::max`` calls with an initializer list +where applicable. + +For instance,

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-22 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,56 @@ +//===--- MinMaxUseInitializerListCheck.h - clang-tidy ---*- 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:

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-22 Thread Piotr Zegar via cfe-commits
@@ -80,27 +80,26 @@ static SmallVector generateReplacements(const MatchFinder::MatchResult , const CallExpr *TopCall, const FindArgsResult , const bool IgnoreNonTrivialTypes, - const unsigned long

[clang] [clang] fix half && bfloat16 convert node expr codegen (PR #89051)

2024-04-22 Thread Pengcheng Wang via cfe-commits
@@ -0,0 +1,194 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 4 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature +fullbf16 -S -emit-llvm %s -o - | FileCheck %s wangpc-pp wrote:

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 Thread Craig Topper via cfe-commits
@@ -1,12 +1,12 @@ -//===-- RISCVISAInfo.cpp - RISC-V Arch String Parser *- C++ -*-===// topperc wrote: Only header files usually have this comment https://github.com/llvm/llvm-project/pull/89684 ___

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 Thread Pengcheng Wang via cfe-commits
https://github.com/wangpc-pp commented: I think this patch doesn't need to be stacked on #89335. https://github.com/llvm/llvm-project/pull/89684 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 Thread Pengcheng Wang via cfe-commits
@@ -1,12 +1,12 @@ -//===-- RISCVISAInfo.cpp - RISC-V Arch String Parser *- C++ -*-===// wangpc-pp wrote: We shouldn't remove `*- C++ -*` here I think, it's for editors like Emacs. https://github.com/llvm/llvm-project/pull/89684

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 Thread Pengcheng Wang via cfe-commits
https://github.com/wangpc-pp edited https://github.com/llvm/llvm-project/pull/89684 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [MC/DC][Coverage] Workaround for `##` conditions (PR #89573)

2024-04-22 Thread Wentao Zhang via cfe-commits
whentojump wrote: Hi, thanks for the fix. I can confirm it addressed your test case (https://godbolt.org/z/sMscqWeq7). But unfortunately it doesn't fix the one in my original post of #87000 ([compiler explorer

[clang] Push immediate function context while transforming lambdas in templates. (PR #89702)

2024-04-22 Thread Daniel M. Katz via cfe-commits
https://github.com/katzdm updated https://github.com/llvm/llvm-project/pull/89702 >From ba1c87956f74248467d2f85c20c2f450eef953bd Mon Sep 17 00:00:00 2001 From: Dan Katz Date: Mon, 22 Apr 2024 22:39:06 -0400 Subject: [PATCH] Push immediate function context while transforming lambdas in

[clang] Push immediate function context while transforming lambdas in templates. (PR #89702)

2024-04-22 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Daniel M. Katz (katzdm) Changes The following program is [accepted](https://godbolt.org/z/oEc34Trh4) by Clang, EDG, and MSVC, but rejected by Clang: ```cpp #include vector consteval auto fn() { return std::vector {1,2,3}; } template

[clang] Push immediate function context while transforming lambdas in templates. (PR #89702)

2024-04-22 Thread Daniel M. Katz via cfe-commits
https://github.com/katzdm created https://github.com/llvm/llvm-project/pull/89702 The following program is [accepted](https://godbolt.org/z/oEc34Trh4) by Clang, EDG, and MSVC, but rejected by Clang: ```cpp #include consteval auto fn() { return std::vector {1,2,3}; } template void fn2() {

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-22 Thread via cfe-commits
https://github.com/sopyb edited https://github.com/llvm/llvm-project/pull/85572 ___ 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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-22 Thread via cfe-commits
@@ -0,0 +1,274 @@ +//===--- MinMaxUseInitializerListCheck.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:

[clang] [Modules] No transitive source location change (PR #86912)

2024-04-22 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: @jansvoboda11 @Bigcheese ping https://github.com/llvm/llvm-project/pull/86912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-22 Thread Dan Liew via cfe-commits
delcypher wrote: @rapidsna I've addressed the "Make it an error to use 'counted_by' on size-less types (e.g., forward declared structs)" TODO. I still need to test this PR properly and write a proper commit message explaining what this does. https://github.com/llvm/llvm-project/pull/87596

[clang] [BoundsSafety] WIP: Make 'counted_by' work for pointer fields; late parsing for 'counted_by' on decl attr position (PR #87596)

2024-04-22 Thread Dan Liew via cfe-commits
https://github.com/delcypher updated https://github.com/llvm/llvm-project/pull/87596 >From b859cf056df24daa85f3fd305ef56f32e0f266ed Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Fri, 12 Apr 2024 17:36:19 -0700 Subject: [PATCH 1/2] [Attributes] Support Attributes being declared as supporting

[clang] [llvm] [RISCV] Add processor definition for XiangShan-KunMingHu (PR #89359)

2024-04-22 Thread via cfe-commits
@@ -378,3 +378,30 @@ def XIANGSHAN_NANHU : RISCVProcessorModel<"xiangshan-nanhu", TuneZExtHFusion, TuneZExtWFusion, TuneShiftedZExtWFusion]>;

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread Akira Hatanaka via cfe-commits
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile *CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent, return DBuilder.createTempMacroFile(Parent, Line, FName); } +llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor( ahatanak wrote: @dwblaikie 's

[clang] [AIX][TLS][clang] Add -maix-small-local-dynamic-tls clang option (PR #88829)

2024-04-22 Thread Felix via cfe-commits
https://github.com/orcguru closed https://github.com/llvm/llvm-project/pull/88829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 16efd2a - [AIX][TLS][clang] Add -maix-small-local-dynamic-tls clang option (#88829)

2024-04-22 Thread via cfe-commits
Author: Felix (Ting Wang) Date: 2024-04-23T08:44:25+08:00 New Revision: 16efd2a4c4b6a811688e5f623cb04dbd2d0579e8 URL: https://github.com/llvm/llvm-project/commit/16efd2a4c4b6a811688e5f623cb04dbd2d0579e8 DIFF:

[clang] [AIX][TLS][clang] Add -maix-small-local-dynamic-tls clang option (PR #88829)

2024-04-22 Thread Felix via cfe-commits
https://github.com/orcguru updated https://github.com/llvm/llvm-project/pull/88829 >From 35bf12e2fcb499c8953e4207cea2296d9ddcbf1f Mon Sep 17 00:00:00 2001 From: Ting Wang Date: Mon, 15 Apr 2024 21:52:02 -0400 Subject: [PATCH 1/2] Following Amy's b1922e55ab3b35dff99238fd0b74be00df0472e7, and

[clang] [llvm] [mlir] Fix mismatches between function parameter definitions and declarations (PR #89512)

2024-04-22 Thread Troy Butler via cfe-commits
https://github.com/Troy-Butler edited https://github.com/llvm/llvm-project/pull/89512 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
JustinStitt wrote: @efriedma-quic said: > I'm still not happy with the AST representation here. The current > representation is likely to cause unpredictable results in edge cases, and > compatibility constraints mean whatever result the current version happens to > produce for those cases is

[clang] Fix -fno-unsafe-math-optimizations behavior (PR #89473)

2024-04-22 Thread Andy Kaylor via cfe-commits
andykaylor wrote: I've made extensive changes to the fast-math.c test here: https://github.com/llvm/llvm-project/pull/89687 That update isn't intended to change any existing behavior. A few things worked differently than I expected, but I left the checks consistent with the current behavior

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-04-22 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. This seems fine. Is there any existing bookkeeping we no longer need to do if we're going to have this RAII object in scope during function parsing? https://github.com/llvm/llvm-project/pull/85605

[clang] Fix objc_sel_{name,types} missing an underscore (PR #88713)

2024-04-22 Thread Jonathan Schleifer via cfe-commits
Midar wrote: These symbols are just used to deduplicate strings: That's why they're hidden and in COMDAT. So I don't think it'll break or fix the ABI ;). https://github.com/llvm/llvm-project/pull/88713 ___ cfe-commits mailing list

[clang] fast math test overhaul (PR #89687)

2024-04-22 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Andy Kaylor (andykaylor) Changes - Fix -fno-unsafe-math-optimizations behavior - [WIP] Major change to fast-math.c lit test - Clean up the checks in the fast-math driver test --- Patch is 26.79 KiB, truncated to 20.00 KiB below, full

[clang] fast math test overhaul (PR #89687)

2024-04-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/89687 - Fix -fno-unsafe-math-optimizations behavior - [WIP] Major change to fast-math.c lit test - Clean up the checks in the fast-math driver test >From 100fc9dfb2b071877d758ce71bddeec693d986da Mon Sep 17

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
@@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple x86_64-pc-linux-gnu +// expected-no-diagnostics +typedef int __attribute__((wraps)) wrapping_int; + +void foo(void) { + const wrapping_int A = 1; + int D = 2147483647 + A; JustinStitt wrote:

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/86618 >From 50e7b1039e514dacc05bb8cd9ff9a3e3df9ed24d Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 5 Mar 2024 03:14:49 + Subject: [PATCH 01/13] implement wraps attribute Signed-off-by: Justin Stitt

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
@@ -4249,6 +4270,10 @@ Value *ScalarExprEmitter::EmitFixedPointBinOp(const BinOpInfo ) { Value *ScalarExprEmitter::EmitSub(const BinOpInfo ) { // The LHS is always a pointer if either side is. if (!op.LHS->getType()->isPointerTy()) { +if

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
@@ -4455,6 +4455,14 @@ void Sema::AddAlignValueAttr(Decl *D, const AttributeCommonInfo , Expr *E) { D->addAttr(::new (Context) AlignValueAttr(Context, CI, E)); } +static void handleWrapsAttr(Sema , Decl *D, const ParsedAttr ) { + S.AddWrapsAttr(D, AL); +} + +void

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
@@ -4093,6 +4109,11 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo ) { op.RHS->getType()->isPointerTy()) return emitPointerArithmetic(CGF, op, CodeGenFunction::NotSubtraction); + if ((op.Ty->isSignedIntegerOrEnumerationType() || JustinStitt

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
@@ -2831,6 +2840,9 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, } else if (type->isIntegerType()) { QualType promotedType; bool canPerformLossyDemotionCheck = false; +BinOpInfo Ops = (createBinOpInfoFromIncDec(

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
@@ -156,6 +156,10 @@ struct BinOpInfo { } return false; } + + /// Does the BinaryOperator have the wraps attribute? + /// If so, we can ellide overflow sanitizer checks. JustinStitt wrote: fixed in

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
@@ -4077,6 +4077,9 @@ class BinaryOperator : public Expr { static unsigned sizeOfTrailingObjects(bool HasFPFeatures) { return HasFPFeatures * sizeof(FPOptionsOverride); } + + /// Do one of the subexpressions have the wraps attribute? JustinStitt

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/86618 >From 50e7b1039e514dacc05bb8cd9ff9a3e3df9ed24d Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 5 Mar 2024 03:14:49 + Subject: [PATCH 01/12] implement wraps attribute Signed-off-by: Justin Stitt

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 Thread Craig Topper via cfe-commits
https://github.com/topperc updated https://github.com/llvm/llvm-project/pull/89684 >From fc51e3821787f1ae8dcb344d4def0ef342ae473b Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 18 Apr 2024 16:47:31 -0700 Subject: [PATCH 1/8] [RISCV][TableGen] Generate RISCVTargetParser.inc from the

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 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 92631a4824a91f3268a5716dd3459df8dc6bfb63 ee9180aff45af55797d2e97c1b65f9c35b5c8a24 --

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/86618 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Justin Stitt via cfe-commits
@@ -4093,6 +4109,11 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo ) { op.RHS->getType()->isPointerTy()) return emitPointerArithmetic(CGF, op, CodeGenFunction::NotSubtraction); + if ((op.Ty->isSignedIntegerOrEnumerationType() || JustinStitt

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-lld-elf Author: Craig Topper (topperc) Changes This introduces a new file, RISCVISAUtils.cpp and moves the rest of RISCVISAInfo to the TargetParser library. This will allow us to generate part of RISCVISAInfo.cpp using tablegen. --- Patch is

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Craig Topper (topperc) Changes This introduces a new file, RISCVISAUtils.cpp and moves the rest of RISCVISAInfo to the TargetParser library. This will allow us to generate part of RISCVISAInfo.cpp using tablegen. --- Patch is 43.02

[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

2024-04-22 Thread Craig Topper via cfe-commits
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/89684 This introduces a new file, RISCVISAUtils.cpp and moves the rest of RISCVISAInfo to the TargetParser library. This will allow us to generate part of RISCVISAInfo.cpp using tablegen. >From

[clang] Fix objc_sel_{name,types} missing an underscore (PR #88713)

2024-04-22 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/88713 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix objc_sel_{name,types} missing an underscore (PR #88713)

2024-04-22 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: At first, I was worried that this was an ABI break. Then I noticed the internal inconsistency within this single file, and so I became worried that it was an ABI *fix*. But then I noticed that the normal selector-emission code actually makes these

[clang] [clang] Fix self-capturing `__block` variables (PR #89475)

2024-04-22 Thread via cfe-commits
ille-apple wrote: Rebased, because the original version failed CI due to a regression on `main` (#89476). https://github.com/llvm/llvm-project/pull/89475 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Fix self-capturing `__block` variables (PR #89475)

2024-04-22 Thread via cfe-commits
https://github.com/ille-apple updated https://github.com/llvm/llvm-project/pull/89475 >From 9c61a1d684a15153ea73e2036cdf978ff187c44d Mon Sep 17 00:00:00 2001 From: ille-apple Date: Fri, 19 Apr 2024 15:36:44 -0700 Subject: [PATCH] [clang] Fix self-capturing `__block` variables Clang

[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)

2024-04-22 Thread Bill Wendling via cfe-commits
bwendling wrote: Friendly ping 2: Electric Boogaloo https://github.com/llvm/llvm-project/pull/86858 ___ 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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-22 Thread via cfe-commits
@@ -0,0 +1,274 @@ +//===--- MinMaxUseInitializerListCheck.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:

[clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-22 Thread Jonas Devlieghere via cfe-commits
JDevlieghere wrote: This looks like a nice improvement for folks using those generators. Even though most of these changes look straightforward, it would be a lot easier to review if this was broken up per subproject. Is there any reason that's not possible?

[clang-tools-extra] [tidy] add new check bugprone-return-const-ref-from-parameter (PR #89497)

2024-04-22 Thread Danny Mösch via cfe-commits
@@ -0,0 +1,34 @@ +//===--- ReturnConstRefFromParameterCheck.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:

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Bill Wendling via cfe-commits
@@ -4077,6 +4077,9 @@ class BinaryOperator : public Expr { static unsigned sizeOfTrailingObjects(bool HasFPFeatures) { return HasFPFeatures * sizeof(FPOptionsOverride); } + + /// Do one of the subexpressions have the wraps attribute? bwendling wrote:

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Bill Wendling via cfe-commits
@@ -4249,6 +4270,10 @@ Value *ScalarExprEmitter::EmitFixedPointBinOp(const BinOpInfo ) { Value *ScalarExprEmitter::EmitSub(const BinOpInfo ) { // The LHS is always a pointer if either side is. if (!op.LHS->getType()->isPointerTy()) { +if

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Bill Wendling via cfe-commits
@@ -2831,6 +2840,9 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, } else if (type->isIntegerType()) { QualType promotedType; bool canPerformLossyDemotionCheck = false; +BinOpInfo Ops = (createBinOpInfoFromIncDec(

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Bill Wendling via cfe-commits
@@ -4455,6 +4455,14 @@ void Sema::AddAlignValueAttr(Decl *D, const AttributeCommonInfo , Expr *E) { D->addAttr(::new (Context) AlignValueAttr(Context, CI, E)); } +static void handleWrapsAttr(Sema , Decl *D, const ParsedAttr ) { + S.AddWrapsAttr(D, AL); +} + +void

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Bill Wendling via cfe-commits
@@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple x86_64-pc-linux-gnu +// expected-no-diagnostics +typedef int __attribute__((wraps)) wrapping_int; + +void foo(void) { + const wrapping_int A = 1; + int D = 2147483647 + A; bwendling wrote:

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Bill Wendling via cfe-commits
@@ -4093,6 +4109,11 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo ) { op.RHS->getType()->isPointerTy()) return emitPointerArithmetic(CGF, op, CodeGenFunction::NotSubtraction); + if ((op.Ty->isSignedIntegerOrEnumerationType() || bwendling

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Bill Wendling via cfe-commits
@@ -156,6 +156,10 @@ struct BinOpInfo { } return false; } + + /// Does the BinaryOperator have the wraps attribute? + /// If so, we can ellide overflow sanitizer checks. bwendling wrote: s/ellide/elide/

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread David Blaikie via cfe-commits
@@ -3379,6 +3379,60 @@ Query for this feature with ``__has_builtin(__builtin_debugtrap)``. Query for this feature with ``__has_builtin(__builtin_trap)``. +``__builtin_verbose_trap`` dwblaikie wrote: Ah, OK - that seems like more reason the prefix should be

[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

2024-04-22 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm still not happy with the AST representation here. The current representation is likely to cause unpredictable results in edge cases, and compatibility constraints mean whatever result the current version happens to produce for those cases is locked in forever. And

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread David Blaikie via cfe-commits
@@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s + +#if !__has_builtin(__builtin_verbose_trap) +#error +#endif + +constexpr char const* constMsg1 = "hello"; +char const* const constMsg2 = "hello"; +char const constMsg3[] = "hello"; +

[clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-22 Thread Michael Kruse via cfe-commits
@@ -406,5 +426,13 @@ function(llvm_ExternalProject_Add name source_dir) WORKING_DIRECTORY ${BINARY_DIR} VERBATIM USES_TERMINAL) +if (ARG_FOLDER) + set_target_properties(${target} PROPERTIES FOLDER "${ARG_FOLDER}") +endif () endforeach() + +

[clang] [llvm] [AArch64] Add intrinsics for 16-bit non-widening FMLA/FMLS (PR #88553)

2024-04-22 Thread Hassnaa Hamdi via cfe-commits
@@ -458,6 +458,40 @@ let TargetGuard = "sme2,sme-f64f64" in { def SVMLS_LANE_VG1x4_F64 : Inst<"svmls_lane_za64[_{d}]_vg1x4", "vm4di", "d", MergeNone, "aarch64_sme_fmls_lane_vg1x4", [IsStreaming, IsInOutZA], [ImmCheck<3, ImmCheck0_1>]>; } +let TargetGuard =

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread Akira Hatanaka via cfe-commits
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile *CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent, return DBuilder.createTempMacroFile(Parent, Line, FName); } +llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor( ahatanaka wrote: OK, I'll make

[clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-22 Thread Michael Kruse via cfe-commits
@@ -56,11 +56,13 @@ endfunction() # Use provided strip tool instead of the default one. # TARGET_TRIPLE triple # Optional target triple to pass to the compiler +# FOLDER +# For IDEs, the Folder to put the targets into.= Meinersbur wrote: It's

[clang] Fix -fno-unsafe-math-optimizations behavior (PR #89473)

2024-04-22 Thread Andy Kaylor via cfe-commits
andykaylor wrote: I've made some minor changes to clean up the LIT test checks for this PR. I started to clean up the entire test, but it quickly became obvious that I should put that into a separate PR. I will submit a new PR to clean up the entire fast-math.c test. I have an idea that I

[clang] Fix -fno-unsafe-math-optimizations behavior (PR #89473)

2024-04-22 Thread Zahira Ammarguellat via cfe-commits
@@ -271,30 +271,32 @@ // RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s // RUN: %clang -### -funsafe-math-optimizations -fno-reciprocal-math -c %s \ -// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s +// RUN: 2>&1 | FileCheck

[clang] Fix -fno-unsafe-math-optimizations behavior (PR #89473)

2024-04-22 Thread Zahira Ammarguellat via cfe-commits
@@ -318,12 +320,12 @@ // RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ // RUN: -fno-trapping-math -ftrapping-math -c %s 2>&1 \ -// RUN: | FileCheck --check-prefix=CHECK-NO-REASSOC-NO-UNSAFE-MATH %s +// RUN: | FileCheck

[clang] [Clang] Improve testing for the flexible array member (PR #89462)

2024-04-22 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/89462 >From 2a6b3356a977132459bed84fb4e4add631e181cb Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Fri, 19 Apr 2024 15:06:34 -0700 Subject: [PATCH 1/2] [Clang][NFC] Improve testing for the flexible array

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread David Blaikie via cfe-commits
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile *CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent, return DBuilder.createTempMacroFile(Parent, Line, FName); } +llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor( dwblaikie wrote: I think I agree

[clang] Fix -fno-unsafe-math-optimizations behavior (PR #89473)

2024-04-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/89473 >From 100fc9dfb2b071877d758ce71bddeec693d986da Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 19 Apr 2024 16:35:00 -0700 Subject: [PATCH 1/2] Fix -fno-unsafe-math-optimizations behavior This changes

[clang] [llvm] [mlir] [OpenMP] Migrate GPU Reductions CodeGen from Clang to OMPIRBuilder (PR #80343)

2024-04-22 Thread via cfe-commits
shraiysh wrote: I see. Thanks for the reply. https://github.com/llvm/llvm-project/pull/80343 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/79230 >From 95200f3bb3859738981240a9d8c503a13ede9601 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Tue, 16 Jan 2024 13:18:09 -0800 Subject: [PATCH 01/12] Add support for builtin_verbose_trap The builtin causes

[clang] [C++23] [CLANG] Adding C++23 constexpr math functions: fmin and frexp. (PR #88978)

2024-04-22 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Zahira Ammarguellat (zahiraam) Changes Add support for for fmin and frexp. --- Full diff: https://github.com/llvm/llvm-project/pull/88978.diff 4 Files Affected: - (modified) clang/include/clang/Basic/Builtins.td (+2-2) - (modified)

[clang] [C++23] [CLANG] Adding C++23 constexpr math functions: fmin and frexp. (PR #88978)

2024-04-22 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam ready_for_review https://github.com/llvm/llvm-project/pull/88978 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++23] [CLANG] Adding C++23 constexpr math functions: fmin and frexp. (PR #88978)

2024-04-22 Thread Zahira Ammarguellat via cfe-commits
@@ -2922,7 +2922,7 @@ static bool handleFloatFloatBinOp(EvalInfo , const BinaryOperator *E, // If during the evaluation of an expression, the result is not // mathematically defined [...], the behavior is undefined. // FIXME: C++ rules require us to not conform to

[clang] [C++23] [CLANG] Adding C++23 constexpr math functions: fmin and frexp. (PR #88978)

2024-04-22 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/88978 >From 3acc848f4fcc68445dfc849f9c6f8d384d3692af Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Tue, 16 Apr 2024 13:09:58 -0700 Subject: [PATCH 1/2] Adding C23 constexpr math functions fmin and frexp.

[clang] [clang] fix half && bfloat16 convert node expr codegen (PR #89051)

2024-04-22 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Looks like automation didn't trigger, but: > ⚠️ We detected that you are using a GitHub private e-mail address to > contribute to the repo. > Please turn off [Keep my email addresses > private](https://github.com/settings/emails) setting in your account. > See [LLVM >

  1   2   3   4   5   >