[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,81 @@ +//===--- AvoidBoundsErrorsCheck.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-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,81 @@ +//===--- AvoidBoundsErrorsCheck.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-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,20 @@ +.. title:: clang-tidy - cppcoreguidelines-avoid-bounds-errors + +cppcoreguidelines-avoid-bounds-errors += + +This check enforces the `SL.con.3

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/90043 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,32 @@ +//===--- AvoidBoundsErrorsCheck.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] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,81 @@ +//===--- AvoidBoundsErrorsCheck.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-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL requested changes to this pull request. Idea is fine, implementation is lacking critical parts. Please check comments, fix them. If you will have some questions, just ask. https://github.com/llvm/llvm-project/pull/90043 ___

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread via cfe-commits
cor3ntin wrote: > Please note: the guidelines do not require one to replace [] with at(), > that's just one of the possible solutions. Actually at() is banned in many > codebases where exceptions are banned. > > It would be good to make this fix-it opt-in, configurable via option, so the >

[clang] [llvm] [clang][SPIR-V] Add support for AMDGCN flavoured SPIRV (PR #89796)

2024-04-25 Thread Alex Voicu via cfe-commits
@@ -0,0 +1,294 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -triple spirv64-amd-amdhsa -x hip \ +// RUN: -aux-triple x86_64-unknown-linux-gnu -fcuda-is-device -emit-llvm %s \ +// RUN: -o - | FileCheck %s + +// RUN:

[clang] [Driver] Restore compiler-rt arch suffix for PS and Windows (PR #89775)

2024-04-25 Thread Tobias Hieta via cfe-commits
tru wrote: I think I suggested that we should make the CMake variable change the driver behaviour to reflect the setting in order to remove unexpected fallbacks and that the vendor could select the layout. I still think that's probably the better solution.

[clang] [Driver] Restore compiler-rt arch suffix for PS and Windows (PR #89775)

2024-04-25 Thread Tobias Hieta via cfe-commits
tru wrote: > > LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on > > > > I'm unable to find what code this affects. I don't see it mentioned anywhere > in clang/lib or clang/include. > > > > It does seem like it should control the behavior of > `ToolChain::getCompilerRT`; where I had added the

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

2024-04-25 Thread via cfe-commits
dyung wrote: Hi, we have an internal test that checks that compiling with and without optnone at O0 does not change the code generated by the compiler, and one of the tests we have did change which I bisected back to your change. The test consists of the following code: ```c++ #include

[clang] [llvm] [clang][hlsl][dxil][spirv][x86] Add tan intrinsic (PR #90088)

2024-04-25 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/90088 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Add initial LIT tests (PR #87989)

2024-04-25 Thread Fraser Cormack via cfe-commits
@@ -1,3 +1,6 @@ -__kernel void foo(int *i) { +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s frasercrmck wrote: That's true, but I'm still sceptical that we can make the tests simple enough for `update_cc_test_checks` to be viable. We'd have to embed

[clang] [llvm] [clang][hlsl][dxil][spirv][x86] Add tan intrinsic (PR #90088)

2024-04-25 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl created https://github.com/llvm/llvm-project/pull/90088 This change is an implementation of #87367's investigation on supporting IEEE math operations as intrinsics. Which was discussed in this RFC: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 All

[clang] [Clang] Implement C++26 P2748R5 "Disallow Binding a Returned Glvalue to a Temporary" (PR #89942)

2024-04-25 Thread via cfe-commits
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const InitializedEntity , << Entity.getType()->isReferenceType() << CLE->getInitializer() << 2 << DiagRange; } else { -Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref) -

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-04-25 Thread Nicolas van Kempen via cfe-commits
nicovank wrote: @PiotrZSL @carlosgalvezp Any thoughts on this change? https://github.com/llvm/llvm-project/pull/89490 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [RISCV] Add generic CPUs for profiles (PR #84877)

2024-04-25 Thread Pengcheng Wang via cfe-commits
wangpc-pp wrote: > Do you see any disadvantage to going back to adding a feature for the > profiles? Of course not, I will revise this patch tomorrow. Thanks for discussing this! (I missed the sync-up meeting because I forgot the daylight saving...)

[clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-04-25 Thread Saleem Abdulrasool via cfe-commits
compnerd wrote: > changes to `clang/test/CXX/lex/lex.literal/lex.string/p4.cpp` should be > reverted (it's a CRLF related test) This is the type of problems that I am concerned about. We certainly have some tests which are line-ending sensitive, and each test should be audited before we make

[clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-04-25 Thread Saleem Abdulrasool via cfe-commits
compnerd wrote: > @compnerd I just realised I didn't respond to your concern. Apologies. > > > I think that the concern that I have is that do we have sufficient testing > > for supporting line-ending dependent behaviour in the compiler? > > For the first part: I don't know that it matters,

[clang] [llvm] [RISCV] Teach .option arch to support experimental extensions. (PR #89727)

2024-04-25 Thread Yeting Kuo via cfe-commits
yetingk wrote: > Does this disable use of experimental extensions for a `.option arch` in an > inline assembly block without -menable-experimental-extensions. No. my patch could not block the case. I will try to think this problem after my sleep.

[clang] [llvm] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-25 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/87578 >From 3960050439964fe3c0536696490b284a6c470cd1 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 3 Apr 2024 13:15:59 -0700 Subject: [PATCH 01/11] implement binding type error for t/cbuffers and

[clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-04-25 Thread via cfe-commits
cor3ntin wrote: changes to `clang/test/CXX/lex/lex.literal/lex.string/p4.cpp` should be reverted (it's a CRLF related test) https://github.com/llvm/llvm-project/pull/86318 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Add test for CWG2149 "Brace elision and array length deduction" (PR #90079)

2024-04-25 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: >Can you add examples 14, 16, 17, 18 of the paper? I'll add them to conformance test suite in a subsequent PR. They don't belong here, as the issue is about deducing array length from brace initializer, but the examples you're listing are focusing on various aspects of how

[clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-04-25 Thread via cfe-commits
ldrumm wrote: > I'll add a comment to the testing infrastructure page to be mindful of how > line endings are storedand link to the .gitattributes documentation. Does > that sound enough? Added

[clang] [clang] Add test for CWG2149 "Brace elision and array length deduction" (PR #90079)

2024-04-25 Thread via cfe-commits
cor3ntin wrote: Can you add examples 14, 16, 17, 18 of the paper? I'd be if they are only tested in C++11+ modes Then we can mark the paper as implemented (bonus point for finding the oldest conforming version) https://github.com/llvm/llvm-project/pull/90079

[clang] [llvm] [RISCV] Add generic CPUs for profiles (PR #84877)

2024-04-25 Thread Alex Bradbury via cfe-commits
asb wrote: We discussed again in the sync-up call to try to move this forwards and per a discussion with @topperc and @preames were wondering if relying on -mattr and a corresponding feature for the profile might be the better approach after all. * There's not a lot of instances of this, but I

[clang] 1837681 - [Driver] Don't default to -mrelax-all for non-RISCV -O0

2024-04-25 Thread via cfe-commits
Author: Fangrui Song Date: 2024-04-25T09:27:55-07:00 New Revision: 18376810f359dbd39d2a0aa0ddfc0f7f50eac199 URL: https://github.com/llvm/llvm-project/commit/18376810f359dbd39d2a0aa0ddfc0f7f50eac199 DIFF: https://github.com/llvm/llvm-project/commit/18376810f359dbd39d2a0aa0ddfc0f7f50eac199.diff

[clang] [Driver] Don't default to -mrelax-all for non-RISCV -O0 (PR #90013)

2024-04-25 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay closed https://github.com/llvm/llvm-project/pull/90013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add test for CWG2149 "Brace elision and array length deduction" (PR #90079)

2024-04-25 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: Status of 2149 changed just yesterday to say DR per 2024 Tokyo straw poll. That's where the discrepancy between official `cwg_index.html` and CWG GitHub repo comes (that I link in the description). https://github.com/llvm/llvm-project/pull/90079

[clang] [Driver] Don't default to -mrelax-all for non-RISCV -O0 (PR #90013)

2024-04-25 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/90013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Don't default to -mrelax-all for non-RISCV -O0 (PR #90013)

2024-04-25 Thread Fangrui Song via cfe-commits
MaskRay wrote: `createAMDGPUELFStreamer` ignores `RelaxAll`, so this appears to be x86-only. There may be some clean-up opportunities. https://github.com/llvm/llvm-project/pull/90013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Driver] Don't default to -mrelax-all for non-RISCV -O0 (PR #90013)

2024-04-25 Thread Fangrui Song via cfe-commits
MaskRay wrote: > .text > b dest// b.n 2-byte branch > b dest2 // b.w 4-byte branch > nop > dest: > nop > .space 2048 > dest2: > nop Thanks for checking. Confirmed no impact to ARM because

[clang] [clang] Add test for CWG2149 "Brace elision and array length deduction" (PR #90079)

2024-04-25 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Vlad Serebrennikov (Endilll) Changes This patch adds test for [CWG2149](https://cplusplus.github.io/CWG/issues/2149.html), following [P3106R1](https://wg21.link/p3106R1) "Clarifying rules for brace elision in aggregate initialization"

[clang] [clang] Add test for CWG2149 "Brace elision and array length deduction" (PR #90079)

2024-04-25 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/90079 This patch adds test for [CWG2149](https://cplusplus.github.io/CWG/issues/2149.html), following [P3106R1](https://wg21.link/p3106R1) "Clarifying rules for brace elision in aggregate initialization" and a

[clang] [clang][analyzer] Fix alpha.unix.BlockInCriticalSection for CTU (PR #90030)

2024-04-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. > In CTU there is not always an AnalysisDeclContext for a given call. Why? Could you demonstrate the fix in a test? https://github.com/llvm/llvm-project/pull/90030 ___ cfe-commits

[clang-tools-extra] [clang-tidy] Enable C23 support in modernize-use-nullptr (PR #89990)

2024-04-25 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. https://github.com/llvm/llvm-project/pull/89990 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Enable C23 support in modernize-use-nullptr (PR #89990)

2024-04-25 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. https://github.com/llvm/llvm-project/pull/89990 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-04-25 Thread via cfe-commits
ldrumm wrote: @compnerd I just realised I didn't respond to your concern. Apologies. > I think that the concern that I have is that do we have sufficient testing > for supporting line-ending dependent behaviour in the compiler? For the first part: I don't know that it matters, since this

[clang] [Driver] Restore compiler-rt arch suffix for PS and Windows (PR #89775)

2024-04-25 Thread Nico Weber via cfe-commits
nico wrote: > Again, clangDriver does file probing in various places. This is the only place where we probe link-time inputs for compile-time decisions as far as I know. https://github.com/llvm/llvm-project/pull/89775 ___ cfe-commits mailing list

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: Please note: the guidelines do not require one to replace [] with at(), that's just one of the possible solutions. Actually at() is banned in many codebases where exceptions are banned. It would be good to make this fix-it opt-in, configurable via option, so the check

[clang] [Clang] Implement C++26 Attributes for Structured Bindings (P0609R3) (PR #89906)

2024-04-25 Thread via cfe-commits
@@ -102,11 +102,21 @@ namespace PR33839 { for (auto [x] : a) { // expected-warning {{unused variable '[x]'}} } } - void use() { + void use() { f(); // expected-note {{instantiation of}} g(); g(); h(); // expected-note {{instantiation of}} }

[clang] [Clang] Implement C++26 P2748R5 "Disallow Binding a Returned Glvalue to a Temporary" (PR #89942)

2024-04-25 Thread via cfe-commits
https://github.com/yronglin edited https://github.com/llvm/llvm-project/pull/89942 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement C++26 P2748R5 "Disallow Binding a Returned Glvalue to a Temporary" (PR #89942)

2024-04-25 Thread via cfe-commits
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const InitializedEntity , << Entity.getType()->isReferenceType() << CLE->getInitializer() << 2 << DiagRange; } else { -Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref) -

[clang] [Driver] Restore compiler-rt arch suffix for PS and Windows (PR #89775)

2024-04-25 Thread Paul T Robinson via cfe-commits
pogo59 wrote: > LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on I'm unable to find what code this affects. I don't see it mentioned anywhere in clang/lib or clang/include. It does seem like it should control the behavior of `ToolChain::getCompilerRT`; where I had added the Windows/PS check, seems

[clang] [Clang] Implement C++26 Attributes for Structured Bindings (P0609R3) (PR #89906)

2024-04-25 Thread via cfe-commits
@@ -102,11 +102,21 @@ namespace PR33839 { for (auto [x] : a) { // expected-warning {{unused variable '[x]'}} } } - void use() { + void use() { f(); // expected-note {{instantiation of}} g(); g(); h(); // expected-note {{instantiation of}} }

[clang] [Clang] Implement C++26 Attributes for Structured Bindings (P0609R3) (PR #89906)

2024-04-25 Thread via cfe-commits
https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/89906 >From e87546f2bc0c7d213b6c1f2b414e0ce5335b3e47 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Wed, 24 Apr 2024 11:53:28 +0200 Subject: [PATCH 1/2] [Clang] Implement C++26 Attributes for Structured

[clang] [Clang] Implement C++26 P2748R5 "Disallow Binding a Returned Glvalue to a Temporary" (PR #89942)

2024-04-25 Thread via cfe-commits
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const InitializedEntity , << Entity.getType()->isReferenceType() << CLE->getInitializer() << 2 << DiagRange; } else { -Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref) -

[clang] [Clang] Implement C++26 P2748R5 "Disallow Binding a Returned Glvalue to a Temporary" (PR #89942)

2024-04-25 Thread via cfe-commits
@@ -9950,6 +9950,8 @@ def warn_ret_stack_addr_ref : Warning< def warn_ret_local_temp_addr_ref : Warning< "returning %select{address of|reference to}0 local temporary object">, InGroup; +def err_ret_local_temp_addr_ref : Error< + "returning %select{address of|reference

[clang] [llvm] [coro] Lower `llvm.coro.await.suspend.handle` to resume with tail call (PR #89751)

2024-04-25 Thread Mircea Trofin via cfe-commits
@@ -1056,6 +1083,25 @@ void CoroCloner::create() { // Set up the new entry block. replaceEntryBlock(); + // Turn symmetric transfers into musttail calls. + for (CallInst *ResumeCall : Shape.SymmetricTransfers) { +ResumeCall = cast(VMap[ResumeCall]); +

[clang] [llvm] [RISCV] Teach .option arch to support experimental extensions. (PR #89727)

2024-04-25 Thread Craig Topper via cfe-commits
topperc wrote: Does this disable use of experimental extensions for a `.option arch` in an inline assembly block? https://github.com/llvm/llvm-project/pull/89727 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-25 Thread via cfe-commits
@@ -131,6 +131,8 @@ C++2c Feature Support - Implemented `P2573R2: = delete("should have a reason"); `_ +- Implemented `P2573R2: = delete("should have a reason"); `_ cor3ntin wrote: Good question!

[clang] Delete old broken lit wrapper (PR #90067)

2024-04-25 Thread via cfe-commits
https://github.com/ldrumm closed https://github.com/llvm/llvm-project/pull/90067 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Delete old broken lit wrapper (PR #90067)

2024-04-25 Thread via cfe-commits
ldrumm wrote: ``` d3f92e30bbd5..d285e54320e9 main -> main https://github.com/llvm/llvm-project/pull/90067 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] d285e54 - Delete old broken lit runner

2024-04-25 Thread Luke Drummond via cfe-commits
Author: Luke Drummond Date: 2024-04-25T16:06:34+01:00 New Revision: d285e54320e9bc42ea91b28a59a831c58627217a URL: https://github.com/llvm/llvm-project/commit/d285e54320e9bc42ea91b28a59a831c58627217a DIFF: https://github.com/llvm/llvm-project/commit/d285e54320e9bc42ea91b28a59a831c58627217a.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-25 Thread via cfe-commits
github-actions[bot] wrote: @sopyb Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with a build,

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

2024-04-25 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL closed 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] d3f92e3 - [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (#85572)

2024-04-25 Thread via cfe-commits
Author: Sopy Date: 2024-04-25T17:02:45+02:00 New Revision: d3f92e30bbd5c295a639f207b9ac92198d538fb3 URL: https://github.com/llvm/llvm-project/commit/d3f92e30bbd5c295a639f207b9ac92198d538fb3 DIFF: https://github.com/llvm/llvm-project/commit/d3f92e30bbd5c295a639f207b9ac92198d538fb3.diff LOG:

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-25 Thread Erich Keane via cfe-commits
@@ -131,6 +131,8 @@ C++2c Feature Support - Implemented `P2573R2: = delete("should have a reason"); `_ +- Implemented `P2573R2: = delete("should have a reason"); `_ erichkeane wrote: What is going on

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-25 Thread Erich Keane via cfe-commits
@@ -908,6 +908,73 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool IsTrivialCXXLoop) { + if

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-25 Thread Erich Keane via cfe-commits
@@ -908,6 +908,73 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool IsTrivialCXXLoop) { + if

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-25 Thread Erich Keane via cfe-commits
@@ -908,6 +908,73 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool IsTrivialCXXLoop) { + if

[clang] Delete old broken lit wrapper (PR #90067)

2024-04-25 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (ldrumm) Changes Last updated before the monorepo was created[1], this lit wrapper can no longer work. Since it's been broken for so long, I don't think anyone's going to miss it. [1] 22d5360ed04e69: Does people use this? --- Full

[clang] [clang][NFC] Reformat suspicious condition (PR #89923)

2024-04-25 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 9cbf96ad5b6fe777bf5acd43b65abfb062381f8c db61b6d6e2c5ff75ffcf43874bfed60243e4e671 --

[clang] Delete old broken lit wrapper (PR #90067)

2024-04-25 Thread via cfe-commits
https://github.com/ldrumm created https://github.com/llvm/llvm-project/pull/90067 Last updated before the monorepo was created[1], this lit wrapper can no longer work. Since it's been broken for so long, I don't think anyone's going to miss it. [1] 22d5360ed04e69: Does people use this?

[clang] [clang][NFC] Reformat suspicious condition (PR #89923)

2024-04-25 Thread Troy Butler via cfe-commits
https://github.com/Troy-Butler updated https://github.com/llvm/llvm-project/pull/89923 >From cde48906d4b9a08dc436ab94f183c124ee336e5a Mon Sep 17 00:00:00 2001 From: Troy-Butler Date: Wed, 24 Apr 2024 09:23:29 -0400 Subject: [PATCH 1/3] [clang][Lex] Reformat suspicious condition Signed-off-by:

[clang] [clang][NFC] Reformat suspicious condition (PR #89923)

2024-04-25 Thread Troy Butler via cfe-commits
https://github.com/Troy-Butler updated https://github.com/llvm/llvm-project/pull/89923 >From cde48906d4b9a08dc436ab94f183c124ee336e5a Mon Sep 17 00:00:00 2001 From: Troy-Butler Date: Wed, 24 Apr 2024 09:23:29 -0400 Subject: [PATCH 1/2] [clang][Lex] Reformat suspicious condition Signed-off-by:

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-25 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: cor3ntin (cor3ntin) Changes https://wg21.link/P2809R3 This is applied as a DR to C++11 (C++98 did not guarantee forward progress and is left untouched) As an extension (and to preserve existing behavior in C), we consider all

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-25 Thread via cfe-commits
https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/90066 https://wg21.link/P2809R3 This is applied as a DR to C++11 (C++98 did not guarantee forward progress and is left untouched) As an extension (and to preserve existing behavior in C), we consider all

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Egor Zhdan (egorzhdan) Changes Certain C++ types, such as `std::chrono::tzdb` in libstdc++, are non-copyable, but don't explicitly delete their copy constructor. Instead, they trigger template instantiation errors when trying to call

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan ready_for_review https://github.com/llvm/llvm-project/pull/90064 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
@@ -1146,6 +1146,12 @@ class TagTableInfo : public CommonTypeTableInfo { writer.write(Flags); +if (auto Copyable = TI.isSwiftCopyable()) { egorzhdan wrote: Fixed https://github.com/llvm/llvm-project/pull/90064

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
@@ -527,6 +527,13 @@ class TagTableInfo Info.EnumExtensibility = static_cast((Payload & 0x3) - 1); +uint8_t Copyable = +endian::readNext(Data); +if (Copyable == 1) + Info.setSwiftCopyable(std::optional(false)); +else if (Copyable == 2)

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/90064 >From f0394cfaf4df3881809fdce7882bda3006951805 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Thu, 25 Apr 2024 15:19:09 +0100 Subject: [PATCH] [APINotes] Allow annotating a C++ type as non-copyable in Swift

[clang] [Clang] Implement C++26 Attributes for Structured Bindings (P0609R3) (PR #89906)

2024-04-25 Thread via cfe-commits
@@ -102,11 +102,21 @@ namespace PR33839 { for (auto [x] : a) { // expected-warning {{unused variable '[x]'}} } } - void use() { + void use() { f(); // expected-note {{instantiation of}} g(); g(); h(); // expected-note {{instantiation of}} }

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
@@ -1125,10 +1125,10 @@ class CommonTypeTableInfo class TagTableInfo : public CommonTypeTableInfo { public: unsigned getUnversionedInfoSize(const TagInfo ) { -return 2 + (TI.SwiftImportAs ? TI.SwiftImportAs->size() : 0) + - 2 + (TI.SwiftRetainOp ?

[clang] [Clang] Implement C++26 Attributes for Structured Bindings (P0609R3) (PR #89906)

2024-04-25 Thread via cfe-commits
@@ -102,11 +102,21 @@ namespace PR33839 { for (auto [x] : a) { // expected-warning {{unused variable '[x]'}} } } - void use() { + void use() { f(); // expected-note {{instantiation of}} g(); g(); h(); // expected-note {{instantiation of}} }

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-25 Thread Alexandre Ganea via cfe-commits
https://github.com/aganea closed https://github.com/llvm/llvm-project/pull/88427 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 39ed3c6 - [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (#88427)

2024-04-25 Thread via cfe-commits
Author: Alexandre Ganea Date: 2024-04-25T10:31:45-04:00 New Revision: 39ed3c68e51f1b04fe2890db9006ae1b176b1582 URL: https://github.com/llvm/llvm-project/commit/39ed3c68e51f1b04fe2890db9006ae1b176b1582 DIFF:

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Saleem Abdulrasool via cfe-commits
@@ -1146,6 +1146,12 @@ class TagTableInfo : public CommonTypeTableInfo { writer.write(Flags); +if (auto Copyable = TI.isSwiftCopyable()) { compnerd wrote: Unnecessary braces and we should be able to use the named constants here.

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Saleem Abdulrasool via cfe-commits
https://github.com/compnerd approved this pull request. https://github.com/llvm/llvm-project/pull/90064 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Saleem Abdulrasool via cfe-commits
@@ -1125,10 +1125,10 @@ class CommonTypeTableInfo class TagTableInfo : public CommonTypeTableInfo { public: unsigned getUnversionedInfoSize(const TagInfo ) { -return 2 + (TI.SwiftImportAs ? TI.SwiftImportAs->size() : 0) + - 2 + (TI.SwiftRetainOp ?

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Saleem Abdulrasool via cfe-commits
@@ -527,6 +527,13 @@ class TagTableInfo Info.EnumExtensibility = static_cast((Payload & 0x3) - 1); +uint8_t Copyable = +endian::readNext(Data); +if (Copyable == 1) + Info.setSwiftCopyable(std::optional(false)); +else if (Copyable == 2)

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Saleem Abdulrasool via cfe-commits
https://github.com/compnerd edited https://github.com/llvm/llvm-project/pull/90064 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/90064 >From 9eac3a34aa9c48e1ddc715ca04c4380f1d78a876 Mon Sep 17 00:00:00 2001 From: Egor Zhdan Date: Thu, 25 Apr 2024 15:19:09 +0100 Subject: [PATCH] [APINotes] Allow annotating a C++ type as non-copyable in Swift

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 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 697fcd009855a579f756dfe34498a815ed9dc3fd a3ea8c954f3446330314f4b5d1ea42d87761b1c4 --

[clang] [APINotes] Allow annotating a C++ type as non-copyable in Swift (PR #90064)

2024-04-25 Thread Egor Zhdan via cfe-commits
https://github.com/egorzhdan created https://github.com/llvm/llvm-project/pull/90064 Certain C++ types, such as `std::chrono::tzdb` in libstdc++, are non-copyable, but don't explicitly delete their copy constructor. Instead, they trigger template instantiation errors when trying to call their

[clang] [Clang] Implement C++26 Attributes for Structured Bindings (P0609R3) (PR #89906)

2024-04-25 Thread via cfe-commits
@@ -102,11 +102,21 @@ namespace PR33839 { for (auto [x] : a) { // expected-warning {{unused variable '[x]'}} } } - void use() { + void use() { f(); // expected-note {{instantiation of}} g(); g(); h(); // expected-note {{instantiation of}} }

[clang] [clang-tools-extra] [libcxx] [C++17] Support __GCC_[CON|DE]STRUCTIVE_SIZE (PR #89446)

2024-04-25 Thread Louis Dionne via cfe-commits
ldionne wrote: > > I'd rather keep the libc++ tests green while landing this PR. I tried > > something out, let's see if that works. > > It looks like some further adjustments may be needed as some stage1 builders > are failing: > > ``` > [...] > ``` Ah, yes, we're using the nightly clang

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread via cfe-commits
@@ -0,0 +1,20 @@ +.. title:: clang-tidy - cppcoreguidelines-avoid-bounds-errors + +cppcoreguidelines-avoid-bounds-errors += + +This check enforces the `SL.con.3

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread via cfe-commits
@@ -131,6 +131,11 @@ New checks to reading out-of-bounds data due to inadequate or incorrect string null termination. +- New :doc:`cppcoreguidelines-avoid-bounds-errors + ` check. + + Flags the unsafe `operator[]` and replaces it with `at()`.

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread via cfe-commits
@@ -0,0 +1,81 @@ +//===--- AvoidBoundsErrorsCheck.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-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread via cfe-commits
@@ -0,0 +1,32 @@ +//===--- AvoidBoundsErrorsCheck.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] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread via cfe-commits
@@ -0,0 +1,81 @@ +//===--- AvoidBoundsErrorsCheck.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-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread via cfe-commits
@@ -0,0 +1,81 @@ +//===--- AvoidBoundsErrorsCheck.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-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() (PR #90043)

2024-04-25 Thread via cfe-commits
@@ -0,0 +1,81 @@ +//===--- AvoidBoundsErrorsCheck.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-tools-extra] [clang-tidy] Enable C23 support in modernize-use-nullptr (PR #89990)

2024-04-25 Thread via cfe-commits
@@ -269,6 +269,10 @@ Changes in existing checks don't remove parentheses used in ``sizeof`` calls when they have array index accesses as arguments. +- Improved :doc:`modernize-use-nullptr + ` check to include support for + ``C23``, which also has introduced the

[clang] [Clang] Implement C++26 Attributes for Structured Bindings (P0609R3) (PR #89906)

2024-04-25 Thread Erich Keane via cfe-commits
@@ -102,11 +102,21 @@ namespace PR33839 { for (auto [x] : a) { // expected-warning {{unused variable '[x]'}} } } - void use() { + void use() { f(); // expected-note {{instantiation of}} g(); g(); h(); // expected-note {{instantiation of}} }

[clang] [flang] [lld] [flang] Generate main only when a Fortran program statement is present (PR #89938)

2024-04-25 Thread Kelvin Li via cfe-commits
kkwli wrote: This change will also break backward compatibility that the old object file that contain `main` can no longer use the new compiler to link with other objects. I think we can put a warning in the release note or something like that to warn users.

[clang] [Clang] Implement C++26 Attributes for Structured Bindings (P0609R3) (PR #89906)

2024-04-25 Thread Erich Keane via cfe-commits
erichkeane wrote: > > Thank you working on this. I'm really like this feature! I've a question, > > do we have any further plans to support GNU extension attributes(e.g. > > **attribute**((aligned)))? Although it is not included in the paper. > > No, sorry! > > My goal here is to increase

<    1   2   3   4   >