[clang] Reapply "[clang][analyzer] StreamChecker: Model getc, vfscanf, putc, … (PR #83281)

2024-02-29 Thread Alejandro Álvarez Ayllón via cfe-commits
alejandro-alvarez-sonarsource wrote: @balazske @steakhal I broke some tests on aarch64 since there `__builtin_valist` is a struct and not a pointer to struct, so `lookupFn` was not matching `vfprintf` nor `vfscanf`, and the NULL pointer dereference triggered on the `fclose`. I have fixed that

[clang] [compiler-rt] [AArch64] Implement __builtin_cpu_supports, compiler-rt tests. (PR #82378)

2024-02-29 Thread via cfe-commits
eaeltsin wrote: Thanks @DanielKristofKiss - considering compilations with older toolchains is a good reason to choose the particular behavior. It would be very valuable if all these reasons and the selected behavior for unsupported builtins/parameters are documented, i.e. here - https://clang

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-29 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm edited https://github.com/llvm/llvm-project/pull/79035 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -814,6 +814,15 @@ bool shouldEmitConstantsToTextSection(const Triple &TT); /// to integer. int getIntegerAttribute(const Function &F, StringRef Name, int Default); +/// \returns Unsigned Integer value requested using \p F's \p Name attribute. +/// +/// \returns \p Default i

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -356,6 +356,24 @@ void AMDGPUTargetCodeGenInfo::setFunctionDeclAttributes( if (NumVGPR != 0) F->addFnAttr("amdgpu-num-vgpr", llvm::utostr(NumVGPR)); } + + if (const auto *Attr = FD->getAttr()) { +uint32_t X = Attr->getMaxNumWorkGroupsX() +

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,84 @@ +; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck %s + +; Attribute not specified. +; CHECK-LABEL: {{^}}empty_no_attribute: +define amdgpu_kernel void @empty_no_attribute() { +entry: + ret void +} + +; Ignore if number of work groups for x dime

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -139,6 +139,36 @@ kernel void reqd_work_group_size_32_2_1_flat_work_group_size_16_128() { // CHECK: define{{.*}} amdgpu_kernel void @reqd_work_group_size_32_2_1_flat_work_group_size_16_128() [[FLAT_WORK_GROUP_SIZE_16_128:#[0-9]+]] } +__attribute__((amdgpu_max_num_work_gr

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -194,3 +204,105 @@ __global__ void non_cexpr_waves_per_eu_2() {} // expected-error@+1{{'amdgpu_waves_per_eu' attribute requires parameter 1 to be an integer constant}} __attribute__((amdgpu_waves_per_eu(2, ipow2(2 __global__ void non_cexpr_waves_per_eu_2_4() {} + +// ex

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,84 @@ +; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck %s + arsenm wrote: Missing a test for the various IR attribute parsing error conditions https://github.com/llvm/llvm-project/pull/79035 ___

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-29 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm requested changes to this pull request. https://github.com/llvm/llvm-project/pull/79035 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -137,6 +137,11 @@ Removed Compiler Flags Attribute Changes in Clang -- +- Introduced a new function attribute ``__attribute__((amdgpu_max_num_work_groups(x, y, z)))`` or + ``[[clang::amdgpu_max_num_work_groups(x, y, z)]]`` for the AMDGPU target. T

[clang-tools-extra] [include-cleaner] Generate references from explicit functiontemplate specializations (PR #83392)

2024-02-29 Thread kadir çetinkaya via cfe-commits
https://github.com/kadircet created https://github.com/llvm/llvm-project/pull/83392 None From f62a553d8d4af339bdcb69024d5bf42527e3a01d Mon Sep 17 00:00:00 2001 From: Kadir Cetinkaya Date: Thu, 29 Feb 2024 09:25:18 +0100 Subject: [PATCH] [include-cleaner] Generate references from explicit func

[clang-tools-extra] [include-cleaner] Generate references from explicit functiontemplate specializations (PR #83392)

2024-02-29 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-tools-extra Author: kadir çetinkaya (kadircet) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/83392.diff 2 Files Affected: - (modified) clang-tools-extra/include-cleaner/lib/WalkAST.cpp (+5) - (modified) clang-tools-extra/in

[clang] [clang-format] Enable again some operator tests (PR #83380)

2024-02-29 Thread Owen Pan via cfe-commits
@@ -16671,9 +16667,8 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) { SpaceFuncDecl); verifyFormat("int f () throw(Deprecated);", SpaceFuncDecl); verifyFormat("typedef void (*cb)(int);", SpaceFuncDecl); - // FIXME these tests regressed behaviour. - //

[clang] [clang-format] Enable again some operator tests (PR #83380)

2024-02-29 Thread Owen Pan via cfe-commits
@@ -16797,7 +16792,7 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) { verifyFormat("int f() throw (Deprecated);", SomeSpace2); verifyFormat("typedef void (*cb) (int);", SomeSpace2); verifyFormat("T A::operator()();", SomeSpace2); - // verifyFormat("X A::operator++

[clang] [clang-format] Enable again some operator tests (PR #83380)

2024-02-29 Thread Owen Pan via cfe-commits
@@ -16710,7 +16705,7 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) { verifyFormat("typedef void (*cb)(int);", SpaceFuncDef); verifyFormat("T A::operator()();", SpaceFuncDef); verifyFormat("X A::operator++(T);", SpaceFuncDef); - // verifyFormat("T A::operator() ()

[clang] [clang-format] Enable again some operator tests (PR #83380)

2024-02-29 Thread Owen Pan via cfe-commits
@@ -16797,7 +16792,7 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) { verifyFormat("int f() throw (Deprecated);", SomeSpace2); verifyFormat("typedef void (*cb) (int);", SomeSpace2); verifyFormat("T A::operator()();", SomeSpace2); - // verifyFormat("X A::operator++

[clang-tools-extra] [include-cleaner] Generate references from explicit functiontemplate specializations (PR #83392)

2024-02-29 Thread via cfe-commits
https://github.com/VitaNuo approved this pull request. https://github.com/llvm/llvm-project/pull/83392 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] ddfc7e2 - [clang][Interp] Emit more dummy pointers in C++ mode

2024-02-29 Thread Timm Bäder via cfe-commits
Author: Timm Bäder Date: 2024-02-29T10:04:42+01:00 New Revision: ddfc7e225474558613db3604c053fd73f1fdedac URL: https://github.com/llvm/llvm-project/commit/ddfc7e225474558613db3604c053fd73f1fdedac DIFF: https://github.com/llvm/llvm-project/commit/ddfc7e225474558613db3604c053fd73f1fdedac.diff LO

[clang] [compiler-rt] [AArch64] Implement __builtin_cpu_supports, compiler-rt tests. (PR #82378)

2024-02-29 Thread via cfe-commits
bgra8 wrote: @DanielKristofKiss do I understand correctly that you confirm the current behavior for `__builtin_cpu_supports("unsupported-features")` -- does not compile no matter the CPU -- is a `clang` defect? If that is the case let's file a bug to have this fixed. https://github.com/ll

[clang-tools-extra] bd595d5 - [include-cleaner] Generate references from explicit functiontemplate specializations (#83392)

2024-02-29 Thread via cfe-commits
Author: kadir çetinkaya Date: 2024-02-29T10:37:00+01:00 New Revision: bd595d54219e434acce2c05e97440847d30b5240 URL: https://github.com/llvm/llvm-project/commit/bd595d54219e434acce2c05e97440847d30b5240 DIFF: https://github.com/llvm/llvm-project/commit/bd595d54219e434acce2c05e97440847d30b5240.dif

[clang-tools-extra] [include-cleaner] Generate references from explicit functiontemplate specializations (PR #83392)

2024-02-29 Thread kadir çetinkaya via cfe-commits
https://github.com/kadircet closed https://github.com/llvm/llvm-project/pull/83392 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenMP] Clang Codegen Interop : Accept multiple use & destroy clauses (PR #83398)

2024-02-29 Thread via cfe-commits
https://github.com/SunilKuravinakop created https://github.com/llvm/llvm-project/pull/83398 Modified clang/lib/CodeGen/CGStmtOpenMP.cpp to accept multiple use & destroy clauses with interop directive. Modified clang/test/OpenMP/interop_codegen.cpp to check for the changes. >From d3db4821ad4f6c

[clang] [OpenMP] Clang Codegen Interop : Accept multiple use & destroy clauses (PR #83398)

2024-02-29 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-clang Author: None (SunilKuravinakop) Changes Modified clang/lib/CodeGen/CGStmtOpenMP.cpp to accept multiple use & destroy clauses with interop directive. Modified clang/test/OpenMP/interop_codegen.cpp to check for the

[clang-tools-extra] [clang-tidy] Improve `google-explicit-constructor` checks handling of `explicit(bool)` (PR #82689)

2024-02-29 Thread Benjamin Maxwell via cfe-commits
https://github.com/MacDue updated https://github.com/llvm/llvm-project/pull/82689 >From 6bf8d649fb78b81adbaa7de82064161e14213fc4 Mon Sep 17 00:00:00 2001 From: AMS21 Date: Thu, 22 Feb 2024 22:10:09 +0100 Subject: [PATCH] [clang-tidy] Improve `google-explicit-constructor` checks handling of `ex

[clang-tools-extra] [clang-tidy] Improve `google-explicit-constructor` checks handling of `explicit(bool)` (PR #82689)

2024-02-29 Thread via cfe-commits
https://github.com/AMS21 updated https://github.com/llvm/llvm-project/pull/82689 >From 6bf8d649fb78b81adbaa7de82064161e14213fc4 Mon Sep 17 00:00:00 2001 From: AMS21 Date: Thu, 22 Feb 2024 22:10:09 +0100 Subject: [PATCH] [clang-tidy] Improve `google-explicit-constructor` checks handling of `expl

[clang-tools-extra] [clang-tidy] Let `bugprone-use-after-move` also handle calls to `std::forward` (PR #82673)

2024-02-29 Thread via cfe-commits
https://github.com/AMS21 updated https://github.com/llvm/llvm-project/pull/82673 >From 7dcbbae9656700bde30caf28f8105648e8dfc623 Mon Sep 17 00:00:00 2001 From: AMS21 Date: Thu, 22 Feb 2024 19:24:43 +0100 Subject: [PATCH] [clang-tidy] Let `bugprone-use-after-move` also handle calls to `std::forwa

[clang-tools-extra] [clang-tidy] Let `bugprone-use-after-move` also handle calls to `std::forward` (PR #82673)

2024-02-29 Thread via cfe-commits
AMS21 wrote: Rebased to fix merge conflict https://github.com/llvm/llvm-project/pull/82673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [AArch64] Implement __builtin_cpu_supports, compiler-rt tests. (PR #82378)

2024-02-29 Thread via cfe-commits
DanielKristofKiss wrote: @bgra8 Correct, submitted #83407. https://github.com/llvm/llvm-project/pull/82378 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-29 Thread Matt Arsenault via cfe-commits
arsenm wrote: > But the shared library stuff isn't an issue for AMDGPU, right? No, we don't support shared library linking yet https://github.com/llvm/llvm-project/pull/80475 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[clang] [llvm] [AMDGPU] Add an option to disable unsafe uses of atomic xor (PR #69229)

2024-02-29 Thread Matt Arsenault via cfe-commits
arsenm wrote: > In this case, MMRAs would only help in the sense that you won't need any new > attributes and can just add an MMRA such as `atomic-lowering:fine-grained`. > It's not really what MMRAs were made for (because this attribute doesn't > affect semantics, just lowering style I think?

[clang-tools-extra] [clangd] Remove potential prefix from enum value names (PR #83412)

2024-02-29 Thread Christian Kandeler via cfe-commits
https://github.com/ckandeler created https://github.com/llvm/llvm-project/pull/83412 ... when converting unscoped to scoped enums. With traditional enums, a popular technique to guard against potential name clashes is to use the enum name as a pseudo-namespace, like this: enum MyEnum { MyEnum

[clang-tools-extra] [clangd] Remove potential prefix from enum value names (PR #83412)

2024-02-29 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangd Author: Christian Kandeler (ckandeler) Changes ... when converting unscoped to scoped enums. With traditional enums, a popular technique to guard against potential name clashes is to use the enum name as a pseudo-namespace, like this: enum MyEn

[clang] [llvm] [AMDGPU] Add code model (#70760) test for amdgpu target. (PR #71019)

2024-02-29 Thread Matt Arsenault via cfe-commits
arsenm wrote: reverse ping https://github.com/llvm/llvm-project/pull/71019 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Documentation] fix documentation for clang-format (PR #83415)

2024-02-29 Thread via cfe-commits
https://github.com/PeterChou1 created https://github.com/llvm/llvm-project/pull/83415 Fixes typo in documentation for clang-format see: https://github.com/llvm/llvm-project/issues/83207 >From 67154ff4388447ff78b2912e5635231778ed23d4 Mon Sep 17 00:00:00 2001 From: PeterChou1 <4355+peterch.

[clang] [clang][Documentation] fix documentation for clang-format (PR #83415)

2024-02-29 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

[clang] [clang][Documentation] fix documentation for clang-format (PR #83415)

2024-02-29 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (PeterChou1) Changes Fixes typo in documentation for clang-format see: https://github.com/llvm/llvm-project/issues/83207 --- Full diff: https://github.com/llvm/llvm-project/pull/83415.diff 1 Files Affected: - (modified) clang/doc

[clang] [clang][Documentation] fix documentation for clang-format (PR #83415)

2024-02-29 Thread via cfe-commits
github-actions[bot] wrote: ⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo. Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account. See [LLVM Discourse](https://discourse.llvm.org/t/hidden-em

[clang] [llvm] [AMDGPU] Enable OpenCL hostcall printf (WIP) (PR #72556)

2024-02-29 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm edited https://github.com/llvm/llvm-project/pull/72556 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [AMDGPU] Enable OpenCL hostcall printf (WIP) (PR #72556)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -2550,6 +2550,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, &getTarget().getLongDoubleFormat() == &llvm::APFloat::IEEEquad()) BuiltinID = mutateLongDoubleBuiltin(BuiltinID); + // Mutate the printf builtin ID so that we us

[clang] [llvm] [AMDGPU] Enable OpenCL hostcall printf (WIP) (PR #72556)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -3616,6 +3617,12 @@ unsigned FunctionDecl::getBuiltinID(bool ConsiderWrapperFunctions) const { if (!ConsiderWrapperFunctions && getStorageClass() == SC_Static) return 0; + // AMDGCN implementation supports printf as a builtin + // for OpenCL + if (Context.getTarge

[clang] [llvm] [AMDGPU] Enable OpenCL hostcall printf (WIP) (PR #72556)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -406,5 +410,9 @@ TARGET_BUILTIN(__builtin_amdgcn_cvt_pk_fp8_f32, "iffiIb", "nc", "fp8-insts") TARGET_BUILTIN(__builtin_amdgcn_cvt_sr_bf8_f32, "ifiiIi", "nc", "fp8-insts") TARGET_BUILTIN(__builtin_amdgcn_cvt_sr_fp8_f32, "ifiiIi", "nc", "fp8-insts") +// OpenCL +LANGBUILTIN(p

[clang] [llvm] [AMDGPU] Enable OpenCL hostcall printf (WIP) (PR #72556)

2024-02-29 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm requested changes to this pull request. https://github.com/llvm/llvm-project/pull/72556 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [AMDGPU] Enable OpenCL hostcall printf (WIP) (PR #72556)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -202,12 +207,20 @@ RValue CodeGenFunction::EmitAMDGPUDevicePrintfCallExpr(const CallExpr *E) { Args.push_back(Arg); } - llvm::IRBuilder<> IRB(Builder.GetInsertBlock(), Builder.GetInsertPoint()); - IRB.SetCurrentDebugLocation(Builder.getCurrentDebugLocation()); + a

[clang] [llvm] [AMDGPU] Enable OpenCL hostcall printf (WIP) (PR #72556)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -202,12 +207,20 @@ RValue CodeGenFunction::EmitAMDGPUDevicePrintfCallExpr(const CallExpr *E) { Args.push_back(Arg); } - llvm::IRBuilder<> IRB(Builder.GetInsertBlock(), Builder.GetInsertPoint()); - IRB.SetCurrentDebugLocation(Builder.getCurrentDebugLocation()); + a

[clang] [llvm] [AMDGPU] Enable OpenCL hostcall printf (WIP) (PR #72556)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -170,20 +173,46 @@ static Value *appendString(IRBuilder<> &Builder, Value *Desc, Value *Arg, return callAppendStringN(Builder, Desc, Arg, Length, IsLast); } +static Value *appendVectorArg(IRBuilder<> &Builder, Value *Desc, Value *Arg, arsenm wrote: Thes

[clang] [clang] Bugfix for choosing the more specialized overload (PR #83279)

2024-02-29 Thread Botond István Horváth via cfe-commits
@@ -5548,13 +5504,100 @@ static bool isAtLeastAsSpecializedAs(Sema &S, FunctionTemplateDecl *Sema::getMoreSpecializedTemplate( FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, -

[clang] [clang][analyzer] Add StreamChecker note tags for "indeterminate stream position". (PR #83288)

2024-02-29 Thread via cfe-commits
@@ -313,6 +232,9 @@ class StreamChecker : public Checkerhttps://github.com/llvm/llvm-project/pull/83288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Add StreamChecker note tags for "indeterminate stream position". (PR #83288)

2024-02-29 Thread via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/83288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Add StreamChecker note tags for "indeterminate stream position". (PR #83288)

2024-02-29 Thread via cfe-commits
@@ -607,6 +564,103 @@ class StreamChecker : public Checkerget(StreamSym); +if (!SS) + return false; +NewES = SS->ErrorState; +CE = dyn_cast_or_null(Call.getOriginExpr()); +if (!CE) + return false; + +assertStreamStateOpened(SS); + +return true; +

[clang] [clang][analyzer] Add StreamChecker note tags for "indeterminate stream position". (PR #83288)

2024-02-29 Thread via cfe-commits
https://github.com/NagyDonat approved this pull request. The change looks reasonable, I only have minor remarks. Re: your question about changing the warning message, I think that removing the single quotes around 'indeterminate' is probably a good idea, but the current message is also OK. h

[clang] [clang][analyzer] Add StreamChecker note tags for "indeterminate stream position". (PR #83288)

2024-02-29 Thread via cfe-commits
@@ -218,87 +218,6 @@ inline void assertStreamStateOpened(const StreamState *SS) { assert(SS->isOpened() && "Stream is expected to be opened"); } -struct StreamOperationEvaluator { NagyDonat wrote: Why are you moving the definition of this struct? (Feel fre

[clang] [clang][analyzer] Change default value of checker option in unix.StdCLibraryFunctions. (PR #80457)

2024-02-29 Thread via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/80457 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Change default value of checker option in unix.StdCLibraryFunctions. (PR #80457)

2024-02-29 Thread via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, I think that it isn't necessary to rerun the tests. I have one very minor suggestion to slightly improve the documentation. https://github.com/llvm/llvm-project/pull/80457 ___ cfe-commits

[clang] [clang][analyzer] Change default value of checker option in unix.StdCLibraryFunctions. (PR #80457)

2024-02-29 Thread via cfe-commits
@@ -1299,10 +1299,21 @@ range of the argument. **Parameters** -The checker models functions (and emits diagnostics) from the C standard by -default. The ``ModelPOSIX`` option enables modeling (and emit diagnostics) of -additional functions that are defined in the POSIX standa

[clang] [Concepts] Consider outer scope Decls for conversion function constraints (PR #83420)

2024-02-29 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/83420 This fixes the case shown by https://github.com/llvm/llvm-project/issues/64808#issuecomment-1929129271. Similar to https://github.com/llvm/llvm-project/commit/f9caa12328b265b77221fe7a310d4504673d814a, we have

[clang] [llvm] [clang] Use separator for large numeric values in overflow diagnostic (PR #80939)

2024-02-29 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: You should also add a release note to `clang/docs/ReleaseNotes.rst` to tell users about the improved diagnostic behavior. Aside from some small nits, this looks really close to ready! https://github.com/llvm/llvm-project/pull/80939 ___

[clang] [llvm] [clang] Use separator for large numeric values in overflow diagnostic (PR #80939)

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

[clang] [llvm] [clang] Use separator for large numeric values in overflow diagnostic (PR #80939)

2024-02-29 Thread Aaron Ballman via cfe-commits
@@ -2223,9 +2227,14 @@ void APInt::toString(SmallVectorImpl &Str, unsigned Radix, bool Signed, ++Prefix; }; +int Pos = 0; while (N) { + if (insertSeparators && Pos % Grouping == 0 && Pos > 0) { +*--BufPtr = '\''; + } Aaron

[clang] [llvm] [clang] Use separator for large numeric values in overflow diagnostic (PR #80939)

2024-02-29 Thread Aaron Ballman via cfe-commits
@@ -2161,7 +2161,8 @@ void APInt::fromString(unsigned numbits, StringRef str, uint8_t radix) { } void APInt::toString(SmallVectorImpl &Str, unsigned Radix, bool Signed, - bool formatAsCLiteral, bool UpperCase) const { + bool formatAsCLi

[clang] [llvm] [clang] Use separator for large numeric values in overflow diagnostic (PR #80939)

2024-02-29 Thread Aaron Ballman via cfe-commits
@@ -329,9 +329,10 @@ inline std::string itostr(int64_t X) { } inline std::string toString(const APInt &I, unsigned Radix, bool Signed, -bool formatAsCLiteral = false) { +bool formatAsCLiteral = false, +

[clang] [llvm] [clang] Use separator for large numeric values in overflow diagnostic (PR #80939)

2024-02-29 Thread Aaron Ballman via cfe-commits
@@ -2257,17 +2266,27 @@ void APInt::toString(SmallVectorImpl &Str, unsigned Radix, bool Signed, unsigned ShiftAmt = (Radix == 16 ? 4 : (Radix == 8 ? 3 : 1)); unsigned MaskAmt = Radix - 1; +int Pos = 0; while (Tmp.getBoolValue()) { unsigned Digit = unsi

[clang] [llvm] [clang] Use separator for large numeric values in overflow diagnostic (PR #80939)

2024-02-29 Thread Aaron Ballman via cfe-commits
@@ -1626,7 +1626,8 @@ class [[nodiscard]] APInt { /// SmallString. If Radix > 10, UpperCase determine the case of letter /// digits. void toString(SmallVectorImpl &Str, unsigned Radix, bool Signed, -bool formatAsCLiteral = false, bool UpperCase = true) con

[clang] [llvm] [clang] Use separator for large numeric values in overflow diagnostic (PR #80939)

2024-02-29 Thread Aaron Ballman via cfe-commits
@@ -2257,17 +2266,27 @@ void APInt::toString(SmallVectorImpl &Str, unsigned Radix, bool Signed, unsigned ShiftAmt = (Radix == 16 ? 4 : (Radix == 8 ? 3 : 1)); unsigned MaskAmt = Radix - 1; +int Pos = 0; while (Tmp.getBoolValue()) { unsigned Digit = unsi

[clang] [llvm] [clang] Use separator for large numeric values in overflow diagnostic (PR #80939)

2024-02-29 Thread Aaron Ballman via cfe-commits
@@ -1379,6 +1379,23 @@ TEST(APIntTest, toString) { EXPECT_EQ(std::string(S), "0"); S.clear(); + // with separators + APInt(64, 140).toString(S, 2, false, true, false, true); + EXPECT_EQ(std::string(S), "0b1000'1100"); + S.clear(); + APInt(64, 1024).toString(S, 8, fals

[clang] [clang][analyzer] Change default value of checker option in unix.StdCLibraryFunctions. (PR #80457)

2024-02-29 Thread via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/80457 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Clang should detect illegal copy constructor with template class as its parameter (PR #81251)

2024-02-29 Thread Rajveer Singh Bharadwaj via cfe-commits
Rajveer100 wrote: I have removed this entirely, although it still may not be optimal, it did reduce few more test failures: ```C++ Constructor->getTemplateSpecializationKind() != TSK_ImplicitInstantiation ``` Any particular suggestions apart from updating the tests? https://github.c

[clang] [Concepts] Add Decls from the outer scope of the current lambda for conversion function constraints (PR #83420)

2024-02-29 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/83420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Concepts] Add Decls from the outer scope of the current lambda for conversion function constraints (PR #83420)

2024-02-29 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/83420 >From 072d2aa8b758d61e0459bd626fbea881c3e1596c Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Thu, 29 Feb 2024 19:47:01 +0800 Subject: [PATCH] [Concepts] Consider outer scope Decls for conversion function con

[clang] [Concepts] Add Decls from the outer scope of the current lambda for conversion function constraints (PR #83420)

2024-02-29 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 edited https://github.com/llvm/llvm-project/pull/83420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] e08fe57 - [NFC][ARM][AArch64] Deduplicated code. (#82785)

2024-02-29 Thread via cfe-commits
Author: Dani Date: 2024-02-29T14:05:37+01:00 New Revision: e08fe575d5953b6ca0d7a578c1afa00247f0a12f URL: https://github.com/llvm/llvm-project/commit/e08fe575d5953b6ca0d7a578c1afa00247f0a12f DIFF: https://github.com/llvm/llvm-project/commit/e08fe575d5953b6ca0d7a578c1afa00247f0a12f.diff LOG: [NF

[clang] [NFC][ARM][AArch64] Deduplicated code. (PR #82785)

2024-02-29 Thread via cfe-commits
https://github.com/DanielKristofKiss closed https://github.com/llvm/llvm-project/pull/82785 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [AMDGPU] Add an option to disable unsafe uses of atomic xor (PR #69229)

2024-02-29 Thread Pierre-Andre Saulais via cfe-commits
pasaulais wrote: > > In this case, MMRAs would only help in the sense that you won't need any > > new attributes and can just add an MMRA such as > > `atomic-lowering:fine-grained`. It's not really what MMRAs were made for > > (because this attribute doesn't affect semantics, just lowering sty

[clang] [clang][dataflow] Correctly treat empty initializer lists for unions. (PR #82986)

2024-02-29 Thread via cfe-commits
@@ -685,9 +685,22 @@ class TransferVisitor : public ConstStmtVisitor { // `S->inits()` contains all the initializer expressions, including the // ones for direct base classes. -auto Inits = S->inits(); +ArrayRef Inits = S->inits(); size_t InitIdx = 0; +

[clang] [clang][dataflow] Correctly treat empty initializer lists for unions. (PR #82986)

2024-02-29 Thread via cfe-commits
https://github.com/martinboehme updated https://github.com/llvm/llvm-project/pull/82986 >From cd64b0e04026235283016eaf1cd601076ab7aeb2 Mon Sep 17 00:00:00 2001 From: Martin Braenne Date: Tue, 27 Feb 2024 18:23:36 + Subject: [PATCH 1/3] Reapply "[clang][dataflow] Correctly handle `InitListE

[clang] [clang][dataflow] Correctly treat empty initializer lists for unions. (PR #82986)

2024-02-29 Thread via cfe-commits
@@ -2392,14 +2392,88 @@ TEST(TransferTest, InitListExprAsUnion) { } F; public: - constexpr target() : F{nullptr} {} + constexpr target() : F{nullptr} { +int *null = nullptr; +F.b; // Make sure we reference 'b' so it is modeled. +//

[clang] [clang][dataflow] Correctly treat empty initializer lists for unions. (PR #82986)

2024-02-29 Thread via cfe-commits
@@ -2392,14 +2392,88 @@ TEST(TransferTest, InitListExprAsUnion) { } F; public: - constexpr target() : F{nullptr} {} + constexpr target() : F{nullptr} { +int *null = nullptr; +F.b; // Make sure we reference 'b' so it is modeled. +//

[clang] [llvm] [AMDGPU] Add an option to disable unsafe uses of atomic xor (PR #69229)

2024-02-29 Thread Matt Arsenault via cfe-commits
arsenm wrote: > @arsenm That makes sense, I don't think MMRA fits the fine-grained use case > either. Does that mean we can stick with the approach from this PR? @b-sumner > mentioned there was another similar approach being worked on. Something like this, but the naming and direction of this

[clang] [llvm] [AMDGPU] Emit a waitcnt instruction after each memory instruction (PR #79236)

2024-02-29 Thread Matt Arsenault via cfe-commits
@@ -2561,6 +2567,70 @@ bool SIMemoryLegalizer::expandAtomicCmpxchgOrRmw(const SIMemOpInfo &MOI, return Changed; } +bool SIMemoryLegalizer::GFX9InsertWaitcntForPreciseMem(MachineFunction &MF) { + const GCNSubtarget &ST = MF.getSubtarget(); + const SIInstrInfo *TII = ST.get

[clang] [HIP] fix host min/max in header (PR #82956)

2024-02-29 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > > Probably I need to define those functions with mixed args by default to > > avoid regressions. > > Are there any other regressions? Can hupCUB be fixed instead? While their use > case is probably benign, I'd rather fix the user code, than propagate CUDA > bugs into HIP. S

[clang] [llvm] [AMDGPU]: Add and codegen sched_group_barrier_inst (PR #78775)

2024-02-29 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm commented: I don't really understand all of these manual scheduling control intrinsic. This brings the total up to 4? I think effort would be better spent making the scheduler better instead of giving users more footguns to shoot themselves (and the compiler) with ht

[clang] [clang-cl] Fix value of __FUNCTION__ in MSVC mode. (PR #67592)

2024-02-29 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/19] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

[clang] [Concepts] Add Decls from the outer scope of the current lambda for conversion function constraints (PR #83420)

2024-02-29 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 ready_for_review https://github.com/llvm/llvm-project/pull/83420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Concepts] Add Decls from the outer scope of the current lambda for conversion function constraints (PR #83420)

2024-02-29 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Younan Zhang (zyn0217) Changes This fixes the case shown by https://github.com/llvm/llvm-project/issues/64808#issuecomment-1929131611. Similar to https://github.com/llvm/llvm-project/commit/f9caa12328b265b77221fe7a310d4504673d814a, we h

[clang] 86f4b4d - [OpenACC] Implement Compute Construct 'goto' in/out logic (#83326)

2024-02-29 Thread via cfe-commits
Author: Erich Keane Date: 2024-02-29T06:06:57-08:00 New Revision: 86f4b4dfde543287c1b29ecae27cc1bee470eebb URL: https://github.com/llvm/llvm-project/commit/86f4b4dfde543287c1b29ecae27cc1bee470eebb DIFF: https://github.com/llvm/llvm-project/commit/86f4b4dfde543287c1b29ecae27cc1bee470eebb.diff L

[clang] [OpenACC] Implement Compute Construct 'goto' in/out logic (PR #83326)

2024-02-29 Thread Erich Keane via cfe-commits
https://github.com/erichkeane closed https://github.com/llvm/llvm-project/pull/83326 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 6f7d824 - [Clang][Sema]: Diagnose lambda to bool implicit casts (#83152)

2024-02-29 Thread via cfe-commits
Author: Vinayak Dev Date: 2024-02-29T09:09:39-05:00 New Revision: 6f7d824b804b272335d55f5b899295db833f3829 URL: https://github.com/llvm/llvm-project/commit/6f7d824b804b272335d55f5b899295db833f3829 DIFF: https://github.com/llvm/llvm-project/commit/6f7d824b804b272335d55f5b899295db833f3829.diff L

[clang] [Clang][Sema]: Diagnose lambda to bool implicit casts (PR #83152)

2024-02-29 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman closed https://github.com/llvm/llvm-project/pull/83152 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenMP] Clang Codegen Interop : Accept multiple use & destroy clauses (PR #83398)

2024-02-29 Thread Alexey Bataev via cfe-commits
https://github.com/alexey-bataev approved this pull request. LG https://github.com/llvm/llvm-project/pull/83398 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer]Add C++ polymorphic ptr arithmetic checker (PR #82977)

2024-02-29 Thread via cfe-commits
Discookie wrote: That's a great heuristic! I wonder if there are false positives for this in the wild, will need to test on some projects. I don't know about implementing it as a Clang warning - it probably wouldn't cause much of a performance penalty, but I'm not sure about the other require

[clang] [HIP] fix host min/max in header (PR #82956)

2024-02-29 Thread Yaxun Liu via cfe-commits
yxsamliu wrote: > > > Probably I need to define those functions with mixed args by default to > > > avoid regressions. > > > > > > Are there any other regressions? Can hupCUB be fixed instead? While their > > use case is probably benign, I'd rather fix the user code, than propagate > > CUDA

[clang] [Clang][Sema] Fix NULL dereferences for invalid references (PR #77703)

2024-02-29 Thread Erich Keane via cfe-commits
erichkeane wrote: Yeah, this doesn't seem right to me. Info is a reference, and thus cannot be null by language rule. A sufficiently smart compiler will remove your check. If we're SOMEHOW (though I don't see how?) setting it to nullptr, we need to fix that as that is not intended, nor part

[clang] [clang] Bugfix for choosing the more specialized overload (PR #83279)

2024-02-29 Thread Erich Keane via cfe-commits
Botond =?utf-8?q?István_Horváth?=,Botond Istvan Horvath Message-ID: In-Reply-To: @@ -5548,13 +5504,100 @@ static bool isAtLeastAsSpecializedAs(Sema &S, FunctionTemplateDecl *Sema::getMoreSpecializedTemplate( FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLoc

[clang] [Concepts] Add Decls from the outer scope of the current lambda for conversion function constraints (PR #83420)

2024-02-29 Thread Erich Keane via cfe-commits
@@ -7976,7 +7976,8 @@ void Sema::AddConversionCandidate( if (Conversion->getTrailingRequiresClause()) { ConstraintSatisfaction Satisfaction; -if (CheckFunctionConstraints(Conversion, Satisfaction) || +if (CheckFunctionConstraints(Conversion, Satisfaction, /*Usage

[clang] [clang] Bugfix for choosing the more specialized overload (PR #83279)

2024-02-29 Thread Botond István Horváth via cfe-commits
@@ -5548,13 +5504,100 @@ static bool isAtLeastAsSpecializedAs(Sema &S, FunctionTemplateDecl *Sema::getMoreSpecializedTemplate( FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, -

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread via cfe-commits
https://github.com/overmighty created https://github.com/llvm/llvm-project/pull/83431 Fixes #83075, #83076. >From 3dbfd1fb21ef0ddccef27e1ceffce16dc298e1cf Mon Sep 17 00:00:00 2001 From: OverMighty Date: Thu, 29 Feb 2024 14:23:40 + Subject: [PATCH] [clang] Implement __builtin_{clzg,ctzg}

[clang] [clang] Bugfix for choosing the more specialized overload (PR #83279)

2024-02-29 Thread Botond István Horváth via cfe-commits
https://github.com/HoBoIs updated https://github.com/llvm/llvm-project/pull/83279 From 68200ecf3267d1b3940fa73c25c50ee706932a98 Mon Sep 17 00:00:00 2001 From: Botond Istvan Horvath Date: Wed, 28 Feb 2024 13:09:15 +0100 Subject: [PATCH 1/4] Bugfix for choosing the more specialized overload Ther

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: OverMighty (overmighty) Changes Fixes #83075, #83076. --- Patch is 26.95 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/83431.diff 9 Files Affected: - (modified) clang/docs/Language

[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

2024-02-29 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: OverMighty (overmighty) Changes Fixes #83075, #83076. --- Patch is 26.95 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/83431.diff 9 Files Affected: - (modified) clang/docs/LanguageExtensio

[clang] [clang] Bugfix for choosing the more specialized overload (PR #83279)

2024-02-29 Thread Botond István Horváth via cfe-commits
@@ -5548,13 +5504,100 @@ static bool isAtLeastAsSpecializedAs(Sema &S, FunctionTemplateDecl *Sema::getMoreSpecializedTemplate( FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, -

  1   2   3   4   >