[clang] [clang] Turn -Wenum-constexpr-conversion into a hard error (PR #102364)

2024-08-13 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: > How soon after 1.86 landing do you plan to submit this? I was thinking as soon as it's released, I don't see a reason for waiting any longer. The sooner we merge the sooner we can collect feedback and re-adjust if needed. But of course it's up to the Clang owners to deci

[clang] [clang] Support -Wa, options -mmsa and -mno-msa (PR #99615)

2024-08-13 Thread via cfe-commits
yingopq wrote: Hi @MaskRay, I have updated the patch. Thank! https://github.com/llvm/llvm-project/pull/99615 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [NVPTX] Add conversion intrinsics from/to fp8 types (e4m3, e5m2) (PR #102969)

2024-08-13 Thread Sergey Kozub via cfe-commits
@@ -722,6 +722,37 @@ let hasSideEffects = false in { defm CVT_f16x2 : CVT_FROM_FLOAT_V2_SM80<"f16x2", Int32Regs>; defm CVT_bf16x2 : CVT_FROM_FLOAT_V2_SM80<"bf16x2", Int32Regs>; + + // FP8 conversions. + multiclass CVT_TO_F8X2 { +def _f32 : + NVPTXInst<(outs Int1

[clang] [llvm] [NVPTX] Add conversion intrinsics from/to fp8 types (e4m3, e5m2) (PR #102969)

2024-08-13 Thread Sergey Kozub via cfe-commits
https://github.com/sergey-kozub updated https://github.com/llvm/llvm-project/pull/102969 >From ee028cccb41964223b87edb1db88710bac89080a Mon Sep 17 00:00:00 2001 From: Sergey Kozub Date: Mon, 12 Aug 2024 12:52:01 -0700 Subject: [PATCH] [NVPTX] Add conversion intrinsics from/to fp8 types (e4m3,

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -10941,6 +10941,55 @@ def warn_imp_cast_drops_unaligned : Warning< InGroup>; // Function effects +def warn_func_effect_allocates : Warning< + "'%0' function must not allocate or deallocate memory">, + InGroup; +def note_func_effect_allocates : Note< + "function cannot

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -0,0 +1,1199 @@ +//=== EffectAnalysis.cpp - Sema warnings for function effects -===// +// +// 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: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -0,0 +1,1199 @@ +//=== EffectAnalysis.cpp - Sema warnings for function effects -===// +// +// 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: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -0,0 +1,1199 @@ +//=== EffectAnalysis.cpp - Sema warnings for function effects -===// +// +// 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: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -2397,6 +2397,8 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { }; } // namespace +// = Sirraide wrote: There are still some spurious changes in here it se

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -0,0 +1,256 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -std=c++20 -verify %s +// These are in a separate file because errors (e.g. incompatible attributes) currently prevent +// the FXAnalysis pass from running at all. + +// This diagnostic is re-enabled a

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -953,6 +953,9 @@ class ASTReader /// Sema tracks these to emit deferred diags. llvm::SmallSetVector DeclsToCheckForDeferredDiags; + /// The IDs of all decls with function effects to be checked. + SmallVector DeclsWithEffectsToVerify; Sirraide wrote:

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -0,0 +1,1199 @@ +//=== EffectAnalysis.cpp - Sema warnings for function effects -===// +// +// 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: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -0,0 +1,1199 @@ +//=== EffectAnalysis.cpp - Sema warnings for function effects -===// +// +// 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: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -0,0 +1,1199 @@ +//=== EffectAnalysis.cpp - Sema warnings for function effects -===// +// +// 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: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -873,30 +877,17 @@ class Sema final : public SemaBase { /// Warn when implicitly casting 0 to nullptr. void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E); - // - function effects --- + /// All functions/lambdas/blocks which have bodies and which ha

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -10941,6 +10941,55 @@ def warn_imp_cast_drops_unaligned : Warning< InGroup>; // Function effects +def warn_func_effect_allocates : Warning< + "'%0' function must not allocate or deallocate memory">, + InGroup; +def note_func_effect_allocates : Note< + "function cannot

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -4914,6 +4920,78 @@ class FunctionEffectsRef { void dump(llvm::raw_ostream &OS) const; }; +/// A mutable set of FunctionEffect::Kind. +class FunctionEffectKindSet { Sirraide wrote: Is there a way to use `std::bitset` to simplify the implementation of thi

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -5137,47 +5137,41 @@ StringRef FunctionEffect::name() const { llvm_unreachable("unknown effect kind"); } -bool FunctionEffect::canInferOnFunction(const Decl &Callee) const { +std::optional FunctionEffect::effectProhibitingInference( +const Decl &Callee, const Function

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -530,6 +530,10 @@ struct FunctionEffectDifferences : public SmallVector { const FunctionEffectsRef &New); }; +// Defined in EffectAnalysis.cpp. TODO: Maybe make this a method of Sema and +// move more of the effects implementation into that file

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -10941,6 +10941,55 @@ def warn_imp_cast_drops_unaligned : Warning< InGroup>; // Function effects +def warn_func_effect_allocates : Warning< + "'%0' function must not allocate or deallocate memory">, + InGroup; +def note_func_effect_allocates : Note< + "function cannot

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
https://github.com/Sirraide edited https://github.com/llvm/llvm-project/pull/99656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
@@ -4756,18 +4758,22 @@ class FunctionEffect { /// The description printed in diagnostics, e.g. 'nonblocking'. StringRef name() const; - /// Return true if the effect is allowed to be inferred on the callee, - /// which is either a FunctionDecl or BlockDecl. + /// Deter

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
https://github.com/Sirraide commented: Overall, this is looking pretty good I’d say. https://github.com/llvm/llvm-project/pull/99656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Have getTargetSubDirPath better match get_compiler_rt_target (PR #100091)

2024-08-13 Thread Fangrui Song via cfe-commits
@@ -766,9 +766,19 @@ ToolChain::getTargetSubDirPath(StringRef BaseDir) const { return {}; }; - if (auto Path = getPathForTriple(getTriple())) + llvm::Triple Triple = getTriple(); + + // Try triple as is. + if (auto Path = getPathForTriple(Triple)) return *Path;

[clang] [llvm] [Sanitizer] Make sanitizer passes idempotent (PR #99439)

2024-08-13 Thread via cfe-commits
skc7 wrote: > > > > I remain concerned that newly developed instrumentations may require > > > > this special property. Is it useful to restrict this to HIP programs, > > > > at least before we gain more experience to comfortably apply this to > > > > other configurations? > > > > I'm also wor

[clang] [clang] Emit nuw GEPs for array subscript expressions (PR #103088)

2024-08-13 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > adding nuw is also valid for signed indices here I don't understand how you think this would work; a-1 and a+-1 are required to produce the same result. https://github.com/llvm/llvm-project/pull/103088 ___ cfe-commits mailing l

[clang] [clang] Turn -Wenum-constexpr-conversion into a hard error (PR #102364)

2024-08-13 Thread Jordan Rupprecht via cfe-commits
rupprecht wrote: > Since boost/mpl is at the core of issues and many projects depend directly or > transitively on it, I think it might be good to wait until version 1.86 is > released, so people can bump to a release version instead of trunk. > > It should be around the corner, > [AFAICS](ht

[clang] [Clang][NFCI] Slightly refactor getTemplateInstantiationArgs() (PR #102922)

2024-08-13 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Thinking twice, I think this is probably feasible to go. As an internal flag > wouldn't be exposed to users, but we might have to refactor the function a > lot more. Yep. Just don't forget to assert in case the template arguments wouldn't get added, to diagnose users passing

[clang] [CMake] Update CMake cache file for the ARM/Aarch64 cross toolchain builds. NFC. (PR #103552)

2024-08-13 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Vladimir Vereschaka (vvereschaka) Changes In order to build LLDB project added the following changes: * enable LIBCXX_ENABLE_STATIC_ABI_LIBRARY option to merge the libc++ and libc++abi libraries int othe single file. * set LIBCXX_ABI_VERS

[clang] [CMake] Update CMake cache file for the ARM/Aarch64 cross toolchain builds. NFC. (PR #103552)

2024-08-13 Thread Vladimir Vereschaka via cfe-commits
https://github.com/vvereschaka created https://github.com/llvm/llvm-project/pull/103552 In order to build LLDB project added the following changes: * enable LIBCXX_ENABLE_STATIC_ABI_LIBRARY option to merge the libc++ and libc++abi libraries int othe single file. * set LIBCXX_ABI_VERSION to 1 b

[clang] [Clang][NFCI] Slightly refactor getTemplateInstantiationArgs() (PR #102922)

2024-08-13 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > Either refactor that, or just add an internal 'bool' parameter that controls > if the implementation will add the template parameters, and call that from > the 'Innermost' path with adding the arguments disabled. Thinking twice, I think this is probably feasible to go. As an i

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread via cfe-commits
Sirraide wrote: > Well, there was some head-scratching before debugging revealed that Clang was > treating `malloc()` as a built-in. Yeah, we have a class of ‘builtins’ that are marked as a `LibBuiltin` in `clang/Basic/Builtins.td`, and iirc that’s basically literally every function in the C

[clang] [Clang][NFCI] Slightly refactor getTemplateInstantiationArgs() (PR #102922)

2024-08-13 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > simplify the function to the following signature: I'm afraid we couldn't. We have one reliance on the `DC` parameter in constraint expression comparison, where we're unable to obtain a Decl as that is not formed yet. So dropping the `DC` parameter doesn't work here. If you pr

[clang] [Clang][NFCI] Slightly refactor getTemplateInstantiationArgs() (PR #102922)

2024-08-13 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I think we could instead simplify the function to the following signature: ```C++ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs( const Decl *D, bool LexicalParent, bool Final, .) ``` Ie we take a single decl, which we will assume is a NamedDecl in case

[clang] [Clang][NFCI] Slightly refactor getTemplateInstantiationArgs() (PR #102922)

2024-08-13 Thread Younan Zhang via cfe-commits
zyn0217 wrote: > I think I'd need to see how you would use it, to say if this would be the > best approach. (I thought I have explained somewhere, but it seems not. Sorry!) So the basic idea of CWG2369 is to swap the order of the function template substitution and its constraint checking. We

[clang] [Clang] [Sema] Error on reference types inside a union with msvc 1900+ (PR #102851)

2024-08-13 Thread Max Winkler via cfe-commits
https://github.com/MaxEW707 updated https://github.com/llvm/llvm-project/pull/102851 >From e6b925894066656a2773278a093dbf709ba66319 Mon Sep 17 00:00:00 2001 From: MaxEW707 Date: Sun, 11 Aug 2024 22:37:55 -0700 Subject: [PATCH 1/3] Error on reference inside a union with msvc 1910+ --- clang/li

[clang] [llvm] [LinkerWrapper] Always pass `-flto` if the linker supports it (PR #102972)

2024-08-13 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > This caused a nvlink error with clang. This was found by a OpenMP CI > https://gitlab.e4s.io/uo-public/llvm-openmp-offloading/-/jobs/301520 Probably an LTO flag I forgot to handle correctly, can you compile it with `-v` to show what it's passing? https://github.com/llvm/llvm-

[clang] [Clang] [AST] Fix placeholder return type name mangling for MSVC 1920+ / VS2019+ (PR #102848)

2024-08-13 Thread Max Winkler via cfe-commits
https://github.com/MaxEW707 updated https://github.com/llvm/llvm-project/pull/102848 >From e5071bd3be7607730654e5aa815a535db130fdee Mon Sep 17 00:00:00 2001 From: MaxEW707 Date: Sun, 11 Aug 2024 16:50:58 -0700 Subject: [PATCH 1/5] Fix placeholder return type name mangling for MSVC 1920+ --- c

[clang] [llvm] [LinkerWrapper] Always pass `-flto` if the linker supports it (PR #102972)

2024-08-13 Thread Aaron Jarmusch via cfe-commits
ajarmusch wrote: This caused a nvlink error with clang. This was found by a OpenMP CI https://gitlab.e4s.io/uo-public/llvm-openmp-offloading/-/jobs/301520 https://github.com/llvm/llvm-project/pull/102972 ___ cfe-commits mailing list cfe-commits@lists

[clang] [llvm] Add normalize builtins and normalize HLSL function to DirectX and SPIR-V backend (PR #102683)

2024-08-13 Thread LLVM Continuous Integration via cfe-commits
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `mlir-nvidia-gcc7` running on `mlir-nvidia` while building `clang,llvm` at step 5 "build-check-mlir-build-only". Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/2337 Here is the relevant pie

[clang] [sanitizer] Document AddressSanitizer security considerations (PR #100937)

2024-08-13 Thread Florian Mayer via cfe-commits
@@ -313,6 +313,14 @@ Limitations usually expected. * Static linking of executables is not supported. +Security Considerations +=== + +AddressSanitizer is a bug detection tool and is not meant to be linked fmayer wrote: nit: maybe "its ru

[clang] [clang][NFC] sort C standards on status page in reverse chronological order (PR #102844)

2024-08-13 Thread via cfe-commits
h-vetinari wrote: Thank you! FYI, I don't have the commit bit on this repo, so someone would have to merge for me. https://github.com/llvm/llvm-project/pull/102844 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [clang][ExtractAPI] Compute inherited availability information (PR #103040)

2024-08-13 Thread Cyndy Ishida via cfe-commits
https://github.com/cyndyishida edited https://github.com/llvm/llvm-project/pull/103040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExtractAPI] Compute inherited availability information (PR #103040)

2024-08-13 Thread Cyndy Ishida via cfe-commits
@@ -16,33 +16,101 @@ #include "clang/AST/Decl.h" #include "clang/Basic/TargetInfo.h" -namespace clang { +namespace { + +struct AvailabilitySet { + llvm::SmallVector Availabilities; cyndyishida wrote: Can you mark this private, its not clear otherwise that on

[clang] [clang][ExtractAPI] Compute inherited availability information (PR #103040)

2024-08-13 Thread Cyndy Ishida via cfe-commits
@@ -16,33 +16,101 @@ #include "clang/AST/Decl.h" #include "clang/Basic/TargetInfo.h" -namespace clang { +namespace { + +struct AvailabilitySet { + llvm::SmallVector Availabilities; + bool UnconditionallyDeprecated = false; + bool UnconditionallyUnavailable = false; -Avail

[clang] [clang][ExtractAPI] Compute inherited availability information (PR #103040)

2024-08-13 Thread Cyndy Ishida via cfe-commits
https://github.com/cyndyishida commented: > Additionally this computes availability information for all platforms ahead Can you add a test for this? https://github.com/llvm/llvm-project/pull/103040 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang] [clang][ExtractAPI] Compute inherited availability information (PR #103040)

2024-08-13 Thread Cyndy Ishida via cfe-commits
@@ -0,0 +1,149 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing -triple arm64-apple-macosx \ +// RUN: -x objective-c-header %s -o %t/output.symbols.json -verify + + +// RUN: FileCheck %s --input-file %t/output.symbols.json

[clang] [clang][ExtractAPI] Compute inherited availability information (PR #103040)

2024-08-13 Thread Cyndy Ishida via cfe-commits
@@ -16,33 +16,101 @@ #include "clang/AST/Decl.h" #include "clang/Basic/TargetInfo.h" -namespace clang { +namespace { + +struct AvailabilitySet { + llvm::SmallVector Availabilities; + bool UnconditionallyDeprecated = false; + bool UnconditionallyUnavailable = false; -Avail

[clang] [clang][ExtractAPI] Compute inherited availability information (PR #103040)

2024-08-13 Thread Cyndy Ishida via cfe-commits
@@ -16,33 +16,101 @@ #include "clang/AST/Decl.h" #include "clang/Basic/TargetInfo.h" -namespace clang { +namespace { + +struct AvailabilitySet { cyndyishida wrote: Can you add a doc string or change the type name to match closer to what this captures? IIUC i

[clang] [clang][ExtractAPI] Compute inherited availability information (PR #103040)

2024-08-13 Thread Cyndy Ishida via cfe-commits
https://github.com/cyndyishida edited https://github.com/llvm/llvm-project/pull/103040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add normalize builtins and normalize HLSL function to DirectX and SPIR-V backend (PR #102683)

2024-08-13 Thread S. Bharadwaj Yadavalli via cfe-commits
@@ -229,6 +230,75 @@ static bool expandLog10Intrinsic(CallInst *Orig) { return expandLogIntrinsic(Orig, numbers::ln2f / numbers::ln10f); } +static bool expandNormalizeIntrinsic(CallInst *Orig) { + Value *X = Orig->getOperand(0); + Type *Ty = Orig->getType(); + Type *EltTy

[clang] [lldb] Use CLANG_RESOURCE_DIR more consistently (PR #103388)

2024-08-13 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. clangDriver changes look reasonable. https://github.com/llvm/llvm-project/pull/103388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [sanitizer] Document AddressSanitizer security considerations (PR #100937)

2024-08-13 Thread Vitaly Buka via cfe-commits
vitalybuka wrote: This applies as well to MemorySanitizer, ThreadSanitizer, LeakSanitizer, HWAddressSanitizer, more or less UBSan with diagnostics. Would you like to update those as well? https://github.com/llvm/llvm-project/pull/100937 ___ cfe-commi

[clang] [HLSL] Split out the ROV attribute from the resource attribute, make it a new spellable attribute. (PR #102414)

2024-08-13 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. https://github.com/llvm/llvm-project/pull/102414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Warning Libc functions (PR #101583)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { return false; } +namespace libc_fun_disjoint_inner_matchers { +// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match +// disjoint node sets. They all take a `CoreName`, which

[clang] Warning Libc functions (PR #101583)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { return false; } +namespace libc_fun_disjoint_inner_matchers { +// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match +// disjoint node sets. They all take a `CoreName`, which

[clang] Warning Libc functions (PR #101583)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { return false; } +namespace libc_fun_disjoint_inner_matchers { +// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match +// disjoint node sets. They all take a `CoreName`, which

[clang] Warning Libc functions (PR #101583)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -2292,6 +2292,18 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { } } + void handleUnsafeLibcCall(const CallExpr *Call, unsigned PrintfInfo, +ASTContext &Ctx) override { +// We have checked that there is a direct

[clang] Warning Libc functions (PR #101583)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { return false; } +namespace libc_fun_disjoint_inner_matchers { +// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match +// disjoint node sets. They all take a `CoreName`, which

[clang] Warning Libc functions (PR #101583)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -483,6 +483,34 @@ bool clang::analyze_format_string::ParseFormatStringHasSArg(const char *I, return false; } +unsigned clang::analyze_format_string::ParseFormatStringFirstSArgIndex( +const char *&I, const char *E, unsigned ArgIndex, const LangOptions &LO, +const

[clang] Warning Libc functions (PR #101583)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { return false; } +namespace libc_fun_disjoint_inner_matchers { +// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match +// disjoint node sets. They all take a `CoreName`, which

[clang] Warning Libc functions (PR #101583)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -783,6 +783,18 @@ bool ParsePrintfString(FormatStringHandler &H, bool ParseFormatStringHasSArg(const char *beg, const char *end, const LangOptions &LO, const TargetInfo &Target); +/// Parse C format string and return index (relative to `ArgInde

[clang] Warning Libc functions (PR #101583)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { return false; } +namespace libc_fun_disjoint_inner_matchers { +// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match +// disjoint node sets. They all take a `CoreName`, which

[clang] [llvm] Add normalize builtins and normalize HLSL function to DirectX and SPIR-V backend (PR #102683)

2024-08-13 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed https://github.com/llvm/llvm-project/pull/102683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 1b2d11d - Add normalize builtins and normalize HLSL function to DirectX and SPIR-V backend (#102683)

2024-08-13 Thread via cfe-commits
Author: Joshua Batista Date: 2024-08-13T15:15:19-07:00 New Revision: 1b2d11de938af899c74eacc0218304576fe6052b URL: https://github.com/llvm/llvm-project/commit/1b2d11de938af899c74eacc0218304576fe6052b DIFF: https://github.com/llvm/llvm-project/commit/1b2d11de938af899c74eacc0218304576fe6052b.diff

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread Doug Wyatt via cfe-commits
dougsonos wrote: > aha! I missed this was part of the plan to begin with, that makes sense. Well, there was some head-scratching before debugging revealed that the Clang was treating `malloc()` as a built-in. It doesn't do that if you declare it locally. https://github.com/llvm/llvm-project/p

[clang] [lldb] Use CLANG_RESOURCE_DIR more consistently (PR #103388)

2024-08-13 Thread Alex Langford via cfe-commits
https://github.com/bulbazord approved this pull request. The LLDB changes look good to me. I can't speak for the clang portions but fwiw I think they look ok too. https://github.com/llvm/llvm-project/pull/103388 ___ cfe-commits mailing list cfe-commit

[clang] [Safe Buffers] Fix a small bug recently found (PR #102953)

2024-08-13 Thread Ziqing Luo via cfe-commits
@@ -404,7 +404,7 @@ AST_MATCHER(CXXConstructExpr, isSafeSpanTwoParamConstruct) { if (Arg0Ty->isConstantArrayType()) { const APSInt ConstArrSize = -APSInt(cast(Arg0Ty)->getSize()); +APSInt(cast(Arg0Ty.getCanonicalType())->getSize()); ziqin

[clang] [Safe Buffers] Fix a small bug recently found (PR #102953)

2024-08-13 Thread Ziqing Luo via cfe-commits
https://github.com/ziqingluo-90 updated https://github.com/llvm/llvm-project/pull/102953 >From d6c860de3facc37f27b17a26a01e48bc02b4659b Mon Sep 17 00:00:00 2001 From: ziqingluo-90 Date: Mon, 12 Aug 2024 11:57:17 -0700 Subject: [PATCH] [-Wunsafe-buffer-usage] Fix a bug in the ASTMatcher for span

[clang] [HLSL] Split out the ROV attribute from the resource attribute, make it a new spellable attribute. (PR #102414)

2024-08-13 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/102414 >From c35e4ec3f8ea27eedc0658921d8d9055451acd91 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 7 Aug 2024 19:34:54 -0700 Subject: [PATCH 1/6] split out ROV from resource attr --- clang/include/clang/

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread Chris Apple via cfe-commits
cjappl wrote: > exceptions to "built-in functions are always safe" aha! I missed this was part of the plan to begin with, that makes sense. This latest commit fixed my example. Code throws a warning as expected! https://github.com/llvm/llvm-project/pull/99656 __

[clang] [attributes][-Wunsafe-buffer-usage] Support adding unsafe_buffer_usage attribute to struct fields (PR #101585)

2024-08-13 Thread Malavika Samak via cfe-commits
https://github.com/malavikasamak updated https://github.com/llvm/llvm-project/pull/101585 >From c9f2b131aea2c0d9d1405cb00c54dde859750d0c Mon Sep 17 00:00:00 2001 From: MalavikaSamak Date: Thu, 1 Aug 2024 11:01:36 -0700 Subject: [PATCH] [attributes][-Wunsafe-buffer-usage] Support adding unsafe_

[libunwind] [libunwind] Detect cycles of length 1 (PR #103476)

2024-08-13 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-libunwind Author: Michael Kolupaev (al13n321) Changes If an unwind step leaves both the instruction pointer and the stack pointer unchanged, stop unwinding. Otherwise we'd be stuck in a loop producing the same stack frame over and over. This happens w

[libunwind] [libunwind] Detect cycles of length 1 (PR #103476)

2024-08-13 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, it

[libunwind] [libunwind] Detect cycles of length 1 (PR #103476)

2024-08-13 Thread Michael Kolupaev via cfe-commits
https://github.com/al13n321 created https://github.com/llvm/llvm-project/pull/103476 If an unwind step leaves both the instruction pointer and the stack pointer unchanged, stop unwinding. Otherwise we'd be stuck in a loop producing the same stack frame over and over. This happens with musl li

[clang] [HLSL] Add __is_scalarized_layout_compatible (PR #102227)

2024-08-13 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,132 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -verify %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -fnative-half-type -verify %s +// expected-no-diagnostics + +// Case 1: How many w

[clang] [HLSL] Add __is_scalarized_layout_compatible (PR #102227)

2024-08-13 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,132 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -verify %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -fnative-half-type -verify %s +// expected-no-diagnostics + +// Case 1: How many w

[clang] [HLSL] Add __is_scalarized_layout_compatible (PR #102227)

2024-08-13 Thread Damyan Pepper via cfe-commits
@@ -1142,3 +1142,85 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { } return false; } + +static void BuildFlattenedTypeList(QualType BaseTy, + llvm::SmallVectorImpl &List) { + llvm::SmallVector WorkList

[clang] [HLSL] Add __is_scalarized_layout_compatible (PR #102227)

2024-08-13 Thread Damyan Pepper via cfe-commits
@@ -1142,3 +1142,85 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { } return false; } + +static void BuildFlattenedTypeList(QualType BaseTy, + llvm::SmallVectorImpl &List) { + llvm::SmallVector WorkList

[clang] [HLSL] Add __is_scalarized_layout_compatible (PR #102227)

2024-08-13 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. https://github.com/llvm/llvm-project/pull/102227 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFCI] Slightly refactor getTemplateInstantiationArgs() (PR #102922)

2024-08-13 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/102922 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFCI] Slightly refactor getTemplateInstantiationArgs() (PR #102922)

2024-08-13 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: I think I'd need to see how you would use it, to say if this would be the best approach. It's not clear to me why we would want to navigate to a DC that is unrelated to the passed ND. Can we at least assert the DC would be a parent (Lexical or Semantic)

[clang] [attributes][-Wunsafe-buffer-usage] Support adding unsafe_buffer_usage attribute to struct fields (PR #101585)

2024-08-13 Thread Malavika Samak via cfe-commits
@@ -0,0 +1,180 @@ +// RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage \ +// RUN:-fsafe-buffer-usage-suggestions -verify %s + +using size_t = __typeof(sizeof(int)); + +namespace std { + class type_info; + class bad_cast; + class bad_typeid; + + template class span

[libunwind] [libunwind][X86-64] Handle Linux sigreturn trampoline when DWARF info is missing (PR #103473)

2024-08-13 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-libunwind Author: Michael Kolupaev (al13n321) Changes Do for X86-64 what libunwind already does for AArch64, RISC-V, and S390X. GDB does this too. Useful for musl libc, which doesn't have DWARF unwind info for `__restore_rt` trampoline, so libunwind c

[libunwind] [libunwind][X86-64] Handle Linux sigreturn trampoline when DWARF info is missing (PR #103473)

2024-08-13 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, it

[libunwind] [libunwind][X86-64] Handle Linux sigreturn trampoline when DWARF info is missing (PR #103473)

2024-08-13 Thread Michael Kolupaev via cfe-commits
https://github.com/al13n321 created https://github.com/llvm/llvm-project/pull/103473 Do for X86-64 what libunwind already does for AArch64, RISC-V, and S390X. GDB does this too. Useful for musl libc, which doesn't have DWARF unwind info for `__restore_rt` trampoline, so libunwind couldn't unw

[clang] [HLSL] Add __is_scalarized_layout_compatible (PR #102227)

2024-08-13 Thread Damyan Pepper via cfe-commits
damyanp wrote: > HLSL tends to rely pretty aggressively on scalarization occuring in the > complier, which allows for some relaxed language behaviors when types are > fully sclarized to equivalent scalar representations. Some typos: * occuring --> occurring * complier --> compiler * sclarized

[clang] [Clang] Overflow Pattern Exclusions (PR #100272)

2024-08-13 Thread Bill Wendling via cfe-commits
bwendling wrote: Thanks! @efriedma-quic anymore comments? https://github.com/llvm/llvm-project/pull/100272 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [NVPTX] Add conversion intrinsics from/to fp8 types (e4m3, e5m2) (PR #102969)

2024-08-13 Thread Artem Belevich via cfe-commits
@@ -722,6 +722,37 @@ let hasSideEffects = false in { defm CVT_f16x2 : CVT_FROM_FLOAT_V2_SM80<"f16x2", Int32Regs>; defm CVT_bf16x2 : CVT_FROM_FLOAT_V2_SM80<"bf16x2", Int32Regs>; + + // FP8 conversions. + multiclass CVT_TO_F8X2 { +def _f32 : + NVPTXInst<(outs Int1

[clang] [Clang] Overflow Pattern Exclusions (PR #100272)

2024-08-13 Thread Justin Stitt via cfe-commits
@@ -649,6 +649,8 @@ class alignas(void *) Stmt { /// It is 0 otherwise. LLVM_PREFERRED_TYPE(bool) unsigned HasFPFeatures : 1; +LLVM_PREFERRED_TYPE(bool) JustinStitt wrote: Good idea, see https://github.com/llvm/llvm-project/pull/100272/commits

[clang] [Clang] Overflow Pattern Exclusions (PR #100272)

2024-08-13 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/100272 >From 154d3505ab13275086b3dffed67bcdcac52f79a3 Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 23 Jul 2024 20:21:49 + Subject: [PATCH 01/11] implement idiom exclusions Add flag `-fno-sanitize-ove

[clang] [Driver] Introduce ffp-model=aggressive (PR #100453)

2024-08-13 Thread Andy Kaylor via cfe-commits
andykaylor wrote: @kpneal I think the tolerance of excess precision is mostly a concession to the hardware limitations. I believe we only apply it when half-precision types are used but the hardware doesn't support native half-precision operations. In this sense, it is equivalent to the situat

[clang] [analyzer] Model overflow builtins (PR #102602)

2024-08-13 Thread Pavel Skripkin via cfe-commits
https://github.com/pskrgag updated https://github.com/llvm/llvm-project/pull/102602 >From 7b4f999b39f4308cab253204e6be41ea7a70f695 Mon Sep 17 00:00:00 2001 From: Pavel Skripkin Date: Fri, 9 Aug 2024 14:37:47 +0300 Subject: [PATCH 1/7] clang/csa: add initial support for builtin overflow --- ..

[clang] [HLSL] Split out the ROV attribute from the resource attribute, make it a new spellable attribute. (PR #102414)

2024-08-13 Thread Damyan Pepper via cfe-commits
@@ -116,12 +116,15 @@ struct BuiltinTypeDeclBuilder { QualType(TTD->getTypeForDecl(), 0)); } // add handle member -llvm::SmallVector Attrs; Attr *ResourceClassAttr = HLSLResourceClassAttr::CreateImplicit(Record->getASTContext(), RC); A

[clang] [HLSL] Split out the ROV attribute from the resource attribute, make it a new spellable attribute. (PR #102414)

2024-08-13 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp requested changes to this pull request. https://github.com/llvm/llvm-project/pull/102414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] use upper case letters for bool conversion suffix (PR #102831)

2024-08-13 Thread via cfe-commits
https://github.com/Da-Viper updated https://github.com/llvm/llvm-project/pull/102831 >From 8a4f6af9fc1f44c2f8b5fd3693ca14eaf776fd02 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Sun, 11 Aug 2024 21:39:35 +0100 Subject: [PATCH 1/7] [clang-tidy] use upper cace letters for bool conversion suff

[clang] [HLSL] Split out the ROV attribute from the resource attribute, make it a new spellable attribute. (PR #102414)

2024-08-13 Thread Helena Kotas via cfe-commits
https://github.com/hekota approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/102414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-08-13 Thread Doug Wyatt via cfe-commits
dougsonos wrote: > ``` > #include > float* nb4() noexcept [[clang::nonallocating]] > { > float* ptr = (float*)malloc(100 * sizeof(float)); > return ptr; > } > ``` > > Produces no warnings: Hi Chris, Thanks. That turned out to be the impetus to start carving out exceptions to "built-in fun

[clang] [HLSL] Split out the ROV attribute from the resource attribute, make it a new spellable attribute. (PR #102414)

2024-08-13 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/102414 >From c35e4ec3f8ea27eedc0658921d8d9055451acd91 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 7 Aug 2024 19:34:54 -0700 Subject: [PATCH 1/5] split out ROV from resource attr --- clang/include/clang/

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

2024-08-13 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 01/16] Adding C23 constexpr math functions fmin and frexp.

  1   2   3   4   >