[clang] #101784 part 1: introduce ctyped in an independent manner (PR #101941)

2024-08-06 Thread via cfe-commits
TsXor wrote: Thanks for the information, but I want to point out the bug #101548 fixed is actually avoidable by annotating exported C functions. https://github.com/llvm/llvm-project/pull/101941 ___ cfe-commits mailin

[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)

2024-08-06 Thread Oleksandr T. via cfe-commits
https://github.com/a-tarasyuk updated https://github.com/llvm/llvm-project/pull/101853 >From 56c8d3a8e5f860ec1f68adf997d502849de1cb50 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Sun, 4 Aug 2024 00:45:49 +0300 Subject: [PATCH 1/4] [Clang] strengthen checks for 'main' function to meet [basi

[clang] [lld] [llvm] [LTO] enable `ObjCARCContractPass` only on optimized build (PR #101114)

2024-08-06 Thread Nikita Popov via cfe-commits
@@ -730,6 +740,7 @@ INITIALIZE_PASS_END(ObjCARCContractLegacyPass, "objc-arc-contract", void ObjCARCContractLegacyPass::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); AU.addRequired(); + AU.addPreserved(); nikic wrote: Can you also add AAR

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-06 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 created https://github.com/llvm/llvm-project/pull/102199 In #99726, `-fptrauth-type-info-vtable-pointer-discrimination` was introduced, which is intended to enable type and address discrimination for type_info vtable pointers. However, some codegen logic for actuall

[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)

2024-08-06 Thread Oleksandr T. via cfe-commits
@@ -8052,10 +8061,7 @@ NamedDecl *Sema::ActOnVariableDeclarator( } // Special handling of variable named 'main'. - if (Name.getAsIdentifierInfo() && Name.getAsIdentifierInfo()->isStr("main") && - NewVD->getDeclContext()->getRedeclContext()->isTranslationUnit() && -

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-06 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: Also tagging @ojhunt (GitHub still does not let to add as a reviewer) https://github.com/llvm/llvm-project/pull/102199 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-06 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 ready_for_review https://github.com/llvm/llvm-project/pull/102199 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-06 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: Daniil Kovalev (kovdan01) Changes In #99726, `-fptrauth-type-info-vtable-pointer-discrimination` was introduced, which is intended to enable type and address discrimination for type_info vtable pointers. However, some codegen logi

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-06 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Daniil Kovalev (kovdan01) Changes In #99726, `-fptrauth-type-info-vtable-pointer-discrimination` was introduced, which is intended to enable type and address discrimination for type_info vtable pointers. However, some codegen logic for ac

[clang] Return available function types for BindingDecls. (PR #102196)

2024-08-06 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: This is a bug fix, yes, but there are currently no tests at all for this function that I can find (and no test file corresponding to this file or its header), so I'm not sure what the scope of a new unit test should be. I also don't know how I would most realistically trigger the

[clang] Return available function types for BindingDecls. (PR #102196)

2024-08-06 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Do you have a C++ source file example which presents misbehaviour when compiled through clang, which this change fixes? If so, you can reduce that example and add is as a regression test. These go in `clang/test/` and are basically composed of C++ source and some annotations to

[clang] Return available function types for BindingDecls. (PR #102196)

2024-08-06 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: For the following: ``` template struct Pair { Pair(); A a; B b; }; void target(int *i) { Pair p; auto [fp, b] = p; fp(i); } ``` Running or compiling this code presents no misbehavior that I know of, but when running a dataflow analysis that queries `getFunctionType(

[clang] [Bounds-Safety] Add sized_by, counted_by_or_null & sized_by_or_null (PR #93231)

2024-08-06 Thread Dan Liew via cfe-commits
delcypher wrote: @Xazax-hun This is something I'd like too. Unfortunately in previous discussions we were asked to not do this. https://github.com/llvm/llvm-project/pull/70480#discussion_r1379166020 https://github.com/llvm/llvm-project/pull/70480#discussion_r1377966526 As the number of tests gr

[clang] Return available function types for BindingDecls. (PR #102196)

2024-08-06 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Is this a dataflow analysis in upstream clang, or is this something you are developing? https://github.com/llvm/llvm-project/pull/102196 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [llvm] [OpenMP] OpenMP 5.1 "assume" directive parsing support (PR #92731)

2024-08-06 Thread Julian Brown via cfe-commits
jtb20 wrote: On 06/08/2024 19:40, Valentin Clement (バレンタイン クレメン) wrote: > > This is still breaking a buildbot. > https://lab.llvm.org/buildbot/#/builders/157/builds/4246 > > > Are you working on a fix? It seems to be the same bug

[clang] [CodeGen] Make non-COMDAT relative vtable internal instead of private (PR #102056)

2024-08-06 Thread via cfe-commits
https://github.com/PiJoules approved this pull request. LGTM. Thanks. https://github.com/llvm/llvm-project/pull/102056 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-08-06 Thread Artem Dergachev via cfe-commits
@@ -2261,6 +2262,12 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { // note_unsafe_buffer_operation doesn't have this mode yet. assert(!IsRelatedToDecl && "Not implemented yet!"); MsgParam = 3; + } else if (isa(Operation)) {

[clang] [Clang] Fix crash when transforming a `DependentAddressSpaceType` (PR #102206)

2024-08-06 Thread via cfe-commits
https://github.com/Sirraide created https://github.com/llvm/llvm-project/pull/102206 We were forgetting to pass the `TypeLocBuilder` along to `TransformType`, causing us to complain if we then tried to build a `DependentAddressSpaceTypeLoc` because the inner `TypeLoc` was missing from the TLB

[clang] [Clang] Fix crash when transforming a `DependentAddressSpaceType` (PR #102206)

2024-08-06 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (Sirraide) Changes We were forgetting to pass the `TypeLocBuilder` along to `TransformType`, causing us to complain if we then tried to build a `DependentAddressSpaceTypeLoc` because the inner `TypeLoc` was missing from the TLB. Fi

[clang] [Clang] Fix crash when transforming a `DependentAddressSpaceType` (PR #102206)

2024-08-06 Thread via cfe-commits
@@ -5838,7 +5839,7 @@ QualType TreeTransform::TransformDependentAddressSpaceType( } else { TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo( Result, getDerived().getBaseLocation()); -TransformType(TLB, DI->getTypeLoc()); +TLB.TypeWasModifie

[clang] [CodeGen][NFCI] Don't re-implement parts of ASTContext::getIntWidth (PR #101765)

2024-08-06 Thread Alexander Richardson via cfe-commits
arichardson wrote: I just had another look at ASTContext::getIntWidth() and the logic there results in the same value being returned, so this should be a NFC change. ``` unsigned ASTContext::getIntWidth(QualType T) const { if (const auto *ET = T->getAs()) T = ET->getDecl()->getIntegerType

[clang] [CodeGen][NFCI] Don't re-implement parts of ASTContext::getIntWidth (PR #101765)

2024-08-06 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. Yeah, looks NFC to me as well. LGTM https://github.com/llvm/llvm-project/pull/101765 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

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

2024-08-06 Thread Artem Dergachev via cfe-commits
@@ -927,21 +927,28 @@ class CArrayToPtrAssignmentGadget : public FixableGadget { /// over one of its pointer parameters. class UnsafeBufferUsageAttrGadget : public WarningGadget { constexpr static const char *const OpTag = "call_expr"; - const CallExpr *Op; + const Expr *Op

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

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

[clang] 0371dff - [CodeGen] Make non-COMDAT relative vtable internal instead of private (#102056)

2024-08-06 Thread via cfe-commits
Author: Shoaib Meenai Date: 2024-08-06T12:58:04-07:00 New Revision: 0371dff99529e93b8650281801e89bc015dc2703 URL: https://github.com/llvm/llvm-project/commit/0371dff99529e93b8650281801e89bc015dc2703 DIFF: https://github.com/llvm/llvm-project/commit/0371dff99529e93b8650281801e89bc015dc2703.diff

[clang] [CodeGen] Make non-COMDAT relative vtable internal instead of private (PR #102056)

2024-08-06 Thread Shoaib Meenai via cfe-commits
https://github.com/smeenai closed https://github.com/llvm/llvm-project/pull/102056 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Return available function types for BindingDecls. (PR #102196)

2024-08-06 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: This is a pointer nullability analysis being developed outside of clang. The relevant analysis code, including our workaround, can be seen at https://github.com/google/crubit/blob/main/nullability/inference/collect_evidence.cc#L757. https://github.com/llvm/llvm-project/pull/10219

[clang] [lld] [llvm] [LTO] enable `ObjCARCContractPass` only on optimized build (PR #101114)

2024-08-06 Thread Peter Rong via cfe-commits
https://github.com/DataCorrupted updated https://github.com/llvm/llvm-project/pull/101114 >From ebbba2b8a04fa063c7019566fb56227cb7196485 Mon Sep 17 00:00:00 2001 From: Peter Rong Date: Mon, 29 Jul 2024 16:05:54 -0700 Subject: [PATCH 1/6] Reapply "Run ObjCContractPass in Default Codegen Pipeline

[clang] [Clang] Fix crash when transforming a `DependentAddressSpaceType` (PR #102206)

2024-08-06 Thread Matheus Izvekov via cfe-commits
@@ -5838,7 +5839,7 @@ QualType TreeTransform::TransformDependentAddressSpaceType( } else { TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo( Result, getDerived().getBaseLocation()); -TransformType(TLB, DI->getTypeLoc()); +TLB.TypeWasModifie

[clang] [llvm] [OpenMP] OpenMP 5.1 "assume" directive parsing support (PR #92731)

2024-08-06 Thread Valentin Clement バレンタイン クレメン via cfe-commits
clementval wrote: Yeah it was probably the case. It's green now. https://github.com/llvm/llvm-project/pull/92731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix crash when transforming a `DependentAddressSpaceType` (PR #102206)

2024-08-06 Thread via cfe-commits
https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/102206 >From 07db2e9c85dd15a948b969be3c3d32579f790d74 Mon Sep 17 00:00:00 2001 From: Sirraide Date: Tue, 6 Aug 2024 21:42:23 +0200 Subject: [PATCH 1/2] [Clang] Fix crash when transforming a DependentAddressSpaceType

[clang] [Clang] Fix crash when transforming a `DependentAddressSpaceType` (PR #102206)

2024-08-06 Thread via cfe-commits
@@ -5838,7 +5839,7 @@ QualType TreeTransform::TransformDependentAddressSpaceType( } else { TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo( Result, getDerived().getBaseLocation()); -TransformType(TLB, DI->getTypeLoc()); +TLB.TypeWasModifie

[clang] [Clang] Fix crash when transforming a `DependentAddressSpaceType` (PR #102206)

2024-08-06 Thread Johannes Doerfert via cfe-commits
@@ -5838,7 +5839,7 @@ QualType TreeTransform::TransformDependentAddressSpaceType( } else { TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo( Result, getDerived().getBaseLocation()); -TransformType(TLB, DI->getTypeLoc()); +TLB.TypeWasModifie

[clang] [llvm] [OpenMP] OpenMP 5.1 "assume" directive parsing support (PR #92731)

2024-08-06 Thread Julian Brown via cfe-commits
jtb20 wrote: Thank you for the update! https://github.com/llvm/llvm-project/pull/92731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix crash when transforming a `DependentAddressSpaceType` (PR #102206)

2024-08-06 Thread via cfe-commits
@@ -5838,7 +5839,7 @@ QualType TreeTransform::TransformDependentAddressSpaceType( } else { TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo( Result, getDerived().getBaseLocation()); -TransformType(TLB, DI->getTypeLoc()); +TLB.TypeWasModifie

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

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

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

2024-08-06 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ commented: Ok technical part looks good! https://github.com/llvm/llvm-project/pull/101585 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-08-06 Thread Artem Dergachev via cfe-commits
@@ -6835,6 +6837,31 @@ the proper solution would be to create a different function (possibly an overload of ``baz()``) that accepts a safe container like ``bar()``, and then use the attribute on the original ``baz()`` to help the users update their code to use the new function

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

2024-08-06 Thread Artem Dergachev via cfe-commits
@@ -6835,6 +6837,31 @@ the proper solution would be to create a different function (possibly an overload of ``baz()``) that accepts a safe container like ``bar()``, and then use the attribute on the original ``baz()`` to help the users update their code to use the new function

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

2024-08-06 Thread Artem Dergachev via cfe-commits
@@ -926,22 +926,27 @@ class CArrayToPtrAssignmentGadget : public FixableGadget { /// A call of a function or method that performs unchecked buffer operations /// over one of its pointer parameters. class UnsafeBufferUsageAttrGadget : public WarningGadget { - constexpr static c

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

2024-08-06 Thread Artem Dergachev 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

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-06 Thread Oliver Hunt via cfe-commits
@@ -3955,9 +3955,23 @@ void ItaniumRTTIBuilder::BuildVTablePointer(const Type *Ty) { VTable, Two); } - if (auto &Schema = CGM.getCodeGenOpts().PointerAuth.CXXTypeInfoVTablePointer) -VTable = CGM.getConstantSigne

[clang] [clang][driver][clang-cl] Fix unused argument warning for `/std:c++20` for precompiled module inputs to `clang-cl` (PR #99300)

2024-08-06 Thread Sharadh Rajaraman via cfe-commits
https://github.com/sharadhr updated https://github.com/llvm/llvm-project/pull/99300 >From 51e74869c87de8ed8b37e7a9391428f3dfc1ac1a Mon Sep 17 00:00:00 2001 From: Sharadh Rajaraman Date: Sun, 14 Jul 2024 11:05:57 +0100 Subject: [PATCH 1/2] `TY_ModuleFile` should be a 'CXX' file type --- clang/

[clang] [clang][driver][clang-cl] Fix unused argument warning for `/std:c++20` for precompiled module inputs to `clang-cl` (PR #99300)

2024-08-06 Thread Sharadh Rajaraman via cfe-commits
sharadhr wrote: Not quite sure how to handle the test for this; I'm struggling to find a `.pcm` file that can be used. https://github.com/llvm/llvm-project/pull/99300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang] [clang][driver][clang-cl] Fix unused argument warning for `/std:c++20` for precompiled module inputs to `clang-cl` (PR #99300)

2024-08-06 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 2e9f15e1dfd8bc90d0cd91157c8b3b036cee981e cbe5a79ca48a888917863dd807ebcfefb2385d74 --e

[clang] [clang][driver][clang-cl] Fix unused argument warning for `/std:c++20` for precompiled module inputs to `clang-cl` (PR #99300)

2024-08-06 Thread Sharadh Rajaraman via cfe-commits
https://github.com/sharadhr updated https://github.com/llvm/llvm-project/pull/99300 >From 51e74869c87de8ed8b37e7a9391428f3dfc1ac1a Mon Sep 17 00:00:00 2001 From: Sharadh Rajaraman Date: Sun, 14 Jul 2024 11:05:57 +0100 Subject: [PATCH 1/2] `TY_ModuleFile` should be a 'CXX' file type --- clang/

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-06 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Ok, it took me a moment to understand what was happening here - I had to talk to Ahmed because I didn't recognize the AddrDiscriminator_* enums and had assumed I'd forgotten them :D This needs to update `ItaniumRTTIBuilder::BuildVTablePointer` to take the storage address, and t

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-06 Thread Ahmed Bougacha via cfe-commits
@@ -1056,12 +1056,18 @@ class ConstantPtrAuth final : public Constant { return !getAddrDiscriminator()->isNullValue(); } - /// A constant value for the address discriminator which has special - /// significance to ctors/dtors lowering. Regular address discrimination c

[clang] [llvm] demangle function names in trace files (PR #87626)

2024-08-06 Thread Reid Kleckner via cfe-commits
rnk wrote: I think I'll leave this change in and file an issue about it. A 10% compile time regression with `-ftime-trace` isn't great, but it doesn't feel revert-worthy. https://github.com/llvm/llvm-project/pull/87626 ___ cfe-commits mailing list cf

[clang] Warning Libc functions (PR #101583)

2024-08-06 Thread Artem Dergachev via cfe-commits
@@ -443,6 +448,260 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { return false; } +AST_MATCHER(CallExpr, isUnsafeLibcFunctionCall) { + static const std::set PredefinedNames{ + // numeric conversion: + "atof", + "atoi", + "atol", + "atoll

[clang] Warning Libc functions (PR #101583)

2024-08-06 Thread Artem Dergachev via cfe-commits
@@ -443,6 +447,314 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { return false; } +AST_MATCHER(CallExpr, isUnsafeLibcFunctionCall) { + static const std::set PredefinedNames{ + // numeric conversion: + "atof", + "atoi", + "atol", + "atoll

[clang] [clang] Inject tokens containing #embed back into token stream (PR #97274)

2024-08-06 Thread Ben Barham via cfe-commits
@@ -2123,17 +2123,18 @@ class Preprocessor { char getSpellingOfSingleCharacterNumericConstant(const Token &Tok, bnbarham wrote: Thanks @AaronBallman! https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commit

[clang] [clang] Inject tokens containing #embed back into token stream (PR #97274)

2024-08-06 Thread Ben Barham via cfe-commits
https://github.com/bnbarham edited https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang] Protect ObjCMethodList assignment operator against self-assignment (PR #97933)

2024-08-06 Thread Tom Honermann via cfe-commits
tahonermann wrote: I'm sorry, @smanna12, I misread the code earlier and misled you. That `PunnedPointer` assignment operator I directed you too isn't a copy assignment operator (it takes a `intptr_t`, not a reference or value of `PunnedPointer`). Changing that assignment operator won't affect

[clang] [Clang] Fix crash when transforming a `DependentAddressSpaceType` (PR #102206)

2024-08-06 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM, Thanks! https://github.com/llvm/llvm-project/pull/102206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang] Protect ObjCMethodList assignment operator against self-assignment (PR #97933)

2024-08-06 Thread via cfe-commits
smanna12 wrote: > I'm sorry, @smanna12, I misread the code earlier and misled you. That > `PunnedPointer` assignment operator I directed you too isn't a copy > assignment operator (it takes a `intptr_t`, not a reference or value of > `PunnedPointer`). Changing that assignment operator won't af

[clang] [llvm] [Clang] Protect ObjCMethodList assignment operator against self-assignment (PR #97933)

2024-08-06 Thread via cfe-commits
https://github.com/smanna12 closed https://github.com/llvm/llvm-project/pull/97933 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-08-06 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/102226 This reverts commit 90ccf2187332ff900d46a58a27cb0353577d37cb. Fixes: https://github.com/llvm/llvm-project/issues/100212 >From 3ddd7a6df3ef85cbfe3f5fc0294817638275d4df Mon Sep 17 00:00:00 2001 From: Joseph Hube

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

2024-08-06 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-driver Author: Joseph Huber (jhuber6) Changes This reverts commit 90ccf2187332ff900d46a58a27cb0353577d37cb. Fixes: https://github.com/llvm/llvm-project/issues/100212 --- Full diff: https://github.com/llvm/llvm-project/pull/102226.diff 3 Files

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

2024-08-06 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/102227 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. This c

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

2024-08-06 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Chris B (llvm-beanz) Changes 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. This cha

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

2024-08-06 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-hlsl Author: Chris B (llvm-beanz) Changes 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. This chan

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

2024-08-06 Thread Doug Wyatt via cfe-commits
@@ -2397,6 +2397,1262 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { }; } // namespace +// = + +namespace FXAnalysis { + +enum class DiagnosticID : uint8_t { + None = 0, // s

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

2024-08-06 Thread Steven Wu via cfe-commits
cachemeifyoucan wrote: Thanks! Can this be fixed on `release/19.x` too? 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] Revert "[LinkerWrapper] Extend with usual pass options (#96704)" (PR #102226)

2024-08-06 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > Thanks! Can this be fixed on `release/19.x` too? I'm still surprised this made it into the Release, since I'm pretty sure I only landed all of these changes after the fork. But we should be able to backport it from the existing issue. https://github.com/llvm/llvm-project/pul

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

2024-08-06 Thread Joel E. Denny via cfe-commits
https://github.com/jdenny-ornl approved this pull request. 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] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-06 Thread via cfe-commits
https://github.com/VolatileAcorn updated https://github.com/llvm/llvm-project/pull/101882 >From e6f04cd8cd22d309a6f6c945c121c77e96371f86 Mon Sep 17 00:00:00 2001 From: Tom Pottage Date: Fri, 2 Aug 2024 20:26:47 +0100 Subject: [PATCH] [clang-format] Deprecate BinPackParameters and add BreakPara

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

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

[clang] [Clang] [Frontend] fix crash on parsing ternary operator with `vector_size` condition (PR #102004)

2024-08-06 Thread Matheus Izvekov via cfe-commits
@@ -6719,6 +6719,16 @@ QualType Sema::CheckVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, : UsualArithmeticConversions(LHS, RHS, QuestionLoc, ACK_Conditional); +if (ResultElementTy.isNull()) { + Diag(Que

[clang] [Modules][Diagnostic] Mention which AST file's options differ from the current TU options. (PR #101413)

2024-08-06 Thread Volodymyr Sapsai via cfe-commits
@@ -130,7 +130,7 @@ class ASTReaderListener { /// /// \returns true to indicate the options are invalid or false otherwise. virtual bool ReadLanguageOptions(const LangOptions &LangOpts, - bool Complain, +

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

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

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

2024-08-06 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos 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-06 Thread via cfe-commits
@@ -0,0 +1,194 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -verify %s +// These are in a separate file because errors (e.g. incompatible attributes) currently prevent +// the AnalysisBasedWarnings pass from running at all. + +// This diagnostic is re-enabled an

[clang] [Bounds Safety][NFC] Add some missing coverage for `-fexperimental-late-parse-attributes` (PR #102236)

2024-08-06 Thread Dan Liew via cfe-commits
https://github.com/delcypher created https://github.com/llvm/llvm-project/pull/102236 Previously we weren't properly checking that using `-fexperimental-late-parse-attributes` worked on source code that didn't need late parsing. For example we weren't testing that the attribute appearing in t

[clang] [Bounds Safety][NFC] Add some missing coverage for `-fexperimental-late-parse-attributes` (PR #102236)

2024-08-06 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Dan Liew (delcypher) Changes Previously we weren't properly checking that using `-fexperimental-late-parse-attributes` worked on source code that didn't need late parsing. For example we weren't testing that the attribute appearing in th

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

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

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

2024-08-06 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos 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-06 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,194 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -verify %s +// These are in a separate file because errors (e.g. incompatible attributes) currently prevent +// the AnalysisBasedWarnings pass from running at all. + +// This diagnostic is re-enabled an

[clang] [clang][modules] Enable built-in modules for the upcoming Apple releases (PR #102239)

2024-08-06 Thread Ian Anderson via cfe-commits
https://github.com/ian-twilightcoder created https://github.com/llvm/llvm-project/pull/102239 The upcoming Apple SDK releases will support the clang built-in headers being in the clang built-in modules: stop passing -fbuiltin-headers-in-system-modules for those SDK versions. >From 529cb1b9ccf

[clang] [clang][modules] Enable built-in modules for the upcoming Apple releases (PR #102239)

2024-08-06 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Ian Anderson (ian-twilightcoder) Changes The upcoming Apple SDK releases will support the clang built-in headers being in the clang built-in modules: stop passing -fbuiltin-headers-in-system-modules for those SDK versions. --- Full diff:

[clang] [clang][modules] Enable built-in modules for the upcoming Apple releases (PR #102239)

2024-08-06 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-driver Author: Ian Anderson (ian-twilightcoder) Changes The upcoming Apple SDK releases will support the clang built-in headers being in the clang built-in modules: stop passing -fbuiltin-headers-in-system-modules for those SDK versions. --- Ful

[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)

2024-08-06 Thread Oleksandr T. via cfe-commits
https://github.com/a-tarasyuk updated https://github.com/llvm/llvm-project/pull/101853 >From 56c8d3a8e5f860ec1f68adf997d502849de1cb50 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Sun, 4 Aug 2024 00:45:49 +0300 Subject: [PATCH 1/5] [Clang] strengthen checks for 'main' function to meet [basi

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

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

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

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

[clang] [llvm] [RISCV][VLS] Support RISCV VLS calling convention (PR #100346)

2024-08-06 Thread Craig Topper via cfe-commits
@@ -317,38 +323,45 @@ ABIArgInfo RISCVABIInfo::coerceAndExpandFPCCEligibleStruct( // Fixed-length RVV vectors are represented as scalable vectors in function // args/return and must be coerced from fixed vectors. -ABIArgInfo RISCVABIInfo::coerceVLSVector(QualType Ty) const {

[clang] [llvm] [RISCV][VLS] Support RISCV VLS calling convention (PR #100346)

2024-08-06 Thread Craig Topper via cfe-commits
@@ -4768,6 +4768,25 @@ static void handleCallConvAttr(Sema &S, Decl *D, const ParsedAttr &AL) { case ParsedAttr::AT_RISCVVectorCC: D->addAttr(::new (S.Context) RISCVVectorCCAttr(S.Context, AL)); return; + case ParsedAttr::AT_RISCVVLSCC: { +// If the riscv_abi_vl

[clang] [llvm] [RISCV][VLS] Support RISCV VLS calling convention (PR #100346)

2024-08-06 Thread Craig Topper via cfe-commits
@@ -2206,6 +2206,21 @@ void Clang::AddRISCVTargetArgs(const ArgList &Args, << A->getSpelling() << Val; } } + + if (Arg *A = Args.getLastArg(options::OPT_mriscv_abi_vlen_EQ)) { +StringRef ABIVLenStr = A->getValue(); +unsigned ABIVLen; +const Driver &

[clang] [llvm] [RISCV][VLS] Support RISCV VLS calling convention (PR #100346)

2024-08-06 Thread Craig Topper via cfe-commits
@@ -5554,6 +5554,17 @@ them if they use them. }]; } +def RISCVVLSCCDocs : Documentation { + let Category = DocCatCallingConvs; + let Heading = "riscv::vls_cc, riscv_vls_cc, clang::riscv_vls_cc"; + let Content = [{ +The ``riscv_vls_cc`` attribute can be applied to a function.

[clang] [llvm] [RISCV][VLS] Support RISCV VLS calling convention (PR #100346)

2024-08-06 Thread Craig Topper via cfe-commits
@@ -7920,6 +7923,27 @@ static bool handleFunctionTypeAttr(TypeProcessingState &state, ParsedAttr &attr, CallingConv CCOld = fn->getCallConv(); Attr *CCAttr = getCCTypeAttr(S.Context, attr); + if (attr.getKind() == ParsedAttr::AT_RISCVVLSCC) { +// If the riscv_abi_vle

[clang] [clang-format] Fix a bug in annotating CastRParen (PR #102261)

2024-08-06 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/102261 Fixes #102102. >From b72a629d16d5bc3ce800a562fd41ba2dfd1fe1eb Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 6 Aug 2024 18:10:20 -0700 Subject: [PATCH] [clang-format] Fix a bug in annotating CastRParen Fixe

[clang] [clang-format] Fix a bug in annotating CastRParen (PR #102261)

2024-08-06 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-format Author: Owen Pan (owenca) Changes Fixes #102102. --- Full diff: https://github.com/llvm/llvm-project/pull/102261.diff 2 Files Affected: - (modified) clang/lib/Format/TokenAnnotator.cpp (+10-1) - (modified) clang/unittests/Format/TokenAn

[clang] [clang][driver][clang-cl] Fix unused argument warning for `/std:c++20` for precompiled module inputs to `clang-cl` (PR #99300)

2024-08-06 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: Maybe something like this: ``` // RUN: rm -rf %t // RUN: split-file %s %t // RUN: %clang %t/fake.pcm -std=c++20 -### 2>&1 | FileCheck %t/fake.pcm //--- fake.pcm // CHECK-NOT: warning ``` https://github.com/llvm/llvm-project/pull/99300 _

[clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)

2024-08-06 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > I don't know, but it would be a lot of work, and would likely still mean > preserving the same information as `SubstTemplateTypeParmType` nodes > currently provide. > > Our scope is also larger than what Clang's resugarer aims to do, because for > our purposes sometimes ther

[clang] [clang][ASTMatcher] Add matcher for 'matches' (PR #102152)

2024-08-06 Thread via cfe-commits
https://github.com/Gitspike updated https://github.com/llvm/llvm-project/pull/102152 >From 994e693ed246df662f757c69035d54f62639b560 Mon Sep 17 00:00:00 2001 From: hehouhua Date: Tue, 6 Aug 2024 22:17:00 +0800 Subject: [PATCH] [clang][ASTMatcher] Add matcher for 'matches' Add Matcher matches. -

[clang] [llvm] [PPC] Implement BCD assist builtins (PR #101390)

2024-08-06 Thread Chen Zheng via cfe-commits
https://github.com/chenzheng1030 approved this pull request. LGTM. Thanks for the offline discussion @lei137 https://github.com/llvm/llvm-project/pull/101390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [clang][ASTMatcher] Add matcher for 'matches' (PR #102152)

2024-08-06 Thread Ding Fei via cfe-commits
@@ -5582,6 +5582,20 @@ Narrowing Matchers +MatcherStringLiteral>matchesStringRef RegExp, Regex::RegexFlags Flags = NoFlags danix800 wrote: ```suggestion Matcher

[clang] [clang][ASTMatcher] Add matcher for 'matches' (PR #102152)

2024-08-06 Thread Ding Fei via cfe-commits
@@ -288,6 +288,8 @@ AST Matchers - Fixed an issue with the `hasName` and `hasAnyName` matcher when matching inline namespaces with an enclosing namespace of the same name. +- Add ``matches``. danix800 wrote: ```suggestion - Add `matches` for `StringLiteral`

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

2024-08-06 Thread via cfe-commits
Author: Joseph Huber Date: 2024-08-06T21:33:25-05:00 New Revision: 030ee841a9c9fbbd6e7c001e751737381da01f7b URL: https://github.com/llvm/llvm-project/commit/030ee841a9c9fbbd6e7c001e751737381da01f7b DIFF: https://github.com/llvm/llvm-project/commit/030ee841a9c9fbbd6e7c001e751737381da01f7b.diff

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

2024-08-06 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 closed 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] [C++20] [Modules] Don't set modules owner ship information for builtin declarations (PR #102115)

2024-08-06 Thread Chuanqi Xu via cfe-commits
@@ -2376,6 +2376,12 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, FunctionDecl *New = CreateBuiltin(II, R, ID, Loc); RegisterLocallyScopedExternCDecl(New, S); + // Builtin functions shouldn't be owned by any module. + if (New->hasOwningModule(

<    1   2   3   4   5   >