[Lldb-commits] [clang-tools-extra] [clang] [compiler-rt] [llvm] [flang] [libcxx] [lldb] [lld] [libc] [AArch64][SME2] Preserve ZT0 state around function calls (PR #78321)
https://github.com/kmclaughlin-arm updated https://github.com/llvm/llvm-project/pull/78321 >From 11dce217ed307601d0ea1eb5b016b47f80e67786 Mon Sep 17 00:00:00 2001 From: Kerry McLaughlin Date: Thu, 11 Jan 2024 17:46:00 + Subject: [PATCH 1/7] [SME2][Clang] Add tests with ZT0 state --- llvm/test/CodeGen/AArch64/sme-zt0-state.ll | 125 + 1 file changed, 125 insertions(+) create mode 100644 llvm/test/CodeGen/AArch64/sme-zt0-state.ll diff --git a/llvm/test/CodeGen/AArch64/sme-zt0-state.ll b/llvm/test/CodeGen/AArch64/sme-zt0-state.ll new file mode 100644 index 00..ff560681665f8b --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sme-zt0-state.ll @@ -0,0 +1,125 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sme2 -start-after=simplifycfg -enable-tail-merge=false -verify-machineinstrs < %s | FileCheck %s + +; Callee with no ZT state +declare void @no_state_callee(); + +; Callees with ZT0 state +declare void @zt0_shared_callee() "aarch64_in_zt0"; + +; Callees with ZA state + +declare void @za_shared_callee() "aarch64_pstate_za_shared"; +declare void @za_zt0_shared_callee() "aarch64_pstate_za_shared" "aarch64_in_zt0"; + +; +; Private-ZA Callee +; + +; Expect spill & fill of ZT0 around call +; Expect smstop/smstart za around call +define void @zt0_in_caller_no_state_callee() "aarch64_in_zt0" nounwind { +; CHECK-LABEL: zt0_in_caller_no_state_callee: +; CHECK: // %bb.0: +; CHECK-NEXT:str x30, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT:bl no_state_callee +; CHECK-NEXT:ldr x30, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT:ret + call void @no_state_callee(); + ret void; +} + +; Expect spill & fill of ZT0 around call +; Expect setup and restore lazy-save around call +; Expect smstart za after call +define void @za_zt0_shared_caller_no_state_callee() "aarch64_pstate_za_shared" "aarch64_in_zt0" nounwind { +; CHECK-LABEL: za_zt0_shared_caller_no_state_callee: +; CHECK: // %bb.0: +; CHECK-NEXT:stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-NEXT:mov x29, sp +; CHECK-NEXT:sub sp, sp, #16 +; CHECK-NEXT:rdsvl x8, #1 +; CHECK-NEXT:mov x9, sp +; CHECK-NEXT:msub x9, x8, x8, x9 +; CHECK-NEXT:mov sp, x9 +; CHECK-NEXT:sub x10, x29, #16 +; CHECK-NEXT:stur wzr, [x29, #-4] +; CHECK-NEXT:sturh wzr, [x29, #-6] +; CHECK-NEXT:stur x9, [x29, #-16] +; CHECK-NEXT:sturh w8, [x29, #-8] +; CHECK-NEXT:msr TPIDR2_EL0, x10 +; CHECK-NEXT:bl no_state_callee +; CHECK-NEXT:smstart za +; CHECK-NEXT:mrs x8, TPIDR2_EL0 +; CHECK-NEXT:sub x0, x29, #16 +; CHECK-NEXT:cbnz x8, .LBB1_2 +; CHECK-NEXT: // %bb.1: +; CHECK-NEXT:bl __arm_tpidr2_restore +; CHECK-NEXT: .LBB1_2: +; CHECK-NEXT:msr TPIDR2_EL0, xzr +; CHECK-NEXT:mov sp, x29 +; CHECK-NEXT:ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-NEXT:ret + call void @no_state_callee(); + ret void; +} + +; +; Shared-ZA Callee +; + +; Caller and callee have shared ZT0 state, no spill/fill of ZT0 required +define void @zt0_shared_caller_zt0_shared_callee() "aarch64_in_zt0" nounwind { +; CHECK-LABEL: zt0_shared_caller_zt0_shared_callee: +; CHECK: // %bb.0: +; CHECK-NEXT:str x30, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT:bl zt0_shared_callee +; CHECK-NEXT:ldr x30, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT:ret + call void @zt0_shared_callee(); + ret void; +} + +; Expect spill & fill of ZT0 around call +define void @za_zt0_shared_caller_za_shared_callee() "aarch64_pstate_za_shared" "aarch64_in_zt0" nounwind { +; CHECK-LABEL: za_zt0_shared_caller_za_shared_callee: +; CHECK: // %bb.0: +; CHECK-NEXT:stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-NEXT:mov x29, sp +; CHECK-NEXT:sub sp, sp, #16 +; CHECK-NEXT:rdsvl x8, #1 +; CHECK-NEXT:mov x9, sp +; CHECK-NEXT:msub x8, x8, x8, x9 +; CHECK-NEXT:mov sp, x8 +; CHECK-NEXT:stur wzr, [x29, #-4] +; CHECK-NEXT:sturh wzr, [x29, #-6] +; CHECK-NEXT:stur x8, [x29, #-16] +; CHECK-NEXT:bl za_shared_callee +; CHECK-NEXT:mov sp, x29 +; CHECK-NEXT:ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-NEXT:ret + call void @za_shared_callee(); + ret void; +} + +; Caller and callee have shared ZA & ZT0 +define void @za_zt0_shared_caller_za_zt0_shared_callee() "aarch64_pstate_za_shared" "aarch64_in_zt0" nounwind { +; CHECK-LABEL: za_zt0_shared_caller_za_zt0_shared_callee: +; CHECK: // %bb.0: +; CHECK-NEXT:stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-NEXT:mov x29, sp +; CHECK-NEXT:sub sp, sp, #16 +; CHECK-NEXT:rdsvl x8, #1 +; CHECK-NEXT:mov x9, sp +; CHECK-NEXT:msub x8, x8, x8, x9 +; CHECK-NEXT:mov sp, x8 +; CHECK-NEXT:stur wzr, [x29, #-4] +; CHECK-NEXT:sturh wzr, [x29, #-6] +; CHECK-NEXT:stur x8, [x29, #-16] +; CHECK-NEXT:bl za
[Lldb-commits] [clang-tools-extra] [clang] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)
@@ -4833,9 +4833,26 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity, E = cast(E)->getSubExpr(); goto recurse; - case Expr::SubstNonTypeTemplateParmExprClass: + case Expr::SubstNonTypeTemplateParmExprClass: { +// Mangle a substituted parameter the same way we mangle the template +// argument. +auto *SNTTPE = cast(E); +if (auto *CE = dyn_cast(SNTTPE->getReplacement())) { + // Pull out the constant value and mangle it as a template argument. + QualType ParamType = SNTTPE->getParameterType(Context.getASTContext()); + if (CE->hasAPValueResult()) +mangleValueInTemplateArg(ParamType, CE->getResultAsAPValue(), false, + /*NeedExactType=*/true); + else +mangleValueInTemplateArg(ParamType, CE->getAPValueResult(), false, + /*NeedExactType=*/true); bolshakov-a wrote: > `hasAPValueResult()` is looking at the `APValueKind` bitfield while > `getResultAsAPValue()` is checking the `ResultKind` bitfield. Good catch, thanks! https://github.com/llvm/llvm-project/pull/78041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang-tools-extra] [clang] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)
@@ -6472,7 +6494,20 @@ void CXXNameMangler::mangleValueInTemplateArg(QualType T, const APValue &V, Out << "plcvPcad"; Kind = Offset; } else { - if (!V.getLValuePath().empty() || V.isLValueOnePastTheEnd()) { + // Clang 11 and before mangled an array subject to array-to-pointer decay + // as if it were the declaration itself. + bool IsArrayToPointerDecayMangledAsDecl = false; + if (TopLevel && Ctx.getLangOpts().getClangABICompat() <= + LangOptions::ClangABI::Ver11) { +QualType BType = B.getType(); +IsArrayToPointerDecayMangledAsDecl = +BType->isArrayType() && V.getLValuePath().size() == 1 && +V.getLValuePath()[0].getAsArrayIndex() == 0 && +Ctx.hasSimilarType(T, Ctx.getDecayedType(BType)); + } + bolshakov-a wrote: This concerns ABI changes which are actually present in Clang since ver. 12. I think, they have been introduced [here](https://github.com/llvm/llvm-project/commit/6c365cd31e323d2d075573edd927e4f7fb5ec01c#diff-8a63be2ffd0742a4ce78d229b1bad68c62dd0b95e39d7f9a378bb52ad3f4a0b7R5011). The changes in this PR are to avoid regression. The test `CodeGenCXX/clang-abi-compat.cpp` fails if they are removed. https://github.com/llvm/llvm-project/pull/78041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang-tools-extra] [clang] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)
https://github.com/bolshakov-a updated https://github.com/llvm/llvm-project/pull/78041 >From 9bef9d5dd970f1af653d5b10d0a062d96a69ad01 Mon Sep 17 00:00:00 2001 From: Andrey Ali Khan Bolshakov Date: Sun, 6 Aug 2023 19:38:23 +0300 Subject: [PATCH] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. Previously committed as 9e08e51a20d0d2b1c5724bb17e969d036fced4cd, and reverted because a dependency commit was reverted, then committed again as 4b574008aef5a7235c1f894ab065fe300d26e786 and reverted again because "dependency commit" 5a391d38ac6c561ba908334d427f26124ed9132e was reverted. But it doesn't seem that 5a391d38ac6c was a real dependency for this. This commit incorporates 4b574008aef5a7235c1f894ab065fe300d26e786 and 18e093faf726d15f210ab4917142beec51848258 by Richard Smith, with some minor fixes, most notably: - `UncommonValue` renamed to `StructuralValue` - `VK_PRValue` instead of `VK_RValue` as default kind in lvalue and member pointer handling branch in `BuildExpressionFromNonTypeTemplateArgumentValue`; - handling of `StructuralValue` in `IsTypeDeclaredInsideVisitor`; - filling in `SugaredConverted` along with `CanonicalConverted` parameter in `Sema::CheckTemplateArgument`; - minor cleanup in `TemplateInstantiator::transformNonTypeTemplateParmRef`; - `TemplateArgument` constructors refactored; - `ODRHash` calculation for `UncommonValue`; - USR generation for `UncommonValue`; - more correct MS compatibility mangling algorithm (tested on MSVC ver. 19.35; toolset ver. 143); - IR emitting fixed on using a subobject as a template argument when the corresponding template parameter is used in an lvalue context; - `noundef` attribute and opaque pointers in `template-arguments` test; - analysis for C++17 mode is turned off for templates in `warn-bool-conversion` test; in C++17 and C++20 mode, array reference used as a template argument of pointer type produces template argument of UncommonValue type, and `BuildExpressionFromNonTypeTemplateArgumentValue` makes `OpaqueValueExpr` for it, and `DiagnoseAlwaysNonNullPointer` cannot see through it; despite of "These cases should not warn" comment, I'm not sure about correct behavior; I'd expect a suggestion to replace `if` by `if constexpr`; - `temp.arg.nontype/p1.cpp` and `dr18xx.cpp` tests fixed. --- clang-tools-extra/clangd/DumpAST.cpp | 1 + clang-tools-extra/clangd/FindTarget.cpp | 1 + clang/docs/ReleaseNotes.rst | 2 + clang/include/clang/AST/ODRHash.h | 3 + clang/include/clang/AST/PropertiesBase.td | 14 ++ clang/include/clang/AST/RecursiveASTVisitor.h | 2 + .../clang/AST/TemplateArgumentVisitor.h | 2 + clang/include/clang/AST/TemplateBase.h| 86 --- .../clang/Basic/DiagnosticSemaKinds.td| 5 - clang/include/clang/Sema/Sema.h | 4 +- clang/lib/AST/ASTContext.cpp | 5 + clang/lib/AST/ASTImporter.cpp | 13 ++ clang/lib/AST/ASTStructuralEquivalence.cpp| 3 + clang/lib/AST/Decl.cpp| 4 + clang/lib/AST/ItaniumMangle.cpp | 36 ++- clang/lib/AST/MicrosoftMangle.cpp | 78 +-- clang/lib/AST/ODRHash.cpp | 67 ++ clang/lib/AST/StmtProfile.cpp | 6 + clang/lib/AST/TemplateBase.cpp| 113 - clang/lib/AST/TypeLoc.cpp | 1 + clang/lib/CodeGen/CGDebugInfo.cpp | 10 + clang/lib/CodeGen/CGExpr.cpp | 12 +- clang/lib/Index/USRGeneration.cpp | 10 + clang/lib/Sema/SemaLookup.cpp | 1 + clang/lib/Sema/SemaOverload.cpp | 10 +- clang/lib/Sema/SemaTemplate.cpp | 218 +++--- clang/lib/Sema/SemaTemplateDeduction.cpp | 64 +++-- clang/lib/Sema/SemaTemplateInstantiate.cpp| 14 +- clang/lib/Sema/SemaTemplateVariadic.cpp | 2 + clang/lib/Sema/TreeTransform.h| 12 +- clang/lib/Serialization/ASTReader.cpp | 1 + clang/lib/Serialization/ASTWriter.cpp | 1 + clang/test/CXX/drs/dr18xx.cpp | 4 +- .../CXX/temp/temp.arg/temp.arg.nontype/p1.cpp | 4 +- clang/test/CodeGenCXX/mangle-ms-templates.cpp | 48 clang/test/CodeGenCXX/mangle-template.cpp | 40 +++- clang/test/CodeGenCXX/template-arguments.cpp | 113 + .../Index/USR/structural-value-tpl-arg.cpp| 23 ++ clang/test/Modules/odr_hash.cpp | 193 +++- clang/test/SemaCXX/warn-bool-conversion.cpp | 2 + .../SemaTemplate/temp_arg_nontype_cxx1z.cpp | 40 ++-- .../SemaTemplate/temp_arg_nontype_cxx20.cpp | 40 ++-- clang/tools/libclang/CIndex.cpp | 5 + clang/tools/libclang/CXCursor.cpp | 3 + clang/www/cxx_status.html | 18 +- lldb/include/lldb/lldb-enumerations.h | 1 + .../TypeSystem/Clang/TypeSystemClang.cpp
[Lldb-commits] [clang-tools-extra] [clang] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)
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 8e8bbbd48ee23764cc6030fd259dde6a1107c00c 9bef9d5dd970f1af653d5b10d0a062d96a69ad01 -- clang/test/CodeGenCXX/template-arguments.cpp clang/test/Index/USR/structural-value-tpl-arg.cpp clang-tools-extra/clangd/DumpAST.cpp clang-tools-extra/clangd/FindTarget.cpp clang/include/clang/AST/ODRHash.h clang/include/clang/AST/RecursiveASTVisitor.h clang/include/clang/AST/TemplateArgumentVisitor.h clang/include/clang/AST/TemplateBase.h clang/include/clang/Sema/Sema.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ASTImporter.cpp clang/lib/AST/ASTStructuralEquivalence.cpp clang/lib/AST/Decl.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/MicrosoftMangle.cpp clang/lib/AST/ODRHash.cpp clang/lib/AST/StmtProfile.cpp clang/lib/AST/TemplateBase.cpp clang/lib/AST/TypeLoc.cpp clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CGExpr.cpp clang/lib/Index/USRGeneration.cpp clang/lib/Sema/SemaLookup.cpp clang/lib/Sema/SemaOverload.cpp clang/lib/Sema/SemaTemplate.cpp clang/lib/Sema/SemaTemplateDeduction.cpp clang/lib/Sema/SemaTemplateInstantiate.cpp clang/lib/Sema/SemaTemplateVariadic.cpp clang/lib/Sema/TreeTransform.h clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/test/CXX/drs/dr18xx.cpp clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp clang/test/CodeGenCXX/mangle-ms-templates.cpp clang/test/CodeGenCXX/mangle-template.cpp clang/test/Modules/odr_hash.cpp clang/test/SemaCXX/warn-bool-conversion.cpp clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp clang/tools/libclang/CIndex.cpp clang/tools/libclang/CXCursor.cpp lldb/include/lldb/lldb-enumerations.h lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp `` View the diff from clang-format here. ``diff diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 60a3b6908a..56e8ee923e 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -4842,7 +4842,7 @@ recurse: QualType ParamType = SNTTPE->getParameterType(Context.getASTContext()); assert(CE->hasAPValueResult() && "expected the NTTP to have an APValue"); mangleValueInTemplateArg(ParamType, CE->getAPValueResult(), false, - /*NeedExactType=*/true); + /*NeedExactType=*/true); break; } // The remaining cases all happen to be substituted with expressions that `` https://github.com/llvm/llvm-project/pull/78041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang-tools-extra] [clang] [compiler-rt] [llvm] [flang] [libcxx] [lldb] [lld] [libc] [AArch64][SME2] Preserve ZT0 state around function calls (PR #78321)
https://github.com/kmclaughlin-arm closed https://github.com/llvm/llvm-project/pull/78321 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)
https://github.com/bolshakov-a updated https://github.com/llvm/llvm-project/pull/78041 >From 35e5e87d5c6f250f9f7a6cf5e5aeaebe5929f155 Mon Sep 17 00:00:00 2001 From: Andrey Ali Khan Bolshakov Date: Sun, 6 Aug 2023 19:38:23 +0300 Subject: [PATCH] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. Previously committed as 9e08e51a20d0d2b1c5724bb17e969d036fced4cd, and reverted because a dependency commit was reverted, then committed again as 4b574008aef5a7235c1f894ab065fe300d26e786 and reverted again because "dependency commit" 5a391d38ac6c561ba908334d427f26124ed9132e was reverted. But it doesn't seem that 5a391d38ac6c was a real dependency for this. This commit incorporates 4b574008aef5a7235c1f894ab065fe300d26e786 and 18e093faf726d15f210ab4917142beec51848258 by Richard Smith, with some minor fixes, most notably: - `UncommonValue` renamed to `StructuralValue` - `VK_PRValue` instead of `VK_RValue` as default kind in lvalue and member pointer handling branch in `BuildExpressionFromNonTypeTemplateArgumentValue`; - handling of `StructuralValue` in `IsTypeDeclaredInsideVisitor`; - filling in `SugaredConverted` along with `CanonicalConverted` parameter in `Sema::CheckTemplateArgument`; - minor cleanup in `TemplateInstantiator::transformNonTypeTemplateParmRef`; - `TemplateArgument` constructors refactored; - `ODRHash` calculation for `UncommonValue`; - USR generation for `UncommonValue`; - more correct MS compatibility mangling algorithm (tested on MSVC ver. 19.35; toolset ver. 143); - IR emitting fixed on using a subobject as a template argument when the corresponding template parameter is used in an lvalue context; - `noundef` attribute and opaque pointers in `template-arguments` test; - analysis for C++17 mode is turned off for templates in `warn-bool-conversion` test; in C++17 and C++20 mode, array reference used as a template argument of pointer type produces template argument of UncommonValue type, and `BuildExpressionFromNonTypeTemplateArgumentValue` makes `OpaqueValueExpr` for it, and `DiagnoseAlwaysNonNullPointer` cannot see through it; despite of "These cases should not warn" comment, I'm not sure about correct behavior; I'd expect a suggestion to replace `if` by `if constexpr`; - `temp.arg.nontype/p1.cpp` and `dr18xx.cpp` tests fixed. --- clang-tools-extra/clangd/DumpAST.cpp | 1 + clang-tools-extra/clangd/FindTarget.cpp | 1 + clang/docs/ReleaseNotes.rst | 2 + clang/include/clang/AST/ODRHash.h | 3 + clang/include/clang/AST/PropertiesBase.td | 14 ++ clang/include/clang/AST/RecursiveASTVisitor.h | 2 + .../clang/AST/TemplateArgumentVisitor.h | 2 + clang/include/clang/AST/TemplateBase.h| 86 --- .../clang/Basic/DiagnosticSemaKinds.td| 5 - clang/include/clang/Sema/Sema.h | 4 +- clang/lib/AST/ASTContext.cpp | 5 + clang/lib/AST/ASTImporter.cpp | 13 ++ clang/lib/AST/ASTStructuralEquivalence.cpp| 3 + clang/lib/AST/Decl.cpp| 4 + clang/lib/AST/ItaniumMangle.cpp | 36 ++- clang/lib/AST/MicrosoftMangle.cpp | 78 +-- clang/lib/AST/ODRHash.cpp | 67 ++ clang/lib/AST/StmtProfile.cpp | 6 + clang/lib/AST/TemplateBase.cpp| 113 - clang/lib/AST/TypeLoc.cpp | 1 + clang/lib/CodeGen/CGDebugInfo.cpp | 10 + clang/lib/CodeGen/CGExpr.cpp | 12 +- clang/lib/Index/USRGeneration.cpp | 10 + clang/lib/Sema/SemaLookup.cpp | 1 + clang/lib/Sema/SemaOverload.cpp | 10 +- clang/lib/Sema/SemaTemplate.cpp | 218 +++--- clang/lib/Sema/SemaTemplateDeduction.cpp | 64 +++-- clang/lib/Sema/SemaTemplateInstantiate.cpp| 14 +- clang/lib/Sema/SemaTemplateVariadic.cpp | 2 + clang/lib/Sema/TreeTransform.h| 12 +- clang/lib/Serialization/ASTReader.cpp | 1 + clang/lib/Serialization/ASTWriter.cpp | 1 + clang/test/CXX/drs/dr18xx.cpp | 4 +- .../CXX/temp/temp.arg/temp.arg.nontype/p1.cpp | 4 +- clang/test/CodeGenCXX/mangle-ms-templates.cpp | 48 clang/test/CodeGenCXX/mangle-template.cpp | 40 +++- clang/test/CodeGenCXX/template-arguments.cpp | 113 + .../Index/USR/structural-value-tpl-arg.cpp| 23 ++ clang/test/Modules/odr_hash.cpp | 193 +++- clang/test/SemaCXX/warn-bool-conversion.cpp | 2 + .../SemaTemplate/temp_arg_nontype_cxx1z.cpp | 40 ++-- .../SemaTemplate/temp_arg_nontype_cxx20.cpp | 40 ++-- clang/tools/libclang/CIndex.cpp | 5 + clang/tools/libclang/CXCursor.cpp | 3 + clang/www/cxx_status.html | 18 +- lldb/include/lldb/lldb-enumerations.h | 1 + .../TypeSystem/Clang/TypeSystemClang.cpp
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)
https://github.com/bolshakov-a updated https://github.com/llvm/llvm-project/pull/78041 >From 7abb30826263ad69d529dd6af585bf3bce40f979 Mon Sep 17 00:00:00 2001 From: Andrey Ali Khan Bolshakov Date: Sun, 6 Aug 2023 19:38:23 +0300 Subject: [PATCH] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. Previously committed as 9e08e51a20d0d2b1c5724bb17e969d036fced4cd, and reverted because a dependency commit was reverted, then committed again as 4b574008aef5a7235c1f894ab065fe300d26e786 and reverted again because "dependency commit" 5a391d38ac6c561ba908334d427f26124ed9132e was reverted. But it doesn't seem that 5a391d38ac6c was a real dependency for this. This commit incorporates 4b574008aef5a7235c1f894ab065fe300d26e786 and 18e093faf726d15f210ab4917142beec51848258 by Richard Smith, with some minor fixes, most notably: - `UncommonValue` renamed to `StructuralValue` - `VK_PRValue` instead of `VK_RValue` as default kind in lvalue and member pointer handling branch in `BuildExpressionFromNonTypeTemplateArgumentValue`; - handling of `StructuralValue` in `IsTypeDeclaredInsideVisitor`; - filling in `SugaredConverted` along with `CanonicalConverted` parameter in `Sema::CheckTemplateArgument`; - minor cleanup in `TemplateInstantiator::transformNonTypeTemplateParmRef`; - `TemplateArgument` constructors refactored; - `ODRHash` calculation for `UncommonValue`; - USR generation for `UncommonValue`; - more correct MS compatibility mangling algorithm (tested on MSVC ver. 19.35; toolset ver. 143); - IR emitting fixed on using a subobject as a template argument when the corresponding template parameter is used in an lvalue context; - `noundef` attribute and opaque pointers in `template-arguments` test; - analysis for C++17 mode is turned off for templates in `warn-bool-conversion` test; in C++17 and C++20 mode, array reference used as a template argument of pointer type produces template argument of UncommonValue type, and `BuildExpressionFromNonTypeTemplateArgumentValue` makes `OpaqueValueExpr` for it, and `DiagnoseAlwaysNonNullPointer` cannot see through it; despite of "These cases should not warn" comment, I'm not sure about correct behavior; I'd expect a suggestion to replace `if` by `if constexpr`; - `temp.arg.nontype/p1.cpp` and `dr18xx.cpp` tests fixed. --- clang-tools-extra/clangd/DumpAST.cpp | 1 + clang-tools-extra/clangd/FindTarget.cpp | 1 + clang/docs/ReleaseNotes.rst | 2 + clang/include/clang/AST/ODRHash.h | 3 + clang/include/clang/AST/PropertiesBase.td | 14 ++ clang/include/clang/AST/RecursiveASTVisitor.h | 2 + .../clang/AST/TemplateArgumentVisitor.h | 2 + clang/include/clang/AST/TemplateBase.h| 86 --- .../clang/Basic/DiagnosticSemaKinds.td| 5 - clang/include/clang/Sema/Sema.h | 4 +- clang/lib/AST/ASTContext.cpp | 5 + clang/lib/AST/ASTImporter.cpp | 13 ++ clang/lib/AST/ASTStructuralEquivalence.cpp| 3 + clang/lib/AST/Decl.cpp| 4 + clang/lib/AST/ItaniumMangle.cpp | 36 ++- clang/lib/AST/MicrosoftMangle.cpp | 78 +-- clang/lib/AST/ODRHash.cpp | 67 ++ clang/lib/AST/StmtProfile.cpp | 6 + clang/lib/AST/TemplateBase.cpp| 113 - clang/lib/AST/TypeLoc.cpp | 1 + clang/lib/CodeGen/CGDebugInfo.cpp | 10 + clang/lib/CodeGen/CGExpr.cpp | 12 +- clang/lib/Index/USRGeneration.cpp | 10 + clang/lib/Sema/SemaLookup.cpp | 1 + clang/lib/Sema/SemaOverload.cpp | 10 +- clang/lib/Sema/SemaTemplate.cpp | 218 +++--- clang/lib/Sema/SemaTemplateDeduction.cpp | 64 +++-- clang/lib/Sema/SemaTemplateInstantiate.cpp| 14 +- clang/lib/Sema/SemaTemplateVariadic.cpp | 2 + clang/lib/Sema/TreeTransform.h| 12 +- clang/lib/Serialization/ASTReader.cpp | 1 + clang/lib/Serialization/ASTWriter.cpp | 1 + clang/test/CXX/drs/dr18xx.cpp | 4 +- .../CXX/temp/temp.arg/temp.arg.nontype/p1.cpp | 4 +- clang/test/CodeGenCXX/mangle-ms-templates.cpp | 48 clang/test/CodeGenCXX/mangle-template.cpp | 40 +++- clang/test/CodeGenCXX/template-arguments.cpp | 113 + .../Index/USR/structural-value-tpl-arg.cpp| 23 ++ clang/test/Modules/odr_hash.cpp | 193 +++- clang/test/SemaCXX/warn-bool-conversion.cpp | 2 + .../SemaTemplate/temp_arg_nontype_cxx1z.cpp | 40 ++-- .../SemaTemplate/temp_arg_nontype_cxx20.cpp | 40 ++-- clang/tools/libclang/CIndex.cpp | 5 + clang/tools/libclang/CXCursor.cpp | 3 + clang/www/cxx_status.html | 18 +- lldb/include/lldb/lldb-enumerations.h | 1 + .../TypeSystem/Clang/TypeSystemClang.cpp
[Lldb-commits] [libcxx] [lld] [llvm] [compiler-rt] [lldb] [lld-macho] Find objects in library search path (PR #78628)
https://github.com/oontvoo approved this pull request. LGTM. Thanks! https://github.com/llvm/llvm-project/pull/78628 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [clang] [llvm] [libcxx] [openmp] [libc] [clang-tools-extra] [compiler-rt] [lldb] [flang] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
H-G-Hristov wrote: This FreeBSD failure seems unrelated: ``` # .---command stderr # | In file included from /usr/home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/std/algorithms/numeric.ops/transform.reduce/pstl.exception_handling.pass.cpp:20: # | /home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/support/check_assertion.h:293:25: error: use of undeclared identifier 'SIGILL' # | if (exit_code_ == SIGILL || exit_code_ == SIGTRAP) { # | ^ # | /home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/support/check_assertion.h:293:49: error: use of undeclared identifier 'SIGTRAP' # | if (exit_code_ == SIGILL || exit_code_ == SIGTRAP) { # | ^ # | 2 errors generated. # `- # error: command failed with exit status: 1 ``` https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [mlir] [clang] [llvm] [libcxx] [openmp] [libc] [clang-tools-extra] [compiler-rt] [lldb] [flang] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)
H-G-Hristov wrote: This FreeBSD failure seems unrelated, the same appears in `variant`: ``` # .---command stderr # | In file included from /usr/home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp:19: # | /home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/support/check_assertion.h:293:25: error: use of undeclared identifier 'SIGILL' # | if (exit_code_ == SIGILL || exit_code_ == SIGTRAP) { # | ^ # | /home/buildkite/.buildkite-agent/builds/freebsd-test-1/llvm-project/libcxx-ci/libcxx/test/support/check_assertion.h:293:49: error: use of undeclared identifier 'SIGTRAP' # | if (exit_code_ == SIGILL || exit_code_ == SIGTRAP) { # | ^ # | 2 errors generated. # `- # error: command failed with exit status: 1 https://github.com/llvm/llvm-project/pull/76449 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang-tools-extra] [libc] [lld] [libcxx] [llvm] [clang] [flang] [lldb] [compiler-rt] [VPlan] Implement cloning of VPlans. (PR #73158)
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/73158 >From 13a26e8e7440c3b501730b22588af393a3e543cd Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Thu, 6 Jul 2023 08:07:45 +0100 Subject: [PATCH] [VPlan] Implement cloning of VPlans. This patch implements cloning for VPlans and recipes. Cloning is used in the epilogue vectorization path, to clone the VPlan for the main vector loop. This means we won't re-use a VPlan when executing the VPlan for the epilogue vector loop, which in turn will enable us to perform optimizations based on UF & VF. --- .../Transforms/Vectorize/LoopVectorize.cpp| 2 +- llvm/lib/Transforms/Vectorize/VPlan.cpp | 124 llvm/lib/Transforms/Vectorize/VPlan.h | 182 ++ .../Transforms/Vectorize/VPlanTest.cpp| 2 + 4 files changed, 309 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 10c068e3b5895c..9ffd44d59ffc6d 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -10078,7 +10078,7 @@ bool LoopVectorizePass::processLoop(Loop *L) { EpilogueVectorizerMainLoop MainILV(L, PSE, LI, DT, TLI, TTI, AC, ORE, EPI, &LVL, &CM, BFI, PSI, Checks); -VPlan &BestMainPlan = LVP.getBestPlanFor(EPI.MainLoopVF); +VPlan &BestMainPlan = *LVP.getBestPlanFor(EPI.MainLoopVF).clone(); const auto &[ExpandedSCEVs, ReductionResumeValues] = LVP.executePlan( EPI.MainLoopVF, EPI.MainLoopUF, BestMainPlan, MainILV, DT, true); ++LoopsVectorized; diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp index b6e56c47c227f7..99b2a3bd59a64d 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp @@ -615,6 +615,18 @@ void VPBasicBlock::print(raw_ostream &O, const Twine &Indent, } #endif +VPBlockBase *VPRegionBlock::clone() { + DenseMap Old2New; + DenseMap Old2NewVPValues; + VPBlockBase *NewEntry = + VPBlockUtils::cloneCFG(Entry, Old2New, Old2NewVPValues); + auto *NewR = + new VPRegionBlock(NewEntry, Old2New[Exiting], getName(), isReplicator()); + for (VPBlockBase *Block : vp_depth_first_shallow(NewEntry)) +Block->setParent(NewR); + return NewR; +} + void VPRegionBlock::dropAllReferences(VPValue *NewValue) { for (VPBlockBase *Block : vp_depth_first_shallow(Entry)) // Drop all references in VPBasicBlocks and replace all uses with @@ -982,6 +994,65 @@ void VPlan::updateDominatorTree(DominatorTree *DT, BasicBlock *LoopHeaderBB, assert(DT->verify(DominatorTree::VerificationLevel::Fast)); } +static void remapVPValues(VPBasicBlock *OldBB, VPBasicBlock *NewBB, + DenseMap &Old2NewVPValues, + bool Full = false) { + for (const auto &[OldR, NewR] : zip(*OldBB, *NewBB)) { +for (unsigned I = 0, E = NewR.getNumOperands(); I != E; ++I) { + VPValue *NewOp = Old2NewVPValues.lookup(OldR.getOperand(I)); + if (!Full) +continue; + NewR.setOperand(I, NewOp); +} +for (const auto &[OldV, NewV] : + zip(OldR.definedValues(), NewR.definedValues())) + Old2NewVPValues[OldV] = NewV; + } +} + +VPlan *VPlan::clone() { + DenseMap Old2New; + DenseMap Old2NewVPValues; + + auto *NewPlan = new VPlan(); + SmallVector NewLiveIns; + for (VPValue *LI : VPLiveInsToFree) { +VPValue *NewLI = new VPValue(LI->getLiveInIRValue()); +NewPlan->VPLiveInsToFree.push_back(NewLI); +Old2NewVPValues[LI] = NewLI; + } + + Old2NewVPValues[&VectorTripCount] = &NewPlan->VectorTripCount; + Old2NewVPValues[&VFxUF] = &NewPlan->VFxUF; + if (BackedgeTakenCount) { +Old2NewVPValues[BackedgeTakenCount] = new VPValue(); +NewPlan->BackedgeTakenCount = Old2NewVPValues[BackedgeTakenCount]; + } + + auto NewPH = cast(Preheader->clone()); + remapVPValues(cast(Preheader), cast(NewPH), +Old2NewVPValues, /*Full*/ true); + VPValue *NewTC = Old2NewVPValues.lookup(TripCount); + if (!NewTC) +Old2NewVPValues[TripCount] = new VPValue(TripCount->getLiveInIRValue()); + NewPlan->TripCount = Old2NewVPValues[TripCount]; + + auto *NewEntry = cast(VPBlockUtils::cloneCFG( + getEntry(), Old2New, Old2NewVPValues, /*FullRemapping*/ true)); + + NewPlan->Entry = NewEntry; + NewPlan->Preheader = NewPH; + NewEntry->setPlan(NewPlan); + NewPH->setPlan(NewPlan); + NewPlan->VFs = VFs; + NewPlan->UFs = UFs; + NewPlan->Name = Name; + + for (const auto &[_, LO] : LiveOuts) +NewPlan->addLiveOut(LO->getPhi(), Old2NewVPValues[LO->getOperand(0)]); + return NewPlan; +} + #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) Twine VPlanPrinter::getUID(const VPBlockBase *Block) { @@ -1200,6 +1271,59 @@ void VPUser::printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const { } #endif +VP
[Lldb-commits] [clang-tools-extra] [flang] [openmp] [llvm] [compiler-rt] [libc] [libcxx] [clang] [lld] [lldb] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
@@ -1130,6 +1137,19 @@ using __best_match_t = typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, } // namespace __variant_detail +template < class _Visitor, class... _Vs, typename = void_t()))...> > +_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr decltype(auto) +visit(_Visitor&& __visitor, _Vs&&... __vs); + +# if _LIBCPP_STD_VER >= 20 +template < class _Rp, mordante wrote: ```suggestion template https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [clang] [llvm] [compiler-rt] [openmp] [lldb] [clang-tools-extra] [flang] [libc] [libcxx] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
@@ -1130,6 +1137,19 @@ using __best_match_t = typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, } // namespace __variant_detail +template < class _Visitor, class... _Vs, typename = void_t()))...> > mordante wrote: Clang-format needs to be compatible with C++03, but this is C++17 so we can remove some spaces. ```suggestion template ()))...>> ``` https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [compiler-rt] [flang] [openmp] [clang] [clang-tools-extra] [lld] [libcxx] [libc] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
https://github.com/mordante edited https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libc] [openmp] [libcxx] [flang] [lld] [clang-tools-extra] [llvm] [compiler-rt] [lldb] [clang] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
https://github.com/mordante requested changes to this pull request. Mostly LGTM, I like to see it again for a quick look. https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [llvm] [clang] [libcxx] [compiler-rt] [libc] [lldb] [lld] [clang-tools-extra] [flang] [openmp] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
@@ -0,0 +1,48 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23 +// The tested functionality needs deducing this. +// UNSUPPORTED: clang-16 || clang-17 || apple-clang mordante wrote: clang-16 and clang-17 do not work and we know clang-18 works. So we don't need to test these old versions. They never magically start to work. The current version of AppleClang does not work, a future version will start to work. We want to be notified when that happens event so we can add the proper AppleClang restrictions. When the test passes with AppleClang the test will fail since it was expected to fail. Then we can update the filter. ```suggestion // UNSUPPORTED: clang-16 || clang-17 // XFAIL: apple-clang ``` https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libc] [flang] [openmp] [lld] [llvm] [libcxx] [clang-tools-extra] [compiler-rt] [lldb] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
@@ -1267,7 +1267,11 @@ def add_version_header(tc): }, { "name": "__cpp_lib_variant", -"values": {"c++17": 202102}, +"values": { +"c++17": 202102, # std::visit for classes derived from std::variant +# "c++20": 202106, # Fully constexpr std::variant +# "c++26": 202306, # Member visit mordante wrote: ```suggestion # "c++26": 202306, # Member visit (implemented) ``` https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [openmp] [clang] [lld] [libc] [lldb] [llvm] [libcxx] [clang-tools-extra] [compiler-rt] [flang] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
@@ -0,0 +1,357 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23 +// The tested functionality needs deducing this. +// UNSUPPORTED: clang-16 || clang-17 || apple-clang + +// + +// class variant; + +// template +// constexpr R visit(this Self&&, Visitor&&); // since C++26 + +#include +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "variant_test_helpers.h" + +template +struct overloaded : Ts... { + using Ts::operator()...; +}; + +void test_overload_ambiguity() { + using V = std::variant; + using namespace std::string_literals; + V v{"baba"s}; + + v.visit( + overloaded{[]([[maybe_unused]] auto x) { assert(false); }, [](const std::string& x) { assert(x == "baba"s); }}); + assert(std::get(v) == "baba"s); + + // Test the constraint. + v = std::move(v).visit(overloaded{ + []([[maybe_unused]] auto x) { +assert(false); +return 0; + }, + [](const std::string& x) { +assert(x == "baba"s); +return x + " zmt"s; + }}); + assert(std::get(v) == "baba zmt"s); +} + +template +void test_call_operator_forwarding() { + using Fn = ForwardingCallObject; + Fn obj{}; + const Fn& cobj = obj; + + { // test call operator forwarding - no variant +// non-member +{ + std::visit(obj); + assert(Fn::check_call<>(CT_NonConst | CT_LValue)); + std::visit(cobj); + assert(Fn::check_call<>(CT_Const | CT_LValue)); + std::visit(std::move(obj)); + assert(Fn::check_call<>(CT_NonConst | CT_RValue)); + std::visit(std::move(cobj)); + assert(Fn::check_call<>(CT_Const | CT_RValue)); +} mordante wrote: Do we need this test? https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [clang] [lld] [openmp] [libc] [llvm] [lldb] [libcxx] [flang] [clang-tools-extra] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
@@ -1130,6 +1137,19 @@ using __best_match_t = typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, } // namespace __variant_detail +template < class _Visitor, class... _Vs, typename = void_t()))...> > +_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr decltype(auto) +visit(_Visitor&& __visitor, _Vs&&... __vs); + +# if _LIBCPP_STD_VER >= 20 +template < class _Rp, + class _Visitor, + class... _Vs, + typename = void_t()))...> > mordante wrote: ```suggestion typename = void_t()))...>> ``` https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libc] [lld] [compiler-rt] [libcxx] [lldb] [clang-tools-extra] [flang] [llvm] [openmp] [clang] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
@@ -1273,6 +1293,24 @@ public: __impl_.__swap(__that.__impl_); } +# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER) + struct __variant_visit_barrier_tag { // unnamable when using standard library modules mordante wrote: I'm not sure what you try to say with the comment. I think it means you use an ugly name to avoid the std modules to fail. Is that correct? If this comment is not to useful. All ugly names are not exported. Maybe instead add a comment like ``` // Helper class to implement [variant.visit]/10 // Constraints: The call to visit does not use an explicit template-argument-list // that begins with a type template-argument. ``` https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [openmp] [clang] [lld] [libc] [lldb] [llvm] [libcxx] [clang-tools-extra] [compiler-rt] [mlir] [flang] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)
https://github.com/mordante edited https://github.com/llvm/llvm-project/pull/76449 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang-tools-extra] [clang] [mlir] [llvm] [openmp] [compiler-rt] [libcxx] [lld] [flang] [libc] [lldb] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)
@@ -470,4 +470,9 @@ inline Tp const& DoNotOptimize(Tp const& value) { # define TEST_IF_AIX(arg_true, arg_false) arg_false #endif +// Clang-18 has support for deducing this, but it does not set the FTM. +#if defined(__cpp_explicit_this_parameter) || (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1800) mordante wrote: This in one of the exceptions where we can use ```suggestion #ifdef _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER ``` MSVC STL has their own test file `libcxx/test/support/msvc_stdlib_force_include.h` where they can set this define for their compilers when they implement it. https://github.com/llvm/llvm-project/pull/76449 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [flang] [clang] [mlir] [llvm] [libcxx] [libc] [lld] [lldb] [compiler-rt] [clang-tools-extra] [openmp] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)
https://github.com/mordante approved this pull request. Thanks LGTM modulo a few minor comment. https://github.com/llvm/llvm-project/pull/76449 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lld] [lldb] [flang] [mlir] [llvm] [libcxx] [libc] [openmp] [compiler-rt] [clang-tools-extra] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)
@@ -7,7 +7,8 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME -// XFAIL: clang-16 || clang-17 +// The tested functionality needs deducing this. +// UNSUPPORTED: clang-16 || clang-17 || apple-clang mordante wrote: please xfail apple-clang in all these tests. https://github.com/llvm/llvm-project/pull/76449 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [openmp] [llvm] [mlir] [lldb] [clang] [compiler-rt] [lld] [libc] [libcxx] [flang] [clang-tools-extra] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)
@@ -1513,6 +1519,11 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK # endif +// Clang-18 has support for deducing this, but it does not set the FTM. +#if defined(__cpp_explicit_this_parameter) || (defined(_LIBCPP_CLANG_VER ) &&_LIBCPP_CLANG_VER >= 1800) +# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER +#endif + mordante wrote: Please make sure merging this patch does not duplicate this entry. https://github.com/llvm/llvm-project/pull/76449 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [openmp] [libc] [mlir] [lld] [llvm] [clang] [clang-tools-extra] [compiler-rt] [lldb] [flang] [libcxx] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
@@ -0,0 +1,357 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23 +// The tested functionality needs deducing this. +// UNSUPPORTED: clang-16 || clang-17 || apple-clang + +// + +// class variant; + +// template +// constexpr R visit(this Self&&, Visitor&&); // since C++26 + +#include +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "variant_test_helpers.h" + +template +struct overloaded : Ts... { + using Ts::operator()...; +}; + +void test_overload_ambiguity() { + using V = std::variant; + using namespace std::string_literals; + V v{"baba"s}; + + v.visit( + overloaded{[]([[maybe_unused]] auto x) { assert(false); }, [](const std::string& x) { assert(x == "baba"s); }}); + assert(std::get(v) == "baba"s); + + // Test the constraint. + v = std::move(v).visit(overloaded{ + []([[maybe_unused]] auto x) { +assert(false); +return 0; + }, + [](const std::string& x) { +assert(x == "baba"s); +return x + " zmt"s; + }}); + assert(std::get(v) == "baba zmt"s); +} + +template +void test_call_operator_forwarding() { + using Fn = ForwardingCallObject; + Fn obj{}; + const Fn& cobj = obj; + + { // test call operator forwarding - no variant +// non-member +{ + std::visit(obj); + assert(Fn::check_call<>(CT_NonConst | CT_LValue)); + std::visit(cobj); + assert(Fn::check_call<>(CT_Const | CT_LValue)); + std::visit(std::move(obj)); + assert(Fn::check_call<>(CT_NonConst | CT_RValue)); + std::visit(std::move(cobj)); + assert(Fn::check_call<>(CT_Const | CT_RValue)); +} H-G-Hristov wrote: Good catch! Thank you! https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [libcxx] [llvm] [lld] [lldb] [lld-macho] Find objects in library search path (PR #78628)
thevinster wrote: Do you have write permissions? Or, were waiting for someone to help you merge this PR? https://github.com/llvm/llvm-project/pull/78628 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [openmp] [libc] [mlir] [lld] [llvm] [clang] [clang-tools-extra] [compiler-rt] [lldb] [flang] [libcxx] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)
@@ -1513,6 +1519,11 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK # endif +// Clang-18 has support for deducing this, but it does not set the FTM. +#if defined(__cpp_explicit_this_parameter) || (defined(_LIBCPP_CLANG_VER ) &&_LIBCPP_CLANG_VER >= 1800) +# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER +#endif + H-G-Hristov wrote: Of course! https://github.com/llvm/llvm-project/pull/76449 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [lld] [libcxx] [openmp] [llvm] [clang-tools-extra] [flang] [clang] [mlir] [libc] [lldb] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)
H-G-Hristov wrote: @mordante Could you please have another look at the test/latest update. https://github.com/llvm/llvm-project/pull/76449 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [libc] [flang] [mlir] [libcxx] [lldb] [clang-tools-extra] [openmp] [clang] [llvm] [lld] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
https://github.com/mordante approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [lld] [libcxx] [openmp] [llvm] [clang-tools-extra] [flang] [clang] [mlir] [libc] [lldb] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)
https://github.com/mordante approved this pull request. Still LGTM! https://github.com/llvm/llvm-project/pull/76449 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [libcxx] [compiler-rt] [lldb] [llvm] [lld-macho] Find objects in library search path (PR #78628)
OldWorldOrdr wrote: I'm just some guy I don't have write perms, this is my first time contributing to llvm https://github.com/llvm/llvm-project/pull/78628 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [flang] [libcxx] [compiler-rt] [libc] [clang] [lldb] [clang-tools-extra] [llvm] [lld-macho] Find objects in library search path (PR #78628)
https://github.com/OldWorldOrdr updated https://github.com/llvm/llvm-project/pull/78628 >From e73fc2d0263e9e601f2964a90cfe347e8d2bb87c Mon Sep 17 00:00:00 2001 From: OldWorldOrdr Date: Thu, 18 Jan 2024 16:20:52 -0500 Subject: [PATCH 1/5] [lld-macho] Find objects in library search path --- lld/MachO/Driver.cpp | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp index 401459a054394e..f04165f5c02615 100644 --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -95,11 +95,16 @@ static std::optional findLibrary(StringRef name) { findPathCombination("lib" + name, config->librarySearchPaths, {".tbd", ".dylib", ".so"})) return path; - return findPathCombination("lib" + name, config->librarySearchPaths, - {".a"}); + else if (std::optional path = findPathCombination( + "lib" + name, config->librarySearchPaths, {".a"})) +return path; + return findPathCombination(name, config->librarySearchPaths, {""}); } -return findPathCombination("lib" + name, config->librarySearchPaths, - {".tbd", ".dylib", ".so", ".a"}); +if (std::optional path = +findPathCombination("lib" + name, config->librarySearchPaths, +{".tbd", ".dylib", ".so", ".a"})) + return path; +return findPathCombination(name, config->librarySearchPaths, {""}); }; std::optional path = doFind(); >From 5b29c5da6770982fb2f36edcd3a367893b18a19d Mon Sep 17 00:00:00 2001 From: OldWorldOrdr Date: Thu, 18 Jan 2024 21:16:57 -0500 Subject: [PATCH 2/5] [lld-macho] find objects in library search path version 2 --- lld/MachO/Driver.cpp | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp index f04165f5c02615..f8b01da5255c6d 100644 --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -90,21 +90,19 @@ static std::optional findLibrary(StringRef name) { return entry->second; auto doFind = [&] { +// Special case for Csu support files. +if (name.ends_with(".o")) + return findPathCombination(name, config->librarySearchPaths, {""}); if (config->searchDylibsFirst) { if (std::optional path = findPathCombination("lib" + name, config->librarySearchPaths, {".tbd", ".dylib", ".so"})) return path; - else if (std::optional path = findPathCombination( - "lib" + name, config->librarySearchPaths, {".a"})) -return path; - return findPathCombination(name, config->librarySearchPaths, {""}); + return findPathCombination("lib" + name, config->librarySearchPaths, + {".a"}); } -if (std::optional path = -findPathCombination("lib" + name, config->librarySearchPaths, -{".tbd", ".dylib", ".so", ".a"})) - return path; -return findPathCombination(name, config->librarySearchPaths, {""}); +return findPathCombination("lib" + name, config->librarySearchPaths, + {".tbd", ".dylib", ".so", ".a"}); }; std::optional path = doFind(); >From 5aab87e5c580ca1dba654fb00cf9571c7e3c7999 Mon Sep 17 00:00:00 2001 From: OldWorldOrdr Date: Fri, 19 Jan 2024 01:32:20 -0500 Subject: [PATCH 3/5] add test case --- lld/test/MachO/link-csu-obj.s | 10 ++ 1 file changed, 10 insertions(+) create mode 100644 lld/test/MachO/link-csu-obj.s diff --git a/lld/test/MachO/link-csu-obj.s b/lld/test/MachO/link-csu-obj.s new file mode 100644 index 00..00cb26bb260743 --- /dev/null +++ b/lld/test/MachO/link-csu-obj.s @@ -0,0 +1,10 @@ +# REQUIRES: x86 +# RUN: mkdir -p %t +# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s -o %t/hello.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/main.o +# RUN: %lld -L %t %t/main.o %t/hello.o -o %t/a.out + +.globl _main +_main: +call _print_hello +ret >From 6e8b321b1ed74665f26e5ee6dd0a04ec7b4dbb89 Mon Sep 17 00:00:00 2001 From: OldWorldOrdr Date: Fri, 19 Jan 2024 11:38:25 -0500 Subject: [PATCH 4/5] Improve comment --- lld/MachO/Driver.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp index f8b01da5255c6d..7ac3f51cec103f 100644 --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -90,7 +90,8 @@ static std::optional findLibrary(StringRef name) { return entry->second; auto doFind = [&] { -// Special case for Csu support files. +// Special case for Csu support files required for Mac OS X 10.7 and older +// (crt1.o) if (name.ends_with(".o")) return findPathCombination(name, config->librarySearchPaths, {""}); if (config->searchDylibsFirst) { >From 98506602d19602779088
[Lldb-commits] [compiler-rt] [clang] [flang] [libc] [lldb] [libcxx] [clang-tools-extra] [llvm] [lld] [lld-macho] Find objects in library search path (PR #78628)
https://github.com/thevinster closed https://github.com/llvm/llvm-project/pull/78628 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Skip ObjC timezone tests on macOS >= 14 (NFC) (PR #78817)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/78817 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFCI] Remove EventData* param from BroadcastEvent (PR #78773)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/78773 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [clang] [libc] [flang] [lld] [clang-tools-extra] [llvm] [libcxx] [compiler-rt] [lld-macho] Find objects in library search path (PR #78628)
@@ -0,0 +1,14 @@ +# REQUIRES: x86 +# RUN: mkdir -p %t +# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s -o %t/hello.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/main.o +# RUN: %lld -L %t %t/main.o %t/hello.o -o %t/a.out smeenai wrote: Should one of these be linked with `-l` instead of by path? https://github.com/llvm/llvm-project/pull/78628 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [clang] [llvm] [lldb] [flang] [lld] [libcxx] [clang-tools-extra] [libc] [lld-macho] Find objects in library search path (PR #78628)
@@ -0,0 +1,14 @@ +# REQUIRES: x86 +# RUN: mkdir -p %t +# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s -o %t/hello.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/main.o +# RUN: %lld -L %t %t/main.o %t/hello.o -o %t/a.out OldWorldOrdr wrote: AHH https://github.com/llvm/llvm-project/pull/78628 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [clang] [llvm] [lldb] [flang] [lld] [libcxx] [clang-tools-extra] [libc] [lld-macho] Find objects in library search path (PR #78628)
@@ -0,0 +1,14 @@ +# REQUIRES: x86 +# RUN: mkdir -p %t +# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s -o %t/hello.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/main.o +# RUN: %lld -L %t %t/main.o %t/hello.o -o %t/a.out OldWorldOrdr wrote: I fixed it in my branch but the pr is already merged https://github.com/llvm/llvm-project/pull/78628 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [flang] [clang] [llvm] [lld] [clang-tools-extra] [lldb] [mlir] [compiler-rt] [libcxx] [clang-format] Add ShortReturnTypeColumn option. (PR #78011)
https://github.com/rmarker updated https://github.com/llvm/llvm-project/pull/78011 >From c4d28f82e108f9f12ccd0375e2a3502025b8c1e8 Mon Sep 17 00:00:00 2001 From: rmarker Date: Thu, 11 Jan 2024 15:01:18 +1030 Subject: [PATCH 1/3] [clang-format] Add ShortReturnTypeLength option. --- clang/docs/ClangFormatStyleOptions.rst | 8 clang/docs/ReleaseNotes.rst| 1 + clang/include/clang/Format/Format.h| 8 clang/lib/Format/ContinuationIndenter.cpp | 3 +- clang/lib/Format/Format.cpp| 2 + clang/unittests/Format/ConfigParseTest.cpp | 1 + clang/unittests/Format/FormatTest.cpp | 44 ++ 7 files changed, 66 insertions(+), 1 deletion(-) diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index ac9a0b70ed5daa4..3255ceb0aba75b4 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -4994,6 +4994,14 @@ the configuration (without a prefix: ``Auto``). int bar; int bar; } // namespace b } // namespace b +.. _ShortReturnTypeLength: + +**ShortReturnTypeLength** (``Unsigned``) :versionbadge:`clang-format 18` :ref:`¶ ` + When AlwaysBreakAfterReturnType is None, line breaks are prevented after + short return types. This configures the character limit for a type to be + regarded as short. Note that this isn't the length of the type itself, + but the column where it finishes. I.e. it includes indentation, etc. + .. _SortIncludes: **SortIncludes** (``SortIncludesOptions``) :versionbadge:`clang-format 3.8` :ref:`¶ ` diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 3cbce1be1594376..04bf5cd4e768f34 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -1131,6 +1131,7 @@ clang-format - Add ``BreakAdjacentStringLiterals`` option. - Add ``ObjCPropertyAttributeOrder`` which can be used to sort ObjC property attributes (like ``nonatomic, strong, nullable``). +- Add ``ShortReturnTypeLength`` option. - Add ``.clang-format-ignore`` files. - Add ``AlignFunctionPointers`` sub-option for ``AlignConsecutiveDeclarations``. diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index 5ffd63ee73fc361..f94d68f2cf2a853 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -3928,6 +3928,13 @@ struct FormatStyle { /// \version 13 unsigned ShortNamespaceLines; + /// When AlwaysBreakAfterReturnType is None, line breaks are prevented after + /// short return types. This configures the character limit for a type to be + /// regarded as short. Note that this isn't the length of the type itself, + /// but the column where it finishes. I.e. it includes indentation, etc. + /// \version 18 + unsigned ShortReturnTypeLength; + /// Include sorting options. enum SortIncludesOptions : int8_t { /// Includes are never sorted. @@ -4890,6 +4897,7 @@ struct FormatStyle { RequiresExpressionIndentation == R.RequiresExpressionIndentation && SeparateDefinitionBlocks == R.SeparateDefinitionBlocks && ShortNamespaceLines == R.ShortNamespaceLines && + ShortReturnTypeLength == R.ShortReturnTypeLength && SortIncludes == R.SortIncludes && SortJavaStaticImport == R.SortJavaStaticImport && SpaceAfterCStyleCast == R.SpaceAfterCStyleCast && diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 102504182c4505b..bc0748ec52e6769 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -328,7 +328,8 @@ bool ContinuationIndenter::canBreak(const LineState &State) { // Don't break after very short return types (e.g. "void") as that is often // unexpected. - if (Current.is(TT_FunctionDeclarationName) && State.Column < 6) { + if (Current.is(TT_FunctionDeclarationName) && + State.Column <= Style.ShortReturnTypeLength) { if (Style.AlwaysBreakAfterReturnType == FormatStyle::RTBS_None) return false; } diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index ff5ed6c306f383b..20ffbeef7e9a6e9 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1083,6 +1083,7 @@ template <> struct MappingTraits { Style.RequiresExpressionIndentation); IO.mapOptional("SeparateDefinitionBlocks", Style.SeparateDefinitionBlocks); IO.mapOptional("ShortNamespaceLines", Style.ShortNamespaceLines); +IO.mapOptional("ShortReturnTypeLength", Style.ShortReturnTypeLength); IO.mapOptional("SortIncludes", Style.SortIncludes); IO.mapOptional("SortJavaStaticImport", Style.SortJavaStaticImport); IO.mapOptional("SortUsingDeclarations", Style.SortUsingDeclarations); @@ -1554,6 +1555,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
[Lldb-commits] [flang] [clang] [llvm] [lld] [clang-tools-extra] [lldb] [mlir] [compiler-rt] [libcxx] [clang-format] Add ShortReturnTypeColumn option. (PR #78011)
rmarker wrote: Merged main and fixed conflicts. https://github.com/llvm/llvm-project/pull/78011 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [flang] [clang] [llvm] [clang-tools-extra] [lldb] [lld] [openmp] [compiler-rt] [libc] [mlir] [libcxx] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
Zingam wrote: The FreeBSD CI failure is unrelated and should be fixed upstream. Merging. https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [flang] [clang] [llvm] [clang-tools-extra] [lldb] [lld] [openmp] [compiler-rt] [libc] [mlir] [libcxx] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)
https://github.com/Zingam closed https://github.com/llvm/llvm-project/pull/76447 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [libcxx] [mlir] [lldb] [flang] [clang] [llvm] [clang-tools-extra] [compiler-rt] [clang-format] Add ShortReturnTypeColumn option. (PR #78011)
rmarker wrote: @mydeveloperday, do you have an opinion on this pull request? It addresses #78010 with minimal changes, or are you interested in exploring other possibilities? https://github.com/llvm/llvm-project/pull/78011 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits