[clang] [flang] [llvm] [InstCombine] Canonicalize constant GEPs to i8 source element type (PR #68882)

2024-05-14 Thread Nikita Popov via cfe-commits
nikic wrote: @sgundapa Hm, I think the problem may be that while https://github.com/llvm/llvm-project/pull/90802 removes the limitation on the element types, it's still limited to single-index GEPs, while here there are multiple indices. (Assuming this is related to swapping the GEPs at all,

[clang] [clang] Store FPOptions earlier when parsing function (PR #92146)

2024-05-14 Thread Serge Pavlov via cfe-commits
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-pch -DHEADER -x c++-header %s -o %t.pch +// RUN: %clang_cc1 -emit-llvm -include-pch %t.pch %s -o /dev/null + +#ifdef HEADER +__attribute__((optnone)) void foo() {} +#endif spavloff wrote: It is to avoid redefinition

[clang] [llvm] [AArch64] Support preserve_none calling convention (PR #91046)

2024-05-14 Thread via cfe-commits
antangelo wrote: Friendly ping https://github.com/llvm/llvm-project/pull/91046 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Store FPOptions earlier when parsing function (PR #92146)

2024-05-14 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/92146 >From 4f6f0acb47d21b25e4e86733a81d609f4de7dc3c Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Tue, 14 May 2024 23:11:21 +0700 Subject: [PATCH 1/2] [clang] Store FPOptions earlier when parsing function After

[clang] [Serialization] Read the initializer for interesting static variables before consuming it (PR #92218)

2024-05-14 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-modules Author: Chuanqi Xu (ChuanqiXu9) Changes Close https://github.com/llvm/llvm-project/issues/91418 Since we load the variable's initializers lazily, it'd be problematic if the initializers dependent on each other. So here we try to load the

[clang] [Serialization] Read the initializer for interesting static variables before consuming it (PR #92218)

2024-05-14 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 created https://github.com/llvm/llvm-project/pull/92218 Close https://github.com/llvm/llvm-project/issues/91418 Since we load the variable's initializers lazily, it'd be problematic if the initializers dependent on each other. So here we try to load the

[clang] [analyzer] Treat break, continue, goto, and label statements as trivial in WebKit checkers. (PR #91873)

2024-05-14 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/91873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 24180ea - [analyzer] Treat break, continue, goto, and label statements as trivial in WebKit checkers. (#91873)

2024-05-14 Thread via cfe-commits
Author: Ryosuke Niwa Date: 2024-05-14T22:16:06-07:00 New Revision: 24180ea0c295856a696992f072c36259a266226b URL: https://github.com/llvm/llvm-project/commit/24180ea0c295856a696992f072c36259a266226b DIFF: https://github.com/llvm/llvm-project/commit/24180ea0c295856a696992f072c36259a266226b.diff

[clang] [analyzer] Treat break, continue, goto, and label statements as trivial in WebKit checkers. (PR #91873)

2024-05-14 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/91873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Treat break, continue, goto, and label statements as trivial in WebKit checkers. (PR #91873)

2024-05-14 Thread Ryosuke Niwa via cfe-commits
@@ -445,6 +456,10 @@ class TrivialFunctionAnalysisVisitor return Visit(VMT->getSubExpr()); } + bool VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr* BTE) { +return Visit(BTE->getSubExpr()); rniwa wrote: Oh! I guess we need to do that in

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

2024-05-14 Thread Eli Friedman via cfe-commits
@@ -1052,6 +1053,165 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; +

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

2024-05-14 Thread Eli Friedman via cfe-commits
@@ -1052,6 +1053,165 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; +

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

2024-05-14 Thread Eli Friedman via cfe-commits
@@ -1052,6 +1053,165 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; +

[clang] [clang-format] Don't always break before << between string literals (PR #92214)

2024-05-14 Thread Owen Pan via cfe-commits
owenca wrote: See also the discussion in https://reviews.llvm.org/D80950. https://github.com/llvm/llvm-project/pull/92214 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [OpenMP] Fix runtime problem when explicit map both pointer and pointee. (PR #92210)

2024-05-14 Thread via cfe-commits
https://github.com/jyu2-git updated https://github.com/llvm/llvm-project/pull/92210 >From 6afac123ae1a548a788d05bbf0a8add74f5e0cdc Mon Sep 17 00:00:00 2001 From: Jennifer Yu Date: Tue, 14 May 2024 17:31:56 -0700 Subject: [PATCH 1/2] [OpenMP] Fix runtime problem when explicit map both pointer

[clang] [clang-format] Don't always break before << between string literals (PR #92214)

2024-05-14 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-format Author: Owen Pan (owenca) Changes Instead, leave the line wrapping as is. Fixes #43887. Fixes #44363. --- Full diff: https://github.com/llvm/llvm-project/pull/92214.diff 2 Files Affected: - (modified)

[clang] [clang-format] Don't always break before << between string literals (PR #92214)

2024-05-14 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/92214 Instead, leave the line wrapping as is. Fixes #43887. Fixes #44363. >From 40eeb958cef55465fdcee66ab385928c1f202e50 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 14 May 2024 19:14:15 -0700 Subject: [PATCH]

[clang] 72b2c37 - [clang-format][NFC] Clean up TokenAnnotator::mustBreakBefore()

2024-05-14 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-05-14T20:31:53-07:00 New Revision: 72b2c37de6a4bbc2b2d2cda49293684b7cc71508 URL: https://github.com/llvm/llvm-project/commit/72b2c37de6a4bbc2b2d2cda49293684b7cc71508 DIFF: https://github.com/llvm/llvm-project/commit/72b2c37de6a4bbc2b2d2cda49293684b7cc71508.diff

[clang] [llvm] [OpenMP] Fix runtime problem when explicit map both pointer and pointee. (PR #92210)

2024-05-14 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 23f8fac745bdde70ed4f9c585d19c4913734f1b8 6afac123ae1a548a788d05bbf0a8add74f5e0cdc --

[clang] [llvm] [OpenMP] Fix runtime problem when explicit map both pointer and pointee. (PR #92210)

2024-05-14 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (jyu2-git) Changes For ponter int *p for following map, test currently crash. map(p, p[:100]) or map(p, p[1]) Currly IR looks like // p, p, sizeof(int), TARGET_PARAM | TO | FROM // p, p[0], 100sizeof(float) TO | FROM Worrking IR

[clang] [llvm] [OpenMP] Fix runtime problem when explicit map both pointer and pointee. (PR #92210)

2024-05-14 Thread via cfe-commits
https://github.com/jyu2-git created https://github.com/llvm/llvm-project/pull/92210 For ponter int *p for following map, test currently crash. map(p, p[:100]) or map(p, p[1]) Currly IR looks like // , , sizeof(int), TARGET_PARAM | TO | FROM // , p[0], 100sizeof(float) TO | FROM Worrking IR

[clang-tools-extra] [clang-tidy] Fix crash in modernize-use-constraints (PR #92019)

2024-05-14 Thread Chris Cotter via cfe-commits
https://github.com/ccotter approved this pull request. https://github.com/llvm/llvm-project/pull/92019 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] eb10310 - Revert "[Serialization] Read the initializer for interesting static variables before consuming it"

2024-05-14 Thread Mehdi Amini via cfe-commits
Author: Mehdi Amini Date: 2024-05-14T19:53:38-07:00 New Revision: eb103104ef08ebc2d0de63db0592e76b294cf8bb URL: https://github.com/llvm/llvm-project/commit/eb103104ef08ebc2d0de63db0592e76b294cf8bb DIFF: https://github.com/llvm/llvm-project/commit/eb103104ef08ebc2d0de63db0592e76b294cf8bb.diff

[clang] [analyzer] Treat break, continue, goto, and label statements as trivial in WebKit checkers. (PR #91873)

2024-05-14 Thread Artem Dergachev via cfe-commits
@@ -445,6 +456,10 @@ class TrivialFunctionAnalysisVisitor return Visit(VMT->getSubExpr()); } + bool VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr* BTE) { +return Visit(BTE->getSubExpr()); haoNoQ wrote: Which reminds me, I think we're also

[clang] [analyzer] Treat break, continue, goto, and label statements as trivial in WebKit checkers. (PR #91873)

2024-05-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/91873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Treat break, continue, goto, and label statements as trivial in WebKit checkers. (PR #91873)

2024-05-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. Aha great LGTM! https://github.com/llvm/llvm-project/pull/91873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for field and constructor initializers (PR #91991)

2024-05-14 Thread Artem Dergachev via cfe-commits
@@ -3328,3 +3300,63 @@ void clang::checkUnsafeBufferUsage(const Decl *D, } } } + +void clang::checkUnsafeBufferUsage(const Decl *D, + UnsafeBufferUsageHandler , + bool EmitSuggestions) { +#ifndef NDEBUG

[clang] HLSL availability diagnostics design doc (PR #92207)

2024-05-14 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/92207 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] HLSL availability diagnostics documentation (PR #92207)

2024-05-14 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-hlsl Author: Helena Kotas (hekota) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/92207.diff 2 Files Affected: - (added) clang/docs/HLSL/AvailabilityDiagnostics.rst (+53) - (modified) clang/docs/HLSL/HLSLDocs.rst (+1)

[clang] HLSL availability diagnostics documentation (PR #92207)

2024-05-14 Thread Helena Kotas via cfe-commits
https://github.com/hekota created https://github.com/llvm/llvm-project/pull/92207 None >From 3df0ba0fd2171a0115427bc6ba5e3f8e84831747 Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Tue, 14 May 2024 19:06:59 -0700 Subject: [PATCH 1/2] HLSL Availability Diagnostics Design Document - initial

[clang] 11b0591 - [Serialization] Read the initializer for interesting static variables before consuming it

2024-05-14 Thread Chuanqi Xu via cfe-commits
Author: Chuanqi Xu Date: 2024-05-15T10:29:49+08:00 New Revision: 11b059145d177ee287c7ada9864addf8d083c160 URL: https://github.com/llvm/llvm-project/commit/11b059145d177ee287c7ada9864addf8d083c160 DIFF: https://github.com/llvm/llvm-project/commit/11b059145d177ee287c7ada9864addf8d083c160.diff

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-05-14 Thread Helena Kotas via cfe-commits
@@ -0,0 +1,140 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel5.0-compute -fsyntax-only -verify %s hekota wrote: Done. https://github.com/llvm/llvm-project/pull/89809 ___ cfe-commits mailing list

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

2024-05-14 Thread Chuanqi Xu via cfe-commits
@@ -206,14 +210,37 @@ static void lowerAwaitSuspend(IRBuilder<> , CoroAwaitSuspendInst *CB) { llvm_unreachable("Unexpected coro_await_suspend invocation method"); } + if (CB->getCalledFunction()->getIntrinsicID() == + Intrinsic::coro_await_suspend_handle) { +

[clang] [clang][Sema] Warn consecutive builtin comparisons in an expression (PR #92200)

2024-05-14 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Youngsuk Kim (JOE1994) Changes Made the following decisions for consistency with `gcc 14.1`: * Add warning under -Wparentheses * Set the warning to DefaultIgnore, although -Wparentheses is enabled by default * This warning is only issued

[clang] [clang][Sema] Warn consecutive builtin comparisons in an expression (PR #92200)

2024-05-14 Thread Youngsuk Kim via cfe-commits
https://github.com/JOE1994 created https://github.com/llvm/llvm-project/pull/92200 Made the following decisions for consistency with `gcc 14.1`: * Add warning under -Wparentheses * Set the warning to DefaultIgnore, although -Wparentheses is enabled by default * This warning is only issued

[clang] [clang] Don't assume location of compiler-rt for OpenBSD (PR #92183)

2024-05-14 Thread John Ericson via cfe-commits
https://github.com/Ericson2314 edited https://github.com/llvm/llvm-project/pull/92183 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Don't assume location of compiler-rt for OpenBSD (PR #92183)

2024-05-14 Thread John Ericson via cfe-commits
https://github.com/Ericson2314 edited https://github.com/llvm/llvm-project/pull/92183 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Don't assume location of compiler-rt (PR #92183)

2024-05-14 Thread John Ericson via cfe-commits
Ericson2314 wrote: This is a very simple thing. I am quite sure it is fine from an LLVM perspective; I wanted to make sure it was fine from a BSD perspective, and @epsilon-0 confirmed it (thank you!). Will thus merge shortly. https://github.com/llvm/llvm-project/pull/92183

[clang] [clang] Don't assume location of compiler-rt (PR #92183)

2024-05-14 Thread A. Tammy via cfe-commits
epsilon-0 wrote: Looks good - ai...@openbsd.org https://github.com/llvm/llvm-project/pull/92183 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Fix crash in modernize-use-constraints (PR #92019)

2024-05-14 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/92019 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WIP][Safe Buffers] Serialize unsafe_buffer_usage pragmas (PR #92031)

2024-05-14 Thread Artem Dergachev via cfe-commits
@@ -1551,6 +1567,58 @@ bool Preprocessor::isPPInSafeBufferOptOutRegion(SourceLocation ) { return InSafeBufferOptOutRegion; } +SmallVector +Preprocessor::serializeSafeBufferOptOutMap() const { + assert(!InSafeBufferOptOutRegion && + "Attempt to serialize safe

[clang] [WIP][Safe Buffers] Serialize unsafe_buffer_usage pragmas (PR #92031)

2024-05-14 Thread Artem Dergachev via cfe-commits
@@ -1551,6 +1567,58 @@ bool Preprocessor::isPPInSafeBufferOptOutRegion(SourceLocation ) { return InSafeBufferOptOutRegion; } +SmallVector +Preprocessor::serializeSafeBufferOptOutMap() const { + assert(!InSafeBufferOptOutRegion && haoNoQ wrote: We require

[clang] [WIP][Safe Buffers] Serialize unsafe_buffer_usage pragmas (PR #92031)

2024-05-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ commented: I'm very happy that this is going somewhere! Everything makes sense to me but I also don't know a lot about this stuff. > During serialization, it only serializes regions of the current translation > unit. Regions from loaded files are not serialized. Hmm

[clang] [WIP][Safe Buffers] Serialize unsafe_buffer_usage pragmas (PR #92031)

2024-05-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/92031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)

2024-05-14 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/92192 >From 95b9e56ac8bdd3b0bde08f63f64e35d47a61b784 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 14 May 2024 22:08:20 + Subject: [PATCH 1/2] [libunwind][WebAssembly] Make libunwind compilable This tries

[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)

2024-05-14 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 dca3a6e562e012940c2b62a4d8dae3afec09caa4 95b9e56ac8bdd3b0bde08f63f64e35d47a61b784 --

[clang] [libunwind] [libunwind][WebAssembly] Make libunwind compilable (PR #92192)

2024-05-14 Thread Heejin Ahn via cfe-commits
https://github.com/aheejin created https://github.com/llvm/llvm-project/pull/92192 This tries to make Wasm compilable in LLVM tree with CMake for non-Emscripten platform. This - Adds `-D__USING_WASM_EXCEPTIONS__` when you compile with `-fwasm-exceptions` (like other EH options) in Clang -

[clang] c5cd049 - [Clang][Fixup] Fix deleted constructor on older compilers

2024-05-14 Thread Joseph Huber via cfe-commits
Author: Joseph Huber Date: 2024-05-14T18:43:42-05:00 New Revision: c5cd049566a795ba5de88dfbb2eb563cad4a9d8a URL: https://github.com/llvm/llvm-project/commit/c5cd049566a795ba5de88dfbb2eb563cad4a9d8a DIFF: https://github.com/llvm/llvm-project/commit/c5cd049566a795ba5de88dfbb2eb563cad4a9d8a.diff

[clang] [LinkerWrapper] Add an overriding option for debugging (PR #91984)

2024-05-14 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 closed https://github.com/llvm/llvm-project/pull/91984 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 4a17e86 - [LinkerWrapper] Add an overriding option for debugging (#91984)

2024-05-14 Thread via cfe-commits
Author: Joseph Huber Date: 2024-05-14T18:39:48-05:00 New Revision: 4a17e86f27a0a527ef5316f14fa0e5a60546d9ec URL: https://github.com/llvm/llvm-project/commit/4a17e86f27a0a527ef5316f14fa0e5a60546d9ec DIFF: https://github.com/llvm/llvm-project/commit/4a17e86f27a0a527ef5316f14fa0e5a60546d9ec.diff

[clang] [llvm] [DebugInfo] Use DW_op_bit_piece for structured bindings of bitfields (PR #85665)

2024-05-14 Thread Adrian Prantl via cfe-commits
https://github.com/adrian-prantl edited https://github.com/llvm/llvm-project/pull/85665 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DebugInfo] Use DW_op_bit_piece for structured bindings of bitfields (PR #85665)

2024-05-14 Thread Adrian Prantl via cfe-commits
@@ -6178,10 +6178,16 @@ The current supported opcode vocabulary is limited: the last entry from the second last entry and appends the result to the expression stack. - ``DW_OP_plus_uconst, 93`` adds ``93`` to the working expression. -- ``DW_OP_LLVM_fragment, 16, 8``

[clang] [llvm] [MC] Remove UseAssemblerInfoForParsing (PR #91082)

2024-05-14 Thread Fangrui Song via cfe-commits
MaskRay wrote: > > Thanks for the additional context. My main concern is that we're undoing > > the consensus of [reviews.llvm.org/D45164](https://reviews.llvm.org/D45164) > > which if I've understood the comments properly was "There is a reasonable > > expectation that compiled (not

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for field and constructor initializers (PR #91991)

2024-05-14 Thread Artem Dergachev via cfe-commits
@@ -3328,3 +3300,63 @@ void clang::checkUnsafeBufferUsage(const Decl *D, } } } + +void clang::checkUnsafeBufferUsage(const Decl *D, + UnsafeBufferUsageHandler , + bool EmitSuggestions) { +#ifndef NDEBUG

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for field and constructor initializers (PR #91991)

2024-05-14 Thread Artem Dergachev via cfe-commits
@@ -3328,3 +3300,63 @@ void clang::checkUnsafeBufferUsage(const Decl *D, } } } + +void clang::checkUnsafeBufferUsage(const Decl *D, + UnsafeBufferUsageHandler , + bool EmitSuggestions) { +#ifndef NDEBUG

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for field and constructor initializers (PR #91991)

2024-05-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ commented: Aha makes sense! Thanks for catching these false negatives!! https://github.com/llvm/llvm-project/pull/91991 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for field and constructor initializers (PR #91991)

2024-05-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/91991 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix for merging PR #89456 into llvm 18.X (PR #90118)

2024-05-14 Thread Bill Wendling via cfe-commits
https://github.com/bwendling closed https://github.com/llvm/llvm-project/pull/90118 ___ 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] [libcxx] [lld] [lldb] [llvm] [mlir] [polly] fix(python): fix invalid escape sequences (PR #91856)

2024-05-14 Thread Jonas Devlieghere via cfe-commits
https://github.com/JDevlieghere requested changes to this pull request. As per Aiden's suggestion, please split this up into smaller PRs, grouped by subproject. https://github.com/llvm/llvm-project/pull/91856 ___ cfe-commits mailing list

[clang] [BoundsSafety] Allow 'counted_by' attribute on pointers in structs in C (PR #90786)

2024-05-14 Thread Kees Cook via cfe-commits
https://github.com/kees approved this pull request. Thanks for the updates! Let's get this in and continue with the rest of the support. :) https://github.com/llvm/llvm-project/pull/90786 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Artem Dergachev via cfe-commits
@@ -2856,7 +2916,7 @@ getFixIts(FixableGadgetSets , const FixitStrategy , } #ifndef NDEBUG Handler.addDebugNoteForVar( - VD, F->getBaseStmt()->getBeginLoc(), + VD, F->getSourceLoc(), haoNoQ wrote: Hmm right, this is literally

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Artem Dergachev via cfe-commits
@@ -1315,9 +1374,9 @@ class DerefSimplePtrArithFixableGadget : public FixableGadget { virtual std::optional getFixits(const FixitStrategy ) const final; - - // TODO remove this method from FixableGadget interface haoNoQ wrote: Still relevant tbh.

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/91777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. Aha ok everything makes sense now! I think this is good to go so LGTM! Let me see the other PR too. https://github.com/llvm/llvm-project/pull/91777 ___ cfe-commits mailing list

[clang] [clang] Don't assume location of compiler-rt (PR #92183)

2024-05-14 Thread John Ericson via cfe-commits
https://github.com/Ericson2314 edited https://github.com/llvm/llvm-project/pull/92183 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Don't assume location of compiler-rt (PR #92183)

2024-05-14 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: John Ericson (Ericson2314) Changes If the `/usr/lib/...` path one expects is not that, fall back to the regular logic. This is a minimal change to allow OpenBSD cross compilation from a toolchain that doesn't adopt all of OpenBSD's

[clang] [clang] Don't assume location of compiler-rt (PR #92183)

2024-05-14 Thread John Ericson via cfe-commits
https://github.com/Ericson2314 created https://github.com/llvm/llvm-project/pull/92183 If the `/usr/lib/...` path one expects is not that, fall back to the regular logic. This is a minimal change to allow OpenBSD cross compilation from a toolchain that doesn't adopt all of OpenBSD's

[clang] [BoundsSafety] Allow 'counted_by' attribute on pointers in structs in C (PR #90786)

2024-05-14 Thread Dan Liew via cfe-commits
delcypher wrote: @bwendling @kees Any further feedback? If not, can you approve? As @rapidsna said we'll follow up this PR with additional PRs to address the two major concerns you had. https://github.com/llvm/llvm-project/pull/90786 ___ cfe-commits

[clang] [BoundsSafety] Allow 'counted_by' attribute on pointers in structs in C (PR #90786)

2024-05-14 Thread Dan Liew via cfe-commits
@@ -0,0 +1,187 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#define __counted_by(f) __attribute__((counted_by(f))) + +struct bar; + +struct not_found { + int count; + struct bar *fam[] __counted_by(bork); // expected-error {{use of undeclared identifier 'bork'}} +}; +

[clang] [BoundsSafety] Allow 'counted_by' attribute on pointers in structs in C (PR #90786)

2024-05-14 Thread Dan Liew via cfe-commits
https://github.com/delcypher updated https://github.com/llvm/llvm-project/pull/90786 >From 1f4d924768409d6bc61d160c6161e6acebf62b60 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Wed, 1 May 2024 13:56:52 -0700 Subject: [PATCH 1/4] [BoundsSafety] Allow 'counted_by' attribute on pointers in

[clang] [Clang] Add attribute for consteval builtin functions (PR #91894)

2024-05-14 Thread via cfe-commits
https://github.com/cor3ntin approved this pull request. LGTM As discussed offline with @erichkeane we don't have good way to test this change until the patch to add is_within_lifetime lands https://github.com/llvm/llvm-project/pull/91894 ___

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Dana Jansens via cfe-commits
@@ -921,10 +937,55 @@ class UnsafeBufferUsageAttrGadget : public WarningGadget { } static Matcher matcher() { -return stmt(callExpr(callee(functionDecl(hasAttr(attr::UnsafeBufferUsage -.bind(OpTag)); +auto HasUnsafeFnDecl = +

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Dana Jansens via cfe-commits
@@ -2856,7 +2916,7 @@ getFixIts(FixableGadgetSets , const FixitStrategy , } #ifndef NDEBUG Handler.addDebugNoteForVar( - VD, F->getBaseStmt()->getBeginLoc(), + VD, F->getSourceLoc(), danakj wrote: Yeah, this is the only callsite

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Dana Jansens via cfe-commits
@@ -2295,6 +2292,23 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { } } + void handleUnsafeOperationInContainer(const Stmt *Operation, +bool IsRelatedToDecl, +

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Dana Jansens via cfe-commits
danakj wrote: > > https://github.com/llvm/llvm-project/blob/2ff43ce87e66d9324370e35ea6743ef57400c76e/clang/lib/Analysis/UnsafeBufferUsage.cpp#L1373-L1374 > > > > These assert that exactly one gadget matched. I think it's kinda worthwhile > > keeping the warnings independent too, so I don't see

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Dana Jansens via cfe-commits
https://github.com/danakj updated https://github.com/llvm/llvm-project/pull/91777 >From 8b318dadac6d0ec53b5d26461edfe19a391845ec Mon Sep 17 00:00:00 2001 From: danakj Date: Fri, 10 May 2024 13:31:17 -0400 Subject: [PATCH 1/3] Respect the [[clang::unsafe_buffer_usage]] attribute for

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-14 Thread Arthur Eubanks via cfe-commits
aeubanks wrote: can you add links to https://reviews.llvm.org/D97608, https://github.com/rust-lang/rust/issues/92109, https://github.com/llvm/llvm-project/issues/52853 https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing list

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-14 Thread Arthur Eubanks via cfe-commits
@@ -135,6 +138,65 @@ static bool runOnFunction(Function , bool PostInlining) { return Changed; } +namespace { +struct EntryExitInstrumenter : public FunctionPass { + static char ID; + EntryExitInstrumenter() : FunctionPass(ID) { +

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-14 Thread Arthur Eubanks via cfe-commits
@@ -670,9 +670,6 @@ void CodeGenPassBuilder::addIRPasses( !Opt.DisablePartialLibcallInlining) addPass(PartiallyInlineLibCallsPass()); - // Instrument function entry and exit, e.g. with calls to mcount(). - addPass(EntryExitInstrumenterPass(/*PostInlining=*/true));

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-14 Thread Arthur Eubanks via cfe-commits
@@ -1016,6 +1000,11 @@ void EmitAssemblyHelper::RunOptimizationPipeline( if (!IsThinLTOPostLink) { addSanitizers(TargetTriple, CodeGenOpts, LangOpts, PB); addKCFIPass(TargetTriple, LangOpts, PB); + PB.registerPipelineStartEPCallback(

[clang] [LinkerWrapper] Add an overriding option for debugging (PR #91984)

2024-05-14 Thread Yaxun Liu via cfe-commits
https://github.com/yxsamliu approved this pull request. https://github.com/llvm/llvm-project/pull/91984 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Pipelines] Do not run CoroSplit and CoroCleanup in LTO pre-link pipeline (PR #90310)

2024-05-14 Thread Reid Kleckner via cfe-commits
rnk wrote: To be clear, you can repro the issue with the test case you have, just add `-fsanitize=address` to flags to repro. https://github.com/llvm/llvm-project/pull/90310 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-14 Thread Egor Pasko via cfe-commits
https://github.com/pasko converted_to_draft https://github.com/llvm/llvm-project/pull/92171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-14 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-codegen Author: Egor Pasko (pasko) Changes This change is not ready for landing yet. Move EntryExitInstrumenter(PostInlining=true) to as late as possible and EntryExitInstrumenter(PostInlining=false) to an early

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Artem Dergachev via cfe-commits
@@ -2295,6 +2292,23 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { } } + void handleUnsafeOperationInContainer(const Stmt *Operation, +bool IsRelatedToDecl, +

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Artem Dergachev via cfe-commits
@@ -921,10 +937,55 @@ class UnsafeBufferUsageAttrGadget : public WarningGadget { } static Matcher matcher() { -return stmt(callExpr(callee(functionDecl(hasAttr(attr::UnsafeBufferUsage -.bind(OpTag)); +auto HasUnsafeFnDecl = +

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Artem Dergachev via cfe-commits
@@ -2856,7 +2916,7 @@ getFixIts(FixableGadgetSets , const FixitStrategy , } #ifndef NDEBUG Handler.addDebugNoteForVar( - VD, F->getBaseStmt()->getBeginLoc(), + VD, F->getSourceLoc(), haoNoQ wrote: This is the only place where we

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/91777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)

2024-05-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ commented: > https://github.com/llvm/llvm-project/blob/2ff43ce87e66d9324370e35ea6743ef57400c76e/clang/lib/Analysis/UnsafeBufferUsage.cpp#L1373-L1374 > > These assert that exactly one gadget matched. I think it's kinda worthwhile > keeping the warnings independent too,

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-14 Thread via cfe-commits
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you,

[clang] [llvm] wip: Move instrumentation passes (PR #92171)

2024-05-14 Thread Egor Pasko via cfe-commits
https://github.com/pasko created https://github.com/llvm/llvm-project/pull/92171 This change is not ready for landing yet. Move EntryExitInstrumenter(PostInlining=true) to as late as possible and EntryExitInstrumenter(PostInlining=false) to an early pre-inlining stage (but skip for ThinLTO

[clang] [clang] Store FPOptions earlier when parsing function (PR #92146)

2024-05-14 Thread Stephen Tozer via cfe-commits
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-pch -DHEADER -x c++-header %s -o %t.pch +// RUN: %clang_cc1 -emit-llvm -include-pch %t.pch %s -o /dev/null + +#ifdef HEADER +__attribute__((optnone)) void foo() {} +#endif SLTozer wrote: It's not particularly important,

[clang] [clang] Store FPOptions earlier when parsing function (PR #92146)

2024-05-14 Thread Stephen Tozer via cfe-commits
https://github.com/SLTozer approved this pull request. I'm not familiar with the surrounding code, but this fixes the issue and looks reasonable. https://github.com/llvm/llvm-project/pull/92146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Store FPOptions earlier when parsing function (PR #92146)

2024-05-14 Thread Stephen Tozer via cfe-commits
https://github.com/SLTozer edited https://github.com/llvm/llvm-project/pull/92146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [BPF] Fix linking issues in static map initializers (PR #91310)

2024-05-14 Thread via cfe-commits
@@ -1950,8 +1950,22 @@ ConstantLValueEmitter::tryEmitBase(const APValue::LValueBase ) { if (D->hasAttr()) return CGM.GetWeakRefReference(D).getPointer(); -if (auto FD = dyn_cast(D)) - return CGM.GetAddrOfFunction(FD); +if (auto FD = dyn_cast(D)) { +

[clang] [clang-tools-extra] Reapply "[Clang] Unify interface for accessing template arguments as written for class/variable template specializations (#81642)" (PR #91393)

2024-05-14 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian closed https://github.com/llvm/llvm-project/pull/91393 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Earlier type checking for builtin unary operators (PR #90500)

2024-05-14 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: The issue seems to be that `TreeTransform::RebuildCXXOperatorCallExpr` relies on `isOverloadableType` to always be true for dependent types https://github.com/llvm/llvm-project/pull/90500 ___ cfe-commits mailing list

[clang] [Clang][Sema] Earlier type checking for builtin unary operators (PR #90500)

2024-05-14 Thread Erich Keane via cfe-commits
erichkeane wrote: > Well this took forever to reduce: > > ```c++ > template > struct A; > > template > bool operator==(const A&, const A&); > > template > void f(int *x) > { > [&](auto *y) { return x == y; }; > } > > void g() > { > f(nullptr); > } > ``` > > We initially build a

[clang] [SystemZ][z/OS] Implement z/OS XPLINK ABI (PR #91384)

2024-05-14 Thread Fanbo Meng via cfe-commits
https://github.com/fanbo-meng updated https://github.com/llvm/llvm-project/pull/91384 >From 6428b9603044031aa5c58b2d75a0e9310bc3af6a Mon Sep 17 00:00:00 2001 From: Fanbo Meng Date: Tue, 7 May 2024 13:36:38 -0400 Subject: [PATCH] [SystemZ][z/OS] Implement z/OS XPLINK ABI The XPLINK calling

[clang-tools-extra] 4cfe347 - [clangd] Fix -Wunused-but-set-variable after #82396

2024-05-14 Thread Fangrui Song via cfe-commits
Author: Fangrui Song Date: 2024-05-14T12:58:49-07:00 New Revision: 4cfe347c107485aab6bd003f99ab06aac242b0fd URL: https://github.com/llvm/llvm-project/commit/4cfe347c107485aab6bd003f99ab06aac242b0fd DIFF: https://github.com/llvm/llvm-project/commit/4cfe347c107485aab6bd003f99ab06aac242b0fd.diff

  1   2   3   4   5   >