[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-28 Thread John McCall via cfe-commits
@@ -8511,7 +8514,7 @@ static void HandleHLSLParamModifierAttr(QualType &CurType, return; if (Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_inout || Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_out) -CurType = S.getASTContext().getL

[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)

2024-08-28 Thread Björn Schäpers via cfe-commits
@@ -1493,6 +1511,18 @@ static auto computeNewlines(const AnnotatedLine &Line, Newlines = 1; } + // Insert empty line after "{" that opens namespace scope + if (Style.WrapNamespaceBodyWithNewlines && + LineStartsNamespaceScope(&Line, PreviousLine, PrevPrevLine)) {

[clang] [clang] Check inline defs when emitting speculative vtable (PR #100785)

2024-08-28 Thread Fabian Parzefall via cfe-commits
FPar wrote: Yes, that sums it up well. I will see to adding a patch clarifying this in the source. Thank you! https://github.com/llvm/llvm-project/pull/100785 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [clang] Check inline defs when emitting speculative vtable (PR #100785)

2024-08-28 Thread Fabian Parzefall via cfe-commits
https://github.com/FPar updated https://github.com/llvm/llvm-project/pull/100785 >From 0f43c9933022ec825bfe3ede5c1622900eb86691 Mon Sep 17 00:00:00 2001 From: Fabian Parzefall Date: Fri, 26 Jul 2024 10:46:22 -0700 Subject: [PATCH] [clang] Check inline defs when emitting speculative vtable Clang

[clang-tools-extra] [include-cleaner] Mark RecordDecls referenced in UsingDecls as explicit (PR #106430)

2024-08-28 Thread kadir çetinkaya via cfe-commits
https://github.com/kadircet created https://github.com/llvm/llvm-project/pull/106430 We were reporting ambigious references from using declarations as user can be depending on different overloads of a function just because they are visible in the TU. This doesn't apply to records, or primary tem

[clang] [llvm] [ValueTracking] use KnownBits to compute fpclass from bitcast (PR #97762)

2024-08-28 Thread via cfe-commits
@@ -5921,6 +5921,61 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts, break; } + case Instruction::BitCast: { +const Value *Src; +if (!match(Op, m_ElementWiseBitCast(m_Value(Src))) || +!Src->getType()->isIntOrIntVectorTy()) + b

[clang] [llvm] [ValueTracking] use KnownBits to compute fpclass from bitcast (PR #97762)

2024-08-28 Thread via cfe-commits
@@ -5921,6 +5921,61 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts, break; } + case Instruction::BitCast: { +const Value *Src; +if (!match(Op, m_ElementWiseBitCast(m_Value(Src))) || +!Src->getType()->isIntOrIntVectorTy()) + b

[clang-tools-extra] [include-cleaner] Mark RecordDecls referenced in UsingDecls as explicit (PR #106430)

2024-08-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-tools-extra Author: kadir çetinkaya (kadircet) Changes We were reporting ambigious references from using declarations as user can be depending on different overloads of a function just because they are visible in the TU. This doesn't apply to recor

[clang] [llvm] [ValueTracking] use KnownBits to compute fpclass from bitcast (PR #97762)

2024-08-28 Thread via cfe-commits
@@ -5921,6 +5921,61 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts, break; } + case Instruction::BitCast: { +const Value *Src; +if (!match(Op, m_ElementWiseBitCast(m_Value(Src))) || +!Src->getType()->isIntOrIntVectorTy()) + b

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-08-28 Thread Dan Liew via cfe-commits
@@ -2440,6 +2440,26 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { return !isFunctionType(); } + /// \returns True if the type is incomplete and it is also a type that + /// cannot be completed by a later type definition. + /// + /// E.g. For

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Remove Move Constructor of MMI + Make MMI Only Use and Externally-Created MCContext (PR #105541)

2024-08-28 Thread Arthur Eubanks via cfe-commits
aeubanks wrote: I'm just back from vacation, taking a look looks like this has merge conflicts could you simplify the commit title (maybe move some details into the description) https://github.com/llvm/llvm-project/pull/105541 ___ cfe-commits mailin

[clang] [lldb] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

2024-08-28 Thread Rahul Joshi via cfe-commits
https://github.com/jurahul updated https://github.com/llvm/llvm-project/pull/105745 >From d805dcdc44d22bb21d086b186cc7f644323f68ef Mon Sep 17 00:00:00 2001 From: Rahul Joshi Date: Thu, 22 Aug 2024 08:47:02 -0700 Subject: [PATCH] [Support] Detect invalid formatv() calls - Detect formatv() calls

[clang] [HLSL][Doc] Document multi-argument resolution (PR #104474)

2024-08-28 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/104474 >From a68223e1d0ee5e1b41ea7ec2385c9d581c901e70 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 15 Aug 2024 12:03:55 -0500 Subject: [PATCH 1/3] [HLSL][Doc] Document multi-argument resolution This upd

[clang] [WIP][clang] Fix std::tm etc. mangling on Solaris (PR #106353)

2024-08-28 Thread Rainer Orth via cfe-commits
rorth wrote: > clang/docs/ReleaseNotes.rst Ah, that. I was thinking of the GNU style `ChangeLog` files. Done locally; will push once the remaining mangling error has been fleshed out. https://github.com/llvm/llvm-project/pull/106353 ___ cfe-commits

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-08-28 Thread Dan Liew via cfe-commits
@@ -2438,6 +2438,22 @@ bool Type::isIncompleteType(NamedDecl **Def) const { } } +bool Type::isIncompletableIncompleteType() const { + if (!isIncompleteType()) +return false; + + // Forward declarations of structs, classes, enums, and unions could be later + // complet

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-08-28 Thread Dan Liew via cfe-commits
@@ -2438,6 +2438,22 @@ bool Type::isIncompleteType(NamedDecl **Def) const { } } +bool Type::isIncompletableIncompleteType() const { + if (!isIncompleteType()) +return false; + + // Forward declarations of structs, classes, enums, and unions could be later + // complet

[clang] [clang] Improve diagnostics with incompatible VLA types (PR #101261)

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

[clang] [clang] Improve diagnostics with incompatible VLA types (PR #101261)

2024-08-28 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for working on this! You should also add a release note to `clang/docs/ReleaseNotes.rst` so users know about the diagnostic improvement. https://github.com/llvm/llvm-project/pull/101261 ___ cfe-comm

[clang] [clang] Improve diagnostics with incompatible VLA types (PR #101261)

2024-08-28 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void func(int n) { +int grp[n][n]; +int (*ptr)[n]; + +for (int i = 0; i < n; i++) +ptr = &grp[i]; // expected-error {{incompatible pointer types assigning to 'int (*)[n]' from 'int (*)[n]'; VLA ty

[clang] [clang] Improve diagnostics with incompatible VLA types (PR #101261)

2024-08-28 Thread Aaron Ballman via cfe-commits
@@ -1099,37 +1099,49 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd, const char *FirstDollar = ScanFormat(Argument, ArgumentEnd, '$'); const char *SecondDollar = ScanFormat(FirstDollar + 1, ArgumentEnd, '$'); - // Append before text - Forma

[clang] `__noop` not marked as constexpr #102064 (PR #105983)

2024-08-28 Thread via cfe-commits
@@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -std=c++20 -fms-extensions %s +// expected-no-diagnostics +constexpr int x = []{ __noop; return 0; }(); cor3ntin wrote: oh, because it's a MSVC extensions you can write ``` #ifdef _MSC_VER constexpr int x = []{ __noop; return

[clang] 2d1fba6 - [NVPTX] Support __usAtomicCAS builtin (#99646)

2024-08-28 Thread via cfe-commits
Author: Denis.G Date: 2024-08-28T12:01:35-07:00 New Revision: 2d1fba67c54b7c6b7f57635f863d4e1cd5fcc048 URL: https://github.com/llvm/llvm-project/commit/2d1fba67c54b7c6b7f57635f863d4e1cd5fcc048 DIFF: https://github.com/llvm/llvm-project/commit/2d1fba67c54b7c6b7f57635f863d4e1cd5fcc048.diff LOG:

[clang] [llvm] [NVPTX] Support __usAtomicCAS builtin (PR #99646)

2024-08-28 Thread Artem Belevich via cfe-commits
https://github.com/Artem-B closed https://github.com/llvm/llvm-project/pull/99646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [NVPTX] Support __usAtomicCAS builtin (PR #99646)

2024-08-28 Thread via cfe-commits
github-actions[bot] wrote: @DenisGZM Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with a build

[clang] [OpenMP][NFC] Remove executable cases from declaration switch (PR #106438)

2024-08-28 Thread Mike Rice via cfe-commits
https://github.com/mikerice1969 created https://github.com/llvm/llvm-project/pull/106438 The executable directives are handled earlier. >From 3a7f341c33c0f91f2ca6f31762e71fcae6f1a69d Mon Sep 17 00:00:00 2001 From: Mike Rice Date: Wed, 28 Aug 2024 11:38:12 -0700 Subject: [PATCH] [OpenMP][NFC] R

[clang] [OpenMP][NFC] Remove executable cases from declaration switch (PR #106438)

2024-08-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Mike Rice (mikerice1969) Changes The executable directives are handled earlier. --- Full diff: https://github.com/llvm/llvm-project/pull/106438.diff 1 Files Affected: - (modified) clang/lib/Parse/ParseOpenMP.cpp (-2) ``diff d

[clang] [lldb] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

2024-08-28 Thread Rahul Joshi via cfe-commits
jurahul wrote: I have uploaded a new version where the validation is enabled only in debug builds, and also added a benchmark for formatv(). On my machine, the benchmark results are as follows: ``` Old: BM_FormatVariadic_mean 3427456 ns 3427426 ns 10 New BM_FormatVariadic_

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-08-28 Thread Dan Liew via cfe-commits
@@ -186,4 +218,370 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, return false; } +SourceRange Sema::BoundsSafetySourceRangeFor(const CountAttributedType *CATy) { + // Note: This implementation relies on `CountAttributedType` being uniqu

[clang] Revert "[LinkerWrapper] Extend with usual pass options (#96704)" (PR #102226)

2024-08-28 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: #106439 https://github.com/llvm/llvm-project/pull/102226 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][Doc] Document multi-argument resolution (PR #104474)

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

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-08-28 Thread Dan Liew via cfe-commits
@@ -8192,6 +8192,14 @@ ExprResult InitializationSequence::Perform(Sema &S, Kind.getRange().getEnd()); } else { CurInit = new (S.Context) ImplicitValueInitExpr(Step->Type); +// Note the return value isn't used to return early +// to pres

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-08-28 Thread Dan Liew via cfe-commits
@@ -186,4 +218,370 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, return false; } +SourceRange Sema::BoundsSafetySourceRangeFor(const CountAttributedType *CATy) { + // Note: This implementation relies on `CountAttributedType` being uniqu

[clang] [clang] mangle placeholder for deduced type as a template-prefix (PR #106335)

2024-08-28 Thread via cfe-commits
@@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -std=c++20 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s + +template class S> +void create_unique() + requires (S{0}, true) {} + +template struct A { + constexpr A(Fn) {}; +}; + +template void create_unique(); +// CHECK: @_

[clang-tools-extra] [include-cleaner] Mark RecordDecls referenced in UsingDecls as explicit (PR #106430)

2024-08-28 Thread Haojian Wu via cfe-commits
@@ -203,7 +203,7 @@ class ASTWalker : public RecursiveASTVisitor { bool VisitUsingDecl(UsingDecl *UD) { for (const auto *Shadow : UD->shadows()) { auto *TD = Shadow->getTargetDecl(); - auto IsUsed = TD->isUsed() || TD->isReferenced(); + auto IsUsed = TD->i

[clang-tools-extra] [include-cleaner] Mark RecordDecls referenced in UsingDecls as explicit (PR #106430)

2024-08-28 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. https://github.com/llvm/llvm-project/pull/106430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Check inline defs when emitting speculative vtable (PR #100785)

2024-08-28 Thread Fabian Parzefall via cfe-commits
https://github.com/FPar updated https://github.com/llvm/llvm-project/pull/100785 >From 13f60e1835c2a5876fa873fc5b4087f942a90316 Mon Sep 17 00:00:00 2001 From: Fabian Parzefall Date: Fri, 26 Jul 2024 10:46:22 -0700 Subject: [PATCH] [clang] Check inline defs when emitting speculative vtable Clang

[clang] [clang] mangle placeholder for deduced type as a template-prefix (PR #106335)

2024-08-28 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -std=c++20 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s + +template class S> +void create_unique() + requires (S{0}, true) {} + +template struct A { + constexpr A(Fn) {}; +}; + +template void create_unique(); +// CHECK: @_

[clang] [Clang] prevent assertion failure when converting vectors to int/float with invalid expressions (PR #105727)

2024-08-28 Thread Oleksandr T. via cfe-commits
https://github.com/a-tarasyuk updated https://github.com/llvm/llvm-project/pull/105727 >From d8bed3f4db8056a6afa9bd7eae5d4a8361f83086 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Thu, 22 Aug 2024 23:25:31 +0300 Subject: [PATCH 1/2] [Clang] prevent assertion failure when converting vectors

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-28 Thread Amr Hesham via cfe-commits
https://github.com/AmrDeveloper updated https://github.com/llvm/llvm-project/pull/105930 >From 67beeaf5cf48372351e914519e7b0af3b94769b1 Mon Sep 17 00:00:00 2001 From: AmrDeveloper Date: Sat, 24 Aug 2024 10:08:23 +0200 Subject: [PATCH] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use

[clang] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)

2024-08-28 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,103 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// TODO: Implement "Buffer" +struct Eg1 { + float f; + // Buffer Buf; + RWBuffer RWBuf; + }; +Eg1 e1 : /* register(t0) :*/ register(u0); +// Valid: f is skip

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-28 Thread Amr Hesham via cfe-commits
@@ -15,49 +15,49 @@ // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF,SPIR_CHECK #ifdef __HLSL_ENABLE_16_BIT -// DXIL_NATIVE_HALF: %dx.umad = call i16 @llvm.dx.umad.i16(i16 %0, i16 %1, i16 %2) +// DXIL_NATIVE_HALF: %dx.umad = call i16 @llvm.[[ICF:dx]].umad.i16(i16

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-28 Thread Amr Hesham via cfe-commits
AmrDeveloper wrote: > Looks great, thanks! Do you need someone to commit this for you? Yes please, i don't have commit access yet :D https://github.com/llvm/llvm-project/pull/105930 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-08-28 Thread Dan Liew via cfe-commits
@@ -3862,6 +3878,27 @@ CountAttributedType::CountAttributedType( DeclSlot[i] = CoupledDecls[i]; } +StringRef CountAttributedType::GetAttributeName(bool WithMacroPrefix) const { delcypher wrote: > but the way this works for AttributedTypes is that the Att

[clang] [llvm] [CodeView] Flatten cmd args in frontend for LF_BUILDINFO (PR #106369)

2024-08-28 Thread Alexandre Ganea via cfe-commits
https://github.com/aganea edited https://github.com/llvm/llvm-project/pull/106369 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [CodeView] Flatten cmd args in frontend for LF_BUILDINFO (PR #106369)

2024-08-28 Thread Alexandre Ganea via cfe-commits
https://github.com/aganea commented: Sounds good, but please correct the failing BuildKit tests (below) before we can go further. https://github.com/llvm/llvm-project/pull/106369 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[clang] [llvm] [CodeView] Flatten cmd args in frontend for LF_BUILDINFO (PR #106369)

2024-08-28 Thread Alexandre Ganea via cfe-commits
@@ -91,8 +91,11 @@ class MCTargetOptions { std::string SplitDwarfFile; std::string AsSecureLogFile; - const char *Argv0 = nullptr; - ArrayRef CommandLineArgs; + // This will be set as compiler path in LF_BUILDINFO aganea wrote: You would need to refer

[clang] [llvm] [CodeView] Flatten cmd args in frontend for LF_BUILDINFO (PR #106369)

2024-08-28 Thread Alexandre Ganea via cfe-commits
@@ -321,6 +322,41 @@ static bool actionRequiresCodeGen(BackendAction Action) { Action != Backend_EmitLL; } +static std::string flattenClangCommandLine(ArrayRef Args, + StringRef MainFilename) { + std::string FlatCmdLine; + raw_st

[clang] [llvm] [CodeView] Flatten cmd args in frontend for LF_BUILDINFO (PR #106369)

2024-08-28 Thread Alexandre Ganea via cfe-commits
https://github.com/aganea edited https://github.com/llvm/llvm-project/pull/106369 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-08-28 Thread Dan Liew via cfe-commits
@@ -186,4 +218,370 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, return false; } +SourceRange Sema::BoundsSafetySourceRangeFor(const CountAttributedType *CATy) { delcypher wrote: Yeah this isn't great. The whole functio

[clang] aa7497a - [clang] check deduction consistency when partial ordering function templates (#100692)

2024-08-28 Thread via cfe-commits
Author: Matheus Izvekov Date: 2024-08-28T16:53:40-03:00 New Revision: aa7497a66c4272669fa63f7ec61a3f01aa9dabaf URL: https://github.com/llvm/llvm-project/commit/aa7497a66c4272669fa63f7ec61a3f01aa9dabaf DIFF: https://github.com/llvm/llvm-project/commit/aa7497a66c4272669fa63f7ec61a3f01aa9dabaf.dif

[clang] [clang] check deduction consistency when partial ordering function templates (PR #100692)

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

[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #94981)

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

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-08-28 Thread Dan Liew via cfe-commits
@@ -8192,6 +8192,14 @@ ExprResult InitializationSequence::Perform(Sema &S, Kind.getRange().getEnd()); } else { CurInit = new (S.Context) ImplicitValueInitExpr(Step->Type); +// Note the return value isn't used to return early +// to pres

[clang] [llvm] [NVPTX] Support __usAtomicCAS builtin (PR #99646)

2024-08-28 Thread LLVM Continuous Integration via cfe-commits
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `sanitizer-x86_64-linux` running on `sanitizer-buildbot2` while building `clang,llvm` at step 2 "annotate". Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/3180 Here is the relevant piece of

[clang] e99aa4a - [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (#105930)

2024-08-28 Thread via cfe-commits
Author: Amr Hesham Date: 2024-08-28T13:23:24-07:00 New Revision: e99aa4a500b0f271b327432d404a9c1f72c6850a URL: https://github.com/llvm/llvm-project/commit/e99aa4a500b0f271b327432d404a9c1f72c6850a DIFF: https://github.com/llvm/llvm-project/commit/e99aa4a500b0f271b327432d404a9c1f72c6850a.diff LO

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-28 Thread Justin Bogner via cfe-commits
https://github.com/bogner closed https://github.com/llvm/llvm-project/pull/105930 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Apply NoRecurse attrib to all HLSL functions (PR #105907)

2024-08-28 Thread Greg Roth via cfe-commits
@@ -1064,13 +1064,17 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, // OpenCL C 2.0 v2.2-11 s6.9.i: // Recursion is not supported. // + // HLSL + // Recursion is not supported. + // // SYCL v1.2.1 s3.10: // kernels cannot inclu

[clang] [HLSL] Apply NoRecurse attrib to all HLSL functions (PR #105907)

2024-08-28 Thread Greg Roth via cfe-commits
@@ -0,0 +1,93 @@ +// RUN: %clang_cc1 -x hlsl -triple dxil-pc-shadermodel6.3-library -finclude-default-header %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s +// RUN: %clang_cc1 -x hlsl -triple dxil-pc-shadermodel6.0-compute -finclude-default-header %s -emit-llvm -disabl

[clang] [DXIL] Don't generate per-variable guards for DirectX (PR #106096)

2024-08-28 Thread Greg Roth via cfe-commits
@@ -94,6 +94,13 @@ class LLVM_LIBRARY_VISIBILITY DirectXTargetInfo : public TargetInfo { BuiltinVaListKind getBuiltinVaListKind() const override { return TargetInfo::VoidPtrBuiltinVaList; } + + void adjust(DiagnosticsEngine &Diags, LangOptions &Opts) override { --

[clang] [-Wunsafe-buffer-usage] Warning Libc functions (PR #101583)

2024-08-28 Thread Ziqing Luo via cfe-commits
@@ -1025,6 +1421,92 @@ class DataInvocationGadget : public WarningGadget { DeclUseList getClaimedVarUseSites() const override { return {}; } }; +class UnsafeLibcFunctionCallGadget : public WarningGadget { + const CallExpr *const Call; + constexpr static const char *const T

[clang] [-Wunsafe-buffer-usage] Warning Libc functions (PR #101583)

2024-08-28 Thread Ziqing Luo via cfe-commits
@@ -443,6 +449,396 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { return false; } +AST_MATCHER_P(CallExpr, hasNumArgs, unsigned, Num) { + return Node.getNumArgs() == Num; +} + +namespace libc_func_matchers { +// Under `libc_func_matchers`, define a set of matche

[clang] [clang-format] Fix test (PR #106305)

2024-08-28 Thread via cfe-commits
https://github.com/darkfeline updated https://github.com/llvm/llvm-project/pull/106305 >From 785d542dd78a8379aef77578465e7ef320073338 Mon Sep 17 00:00:00 2001 From: Allen Li <> Date: Tue, 27 Aug 2024 23:15:58 + Subject: [PATCH] [clang-format] Fix clang-format-buffer--buffer-encoding test Br

[clang] [lldb] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

2024-08-28 Thread Rahul Joshi via cfe-commits
jurahul wrote: Looks like the CI builds are release but with LLVM_ENABLE_ASSERTION=ON, so this validation code will be enabled and potential bad usage will be flagged as well going forward as long as it's exercised during the build or test. https://github.com/llvm/llvm-project/pull/105745

[clang] [clang-format] Fix clang-format-buffer--buffer-encoding test (PR #106305)

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

[clang] [clang-format] Fix clang-format-buffer--buffer-encoding test (PR #106305)

2024-08-28 Thread via cfe-commits
darkfeline wrote: > Please give a more descriptive title. Sorry about that, done https://github.com/llvm/llvm-project/pull/106305 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

2024-08-28 Thread Mehdi Amini via cfe-commits
@@ -655,7 +655,7 @@ DWARFUnit::GetDIE(dw_offset_t die_offset) { if (!ContainsDIEOffset(die_offset)) { GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError( -"GetDIE for DIE {0:x16} is outside of its CU {0:x16}", die_offset, +"GetDIE for DIE {0:x

[clang] [lldb] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

2024-08-28 Thread Rahul Joshi via cfe-commits
@@ -655,7 +655,7 @@ DWARFUnit::GetDIE(dw_offset_t die_offset) { if (!ContainsDIEOffset(die_offset)) { GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError( -"GetDIE for DIE {0:x16} is outside of its CU {0:x16}", die_offset, +"GetDIE for DIE {0:x

[clang] [lldb] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

2024-08-28 Thread Mehdi Amini via cfe-commits
https://github.com/joker-eph edited https://github.com/llvm/llvm-project/pull/105745 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

2024-08-28 Thread Mehdi Amini via cfe-commits
https://github.com/joker-eph approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/105745 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

2024-08-28 Thread Mehdi Amini via cfe-commits
@@ -143,15 +140,76 @@ formatv_object_base::splitLiteralAndReplacement(StringRef Fmt) { return std::make_pair(ReplacementItem{Fmt}, StringRef()); } +#ifndef NDEBUG +#define ENABLE_VALIDATION 1 +#else +#define ENABLE_VALIDATION 1 // Convienently enable validation in release m

[clang] [llvm] [Clang] C++20 Coroutines: Introduce Frontend Attribute [[clang::coro_await_elidable]] (PR #99282)

2024-08-28 Thread Yuxuan Chen via cfe-commits
@@ -523,6 +523,12 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { NormalCleanupDest = Address::invalid(); } + if (getLangOpts().Coroutines && isCoroutine()) { +auto *Record = FnRetTy->getAsCXXRecordDecl(); +if (Record && Record->hasAttr()) +

[clang] [lldb] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

2024-08-28 Thread Rahul Joshi via cfe-commits
jurahul wrote: > LGTM Thanks. I'll split out an additional PR for the independent fixes, and then in this one I'll change ENABLE_VALIDATION back to 0 and also remove the `formatvv()` and use `formatv(false` instead so we just have one function name. https://github.com/llvm/llvm-project/pull/1

[clang] [Clang] prevent assertion failure when converting vectors to int/float with invalid expressions (PR #105727)

2024-08-28 Thread Oleksandr T. via cfe-commits
https://github.com/a-tarasyuk updated https://github.com/llvm/llvm-project/pull/105727 >From d8bed3f4db8056a6afa9bd7eae5d4a8361f83086 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Thu, 22 Aug 2024 23:25:31 +0300 Subject: [PATCH 1/2] [Clang] prevent assertion failure when converting vectors

[clang] [llvm] [ValueTracking] use KnownBits to compute fpclass from bitcast (PR #97762)

2024-08-28 Thread Alex MacLean via cfe-commits
@@ -5921,6 +5921,61 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts, break; } + case Instruction::BitCast: { +const Value *Src; +if (!match(Op, m_ElementWiseBitCast(m_Value(Src))) || +!Src->getType()->isIntOrIntVectorTy()) + b

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread Dan Liew via cfe-commits
https://github.com/delcypher created https://github.com/llvm/llvm-project/pull/106453 The primary motivation behind this is to allow the enum type to be referred to earlier in the `Sema.h` file which is needed for #106321. It was requested in #106321 that a scoped enum be used (rather than movi

[clang] [lldb] [llvm] [mlir] [NFC] Fix formatv() usage in preparation of validation (PR #106454)

2024-08-28 Thread Rahul Joshi via cfe-commits
https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/106454 Fix several uses of formatv() that would be flagged as invalid by an upcoming change that will add additional validation to formatv(). >From b97456af86580c7f2d4473fbc13d3e345f071486 Mon Sep 17 00:00:00 2001 Fro

[clang] [BoundsSafety][Sema] Allow counted_by and counted_by_or_null on pointers where the pointee type is incomplete but potentially completable (PR #106321)

2024-08-28 Thread Dan Liew via cfe-commits
@@ -2099,6 +2099,70 @@ class Sema final : public SemaBase { bool CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, bool OrNull); + // AssignmentAction - This is used by all the assignment diagnostic functions + // to repr

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-backend-arm Author: Dan Liew (delcypher) Changes The primary motivation behind this is to allow the enum type to be referred to earlier in the `Sema.h` file which is needed for #106321. It was requested in #106321 that a scoped enum be used (rather than

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Dan Liew (delcypher) Changes The primary motivation behind this is to allow the enum type to be referred to earlier in the `Sema.h` file which is needed for #106321. It was requested in #106321 that a scoped enum be used (rather than movin

[clang] [lldb] [llvm] [mlir] [NFC] Fix formatv() usage in preparation of validation (PR #106454)

2024-08-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Rahul Joshi (jurahul) Changes Fix several uses of formatv() that would be flagged as invalid by an upcoming change that will add additional validation to formatv(). --- Full diff: https://github.com/llvm/llvm-project/pull/106454.diff 10

[clang] [lldb] [llvm] [mlir] [NFC] Fix formatv() usage in preparation of validation (PR #106454)

2024-08-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-mlir Author: Rahul Joshi (jurahul) Changes Fix several uses of formatv() that would be flagged as invalid by an upcoming change that will add additional validation to formatv(). --- Full diff: https://github.com/llvm/llvm-project/pull/106454.diff 10

[clang] [DXIL] Don't generate per-variable guards for DirectX (PR #106096)

2024-08-28 Thread Greg Roth via cfe-commits
@@ -94,6 +94,13 @@ class LLVM_LIBRARY_VISIBILITY DirectXTargetInfo : public TargetInfo { BuiltinVaListKind getBuiltinVaListKind() const override { return TargetInfo::VoidPtrBuiltinVaList; } + + void adjust(DiagnosticsEngine &Diags, LangOptions &Opts) override { --

[clang] [llvm] [Offload] Move HIP and CUDA to new driver by default (PR #84420)

2024-08-28 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/84420 >From 1d8acaceb01e937eb4f9ff0a205711f782cfe3da Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Thu, 7 Mar 2024 15:48:00 -0600 Subject: [PATCH] [Offload] Move HIP and CUDA to new driver by default Summary: This

[clang] [lldb] [llvm] [mlir] [Support] Validate number of arguments passed to formatv() (PR #105745)

2024-08-28 Thread Rahul Joshi via cfe-commits
jurahul wrote: Started https://github.com/llvm/llvm-project/pull/106454 for the independent fixes. https://github.com/llvm/llvm-project/pull/105745 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] 26c582b - [DXIL] Don't generate per-variable guards for DirectX (#106096)

2024-08-28 Thread via cfe-commits
Author: Greg Roth Date: 2024-08-28T14:08:44-07:00 New Revision: 26c582bb452eadc3870c56e8eae24feb354a2edf URL: https://github.com/llvm/llvm-project/commit/26c582bb452eadc3870c56e8eae24feb354a2edf DIFF: https://github.com/llvm/llvm-project/commit/26c582bb452eadc3870c56e8eae24feb354a2edf.diff LOG

[clang] [DXIL] Don't generate per-variable guards for DirectX (PR #106096)

2024-08-28 Thread Greg Roth via cfe-commits
https://github.com/pow2clk closed https://github.com/llvm/llvm-project/pull/106096 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread Dan Liew via cfe-commits
delcypher wrote: @Endilll This is my attempt at implementing what you asked for in https://github.com/llvm/llvm-project/pull/106321#discussion_r1734379624 I'm not a huge fan of this as I think this will be extremely annoying for downstream forks with very little upside vs just moving the unsco

[clang] [lldb] [llvm] [mlir] [NFC] Fix formatv() usage in preparation of validation (PR #106454)

2024-08-28 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 eb9c49c900f43aa79811f80847c97c6596197430 b97456af86580c7f2d4473fbc13d3e345f071486 --e

[clang] [llvm] [Offload] Move HIP and CUDA to new driver by default (PR #84420)

2024-08-28 Thread Joseph Huber via cfe-commits
jhuber6 wrote: @yxsamliu Do you know what the next steps for merging this would be? I'd like to get it into the Clang 20 release if possible. The only thing this loses currently is managed variables being registered in RDC mode, but I'm going to assume that's hardly seen in practice so I could

[clang] [lldb] [llvm] [mlir] [NFC] Fix formatv() usage in preparation of validation (PR #106454)

2024-08-28 Thread Rahul Joshi via cfe-commits
https://github.com/jurahul updated https://github.com/llvm/llvm-project/pull/106454 >From 581c47377f77a9d2819a5997b1c0a3c23b2c3346 Mon Sep 17 00:00:00 2001 From: Rahul Joshi Date: Wed, 28 Aug 2024 13:55:58 -0700 Subject: [PATCH] [NFC] Fix formatv() usage in preparation of validation Fix severa

[clang] [lldb] [llvm] [mlir] [NFC] Fix formatv() usage in preparation of validation (PR #106454)

2024-08-28 Thread Mehdi Amini via cfe-commits
https://github.com/joker-eph approved this pull request. https://github.com/llvm/llvm-project/pull/106454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DXIL] Don't generate per-variable guards for DirectX (PR #106096)

2024-08-28 Thread LLVM Continuous Integration via cfe-commits
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `clang-armv8-quick` running on `linaro-clang-armv8-quick` while building `clang` at step 5 "ninja check 1". Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/3471 Here is the relevant piece of

[clang] [llvm] [Clang] C++20 Coroutines: Introduce Frontend Attribute [[clang::coro_await_elidable]] (PR #99282)

2024-08-28 Thread Yuxuan Chen via cfe-commits
https://github.com/yuxuanchen1997 updated https://github.com/llvm/llvm-project/pull/99282 >From ef2b868666579df534d63daeebd2b201600ce292 Mon Sep 17 00:00:00 2001 From: Yuxuan Chen Date: Tue, 4 Jun 2024 23:22:00 -0700 Subject: [PATCH] [Clang] C++20 Coroutines: Introduce Frontend Attribute [[cla

[clang] [-Wunsafe-buffer-usage] Warning Libc functions (PR #101583)

2024-08-28 Thread Ziqing Luo via cfe-commits
@@ -12383,6 +12383,13 @@ def warn_unsafe_buffer_operation : Warning< "%select{unsafe pointer operation|unsafe pointer arithmetic|" "unsafe buffer access|function introduces unsafe buffer manipulation|unsafe invocation of span::data}0">, InGroup, DefaultIgnore; +def warn_

[clang] [WIP][-Wunsafe-buffer-usage] Add a new option for unsafe buffer warnings on libc functions (PR #105383)

2024-08-28 Thread Ziqing Luo via cfe-commits
https://github.com/ziqingluo-90 edited https://github.com/llvm/llvm-project/pull/105383 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Warning Libc functions (PR #101583)

2024-08-28 Thread Ziqing Luo via cfe-commits
@@ -0,0 +1,101 @@ +// RUN: %clang_cc1 -std=c++20 -Wno-all -Wunsafe-buffer-usage \ +// RUN:-verify %s + +typedef struct {} FILE; +void memcpy(); +void __asan_memcpy(); +void strcpy(); +void strcpy_s(); +void wcscpy_s(); +unsigned strlen( const char* str ); +int fprintf(

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread Vlad Serebrennikov via cfe-commits
@@ -204,6 +204,24 @@ class SemaPPCallbacks; class TemplateDeductionInfo; } // namespace sema +// AssignmentAction - This is used by all the assignment diagnostic functions +// to represent what is actually causing the operation +enum class AssignmentAction : unsigned { ---

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: > @Endilll This is my attempt at implementing what you asked for in [#106321 > (comment)](https://github.com/llvm/llvm-project/pull/106321#discussion_r1734379624) > > I'm not a huge fan of this as I think this will be extremely annoying for > downstream forks with very little up

[clang] [NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (PR #106453)

2024-08-28 Thread Vlad Serebrennikov via cfe-commits
@@ -204,6 +204,24 @@ class SemaPPCallbacks; class TemplateDeductionInfo; } // namespace sema +// AssignmentAction - This is used by all the assignment diagnostic functions +// to represent what is actually causing the operation +enum class AssignmentAction : unsigned { + Assi

[clang] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)

2024-08-28 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,103 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// TODO: Implement "Buffer" +struct Eg1 { + float f; + // Buffer Buf; + RWBuffer RWBuf; + }; +Eg1 e1 : /* register(t0) :*/ register(u0); +// Valid: f is skip

<    1   2   3   4   5   6   >