[Lldb-commits] [clang] [clang-tools-extra] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-02-13 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -5401,6 +5409,8 @@ std::string CGDebugInfo::GetName(const Decl *D, bool 
Qualified) const {
 // feasible some day.
 return TA.getAsIntegral().getBitWidth() <= 64 &&
IsReconstitutableType(TA.getIntegralType());
+  case TemplateArgument::StructuralValue:
+return false;

bolshakov-a wrote:

Thanks for clarifying! Probably, I'll come back to this some day to extend the 
backend, but I'm not sure.

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] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-30 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

#80050 opened. Nevertheless, a reproducer for future work would be appreciated.

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)

2024-01-30 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

@eaeltsin, could you try out [that 
branch](https://github.com/bolshakov-a/llvm-project/tree/avoid_regressions)?

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] [lldb] [clang-tools-extra] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-29 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

@zmodem, thanks! Added the fix to #79764.

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] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-26 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -8129,29 +8067,133 @@ 
Sema::BuildExpressionFromIntegralTemplateArgument(const TemplateArgument ,
 else
   Kind = CharacterLiteralKind::Ascii;
 
-E = new (Context) CharacterLiteral(Arg.getAsIntegral().getZExtValue(),
-   Kind, T, Loc);
+E = new (S.Context) CharacterLiteral(Int.getZExtValue(), Kind, T, Loc);
   } else if (T->isBooleanType()) {
-E = CXXBoolLiteralExpr::Create(Context, Arg.getAsIntegral().getBoolValue(),
-   T, Loc);
-  } else if (T->isNullPtrType()) {
-E = new (Context) CXXNullPtrLiteralExpr(Context.NullPtrTy, Loc);
+E = CXXBoolLiteralExpr::Create(S.Context, Int.getBoolValue(), T, Loc);
   } else {
-E = IntegerLiteral::Create(Context, Arg.getAsIntegral(), T, Loc);
+E = IntegerLiteral::Create(S.Context, Int, T, Loc);
   }
 
   if (OrigT->isEnumeralType()) {
 // FIXME: This is a hack. We need a better way to handle substituted
 // non-type template parameters.
-E = CStyleCastExpr::Create(Context, OrigT, VK_PRValue, CK_IntegralCast, E,
-   nullptr, CurFPFeatureOverrides(),
-   Context.getTrivialTypeSourceInfo(OrigT, Loc),
+E = CStyleCastExpr::Create(S.Context, OrigT, VK_PRValue, CK_IntegralCast, 
E,
+   nullptr, S.CurFPFeatureOverrides(),
+   S.Context.getTrivialTypeSourceInfo(OrigT, Loc),
Loc, Loc);
   }
 
   return E;
 }
 
+static Expr *BuildExpressionFromNonTypeTemplateArgumentValue(
+Sema , QualType T, const APValue , SourceLocation Loc) {
+  auto MakeInitList = [&](ArrayRef Elts) -> Expr * {
+auto *ILE = new (S.Context) InitListExpr(S.Context, Loc, Elts, Loc);
+ILE->setType(T);
+return ILE;
+  };
+
+  switch (Val.getKind()) {
+  case APValue::AddrLabelDiff:
+// This cannot occur in a template argument at all.
+  case APValue::Array:
+  case APValue::Struct:
+  case APValue::Union:
+// These can only occur within a template parameter object, which is
+// represented as a TemplateArgument::Declaration.
+llvm_unreachable("unexpected template argument value");
+
+  case APValue::Int:
+return BuildExpressionFromIntegralTemplateArgumentValue(S, T, Val.getInt(),
+Loc);
+
+  case APValue::Float:
+return FloatingLiteral::Create(S.Context, Val.getFloat(), /*IsExact=*/true,
+   T, Loc);
+
+  case APValue::FixedPoint:
+return FixedPointLiteral::CreateFromRawInt(
+S.Context, Val.getFixedPoint().getValue(), T, Loc,
+Val.getFixedPoint().getScale());
+
+  case APValue::ComplexInt: {
+QualType ElemT = T->castAs()->getElementType();
+return MakeInitList({BuildExpressionFromIntegralTemplateArgumentValue(
+ S, ElemT, Val.getComplexIntReal(), Loc),
+ BuildExpressionFromIntegralTemplateArgumentValue(
+ S, ElemT, Val.getComplexIntImag(), Loc)});
+  }
+
+  case APValue::ComplexFloat: {
+QualType ElemT = T->castAs()->getElementType();
+return MakeInitList(
+{FloatingLiteral::Create(S.Context, Val.getComplexFloatReal(), true,
+ ElemT, Loc),
+ FloatingLiteral::Create(S.Context, Val.getComplexFloatImag(), true,
+ ElemT, Loc)});
+  }
+
+  case APValue::Vector: {
+QualType ElemT = T->castAs()->getElementType();
+llvm::SmallVector Elts;
+for (unsigned I = 0, N = Val.getVectorLength(); I != N; ++I)
+  Elts.push_back(BuildExpressionFromNonTypeTemplateArgumentValue(
+  S, ElemT, Val.getVectorElt(I), Loc));
+return MakeInitList(Elts);
+  }
+
+  case APValue::None:
+  case APValue::Indeterminate:
+llvm_unreachable("Unexpected APValue kind.");
+  case APValue::LValue:
+  case APValue::MemberPointer:
+// There isn't necessarily a valid equivalent source-level syntax for
+// these; in particular, a naive lowering might violate access control.
+// So for now we lower to a ConstantExpr holding the value, wrapped around
+// an OpaqueValueExpr.
+// FIXME: We should have a better representation for this.
+ExprValueKind VK = VK_PRValue;
+if (T->isReferenceType()) {
+  T = T->getPointeeType();
+  VK = VK_LValue;
+}
+auto *OVE = new (S.Context) OpaqueValueExpr(Loc, T, VK);

bolshakov-a wrote:

Right, I didn't. But the clang codebase is pretty well designed if every class 
can be considered as fully initialized after calling its constructor!

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] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-26 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -8129,29 +8067,133 @@ 
Sema::BuildExpressionFromIntegralTemplateArgument(const TemplateArgument ,
 else
   Kind = CharacterLiteralKind::Ascii;
 
-E = new (Context) CharacterLiteral(Arg.getAsIntegral().getZExtValue(),
-   Kind, T, Loc);
+E = new (S.Context) CharacterLiteral(Int.getZExtValue(), Kind, T, Loc);
   } else if (T->isBooleanType()) {
-E = CXXBoolLiteralExpr::Create(Context, Arg.getAsIntegral().getBoolValue(),
-   T, Loc);
-  } else if (T->isNullPtrType()) {
-E = new (Context) CXXNullPtrLiteralExpr(Context.NullPtrTy, Loc);
+E = CXXBoolLiteralExpr::Create(S.Context, Int.getBoolValue(), T, Loc);
   } else {
-E = IntegerLiteral::Create(Context, Arg.getAsIntegral(), T, Loc);
+E = IntegerLiteral::Create(S.Context, Int, T, Loc);
   }
 
   if (OrigT->isEnumeralType()) {
 // FIXME: This is a hack. We need a better way to handle substituted
 // non-type template parameters.
-E = CStyleCastExpr::Create(Context, OrigT, VK_PRValue, CK_IntegralCast, E,
-   nullptr, CurFPFeatureOverrides(),
-   Context.getTrivialTypeSourceInfo(OrigT, Loc),
+E = CStyleCastExpr::Create(S.Context, OrigT, VK_PRValue, CK_IntegralCast, 
E,
+   nullptr, S.CurFPFeatureOverrides(),
+   S.Context.getTrivialTypeSourceInfo(OrigT, Loc),
Loc, Loc);
   }
 
   return E;
 }
 
+static Expr *BuildExpressionFromNonTypeTemplateArgumentValue(
+Sema , QualType T, const APValue , SourceLocation Loc) {
+  auto MakeInitList = [&](ArrayRef Elts) -> Expr * {
+auto *ILE = new (S.Context) InitListExpr(S.Context, Loc, Elts, Loc);
+ILE->setType(T);
+return ILE;
+  };
+
+  switch (Val.getKind()) {
+  case APValue::AddrLabelDiff:
+// This cannot occur in a template argument at all.
+  case APValue::Array:
+  case APValue::Struct:
+  case APValue::Union:
+// These can only occur within a template parameter object, which is
+// represented as a TemplateArgument::Declaration.
+llvm_unreachable("unexpected template argument value");
+
+  case APValue::Int:
+return BuildExpressionFromIntegralTemplateArgumentValue(S, T, Val.getInt(),
+Loc);
+
+  case APValue::Float:
+return FloatingLiteral::Create(S.Context, Val.getFloat(), /*IsExact=*/true,
+   T, Loc);
+
+  case APValue::FixedPoint:
+return FixedPointLiteral::CreateFromRawInt(
+S.Context, Val.getFixedPoint().getValue(), T, Loc,
+Val.getFixedPoint().getScale());
+
+  case APValue::ComplexInt: {
+QualType ElemT = T->castAs()->getElementType();
+return MakeInitList({BuildExpressionFromIntegralTemplateArgumentValue(
+ S, ElemT, Val.getComplexIntReal(), Loc),
+ BuildExpressionFromIntegralTemplateArgumentValue(
+ S, ElemT, Val.getComplexIntImag(), Loc)});
+  }
+
+  case APValue::ComplexFloat: {
+QualType ElemT = T->castAs()->getElementType();
+return MakeInitList(
+{FloatingLiteral::Create(S.Context, Val.getComplexFloatReal(), true,
+ ElemT, Loc),
+ FloatingLiteral::Create(S.Context, Val.getComplexFloatImag(), true,
+ ElemT, Loc)});
+  }
+
+  case APValue::Vector: {
+QualType ElemT = T->castAs()->getElementType();
+llvm::SmallVector Elts;
+for (unsigned I = 0, N = Val.getVectorLength(); I != N; ++I)
+  Elts.push_back(BuildExpressionFromNonTypeTemplateArgumentValue(
+  S, ElemT, Val.getVectorElt(I), Loc));
+return MakeInitList(Elts);
+  }
+
+  case APValue::None:
+  case APValue::Indeterminate:
+llvm_unreachable("Unexpected APValue kind.");
+  case APValue::LValue:
+  case APValue::MemberPointer:
+// There isn't necessarily a valid equivalent source-level syntax for
+// these; in particular, a naive lowering might violate access control.
+// So for now we lower to a ConstantExpr holding the value, wrapped around
+// an OpaqueValueExpr.
+// FIXME: We should have a better representation for this.
+ExprValueKind VK = VK_PRValue;
+if (T->isReferenceType()) {
+  T = T->getPointeeType();
+  VK = VK_LValue;
+}
+auto *OVE = new (S.Context) OpaqueValueExpr(Loc, T, VK);

bolshakov-a wrote:

I agree. (It _becomes_ wrong after this PR)

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] [lldb] [clang-tools-extra] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-26 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

Prior to this PR, arrays in NTTP were represented as `Declaration`s and now as 
`StructuralValue`s referring to their first element. @steakhal, please note 
[here](https://github.com/llvm/llvm-project/pull/78041/files#diff-2f25fdb80b1a63f2e0a5a7c7a7c061b494b430ee8f5759b48022a86a149030bbR8162)
 how the corresponding `OpaqueValueExpr` is constructed. The is no 
subexpression inside it. Maybe, it will help. I'll probably have a chance to 
look into it deeper after several hours or tomorrow.

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)

2024-01-24 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

The tests are passed.
Maybe, someone else could write a test and commit? I'm slightly busy.

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] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-24 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

@erichkeane, @cor3ntin, argument types 
[here](https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaTemplateDeduction.cpp#L3022)
 occurs to be different with sugar added to one of them. This patch fixes the 
problem:
```
--- a/clang/lib/AST/TemplateBase.cpp
+++ b/clang/lib/AST/TemplateBase.cpp
@@ -450,7 +450,7 @@ bool TemplateArgument::structurallyEquals(const 
TemplateArgument ) const {
getAsIntegral() == Other.getAsIntegral();
 
   case StructuralValue: {
-if (getStructuralValueType() != Other.getStructuralValueType())
+if (getStructuralValueType().getCanonicalType() != 
Other.getStructuralValueType().getCanonicalType())
   return false;
 
 llvm::FoldingSetNodeID A, B;
```
Not sure if it is correct. Running tests...

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] [lldb] [clang-tools-extra] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-24 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

I suspect the reason is in the array-to-pointer conversion in `StructuralValue` 
argument. Maybe this will help someone to invent a fix quickly...

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] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-24 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

Thanks! I'll probably take a look in my spare time. Feel free to revert this.

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] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-21 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

Thank you all, especially to @zygoloid for allowing me to steal its thunder!

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] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-21 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

> Do you need me to merge that for you?

Yes, please. I don't have commit access.

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] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-21 Thread Andrey Ali Khan Bolshakov via lldb-commits

https://github.com/bolshakov-a updated 
https://github.com/llvm/llvm-project/pull/78041

>From 6cc472d5a1214e847b7f3a5dce28d6bed86121ed Mon Sep 17 00:00:00 2001
From: Bolshakov 
Date: Sun, 21 Jan 2024 16:19:51 +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   |   3 +
 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  |   3 +
 

[Lldb-commits] [clang] [clang-tools-extra] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-21 Thread Andrey Ali Khan Bolshakov via lldb-commits

https://github.com/bolshakov-a updated 
https://github.com/llvm/llvm-project/pull/78041

>From e2fa0ec1fbb77a521b92f2a17f45879ca01cd304 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   |   3 +
 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)

2024-01-20 Thread Andrey Ali Khan Bolshakov via lldb-commits

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] [clang] [clang-tools-extra] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-20 Thread Andrey Ali Khan Bolshakov via lldb-commits

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-tools-extra] [clang] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-20 Thread Andrey Ali Khan Bolshakov via lldb-commits

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)

2024-01-20 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -6472,7 +6494,20 @@ void CXXNameMangler::mangleValueInTemplateArg(QualType 
T, const APValue ,
   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)

2024-01-20 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -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] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -14,6 +14,11 @@
 
 #include "clang/AST/ODRHash.h"
 
+#include "clang/AST/APValue.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/CharUnits.h"
+#include "clang/AST/Decl.h"
+#include "clang/AST/DeclCXX.h"

bolshakov-a wrote:

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] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -25,10 +25,13 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/DeclObjC.h"
+#include "clang/AST/Expr.h"
 #include "clang/AST/NSAPI.h"
 #include "clang/AST/StmtVisitor.h"
+#include "clang/AST/Type.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/CodeGenOptions.h"
+#include "clang/Basic/LLVM.h"

bolshakov-a wrote:

Ok, 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] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits

https://github.com/bolshakov-a updated 
https://github.com/llvm/llvm-project/pull/78041

>From 459f2c778d42fd5132bf69695537dc5f5a26b160 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   |  39 +++-
 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] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -12,6 +12,7 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/DeclVisitor.h"
+#include "clang/AST/ODRHash.h"

bolshakov-a wrote:

Just to clarify: do you insist that `#include` set added in a PR should be 
minimal for compilability?

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] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

Btw, I have a local branch with a few distinct commits. I could temporarily 
push it to simplify review process, and then squash them before merging.

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] [lldb] [clang-tools-extra] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

> Should we add a couple of PCH tests ?

[clang/test/Modules/odr_hash.cpp](https://github.com/llvm/llvm-project/pull/78041/files#diff-b0662120e3a8a2bf3ccd95b9e8943640816b457c00e662ebfdd648632e383314)
 should cover AST serialization/deserialization. But I could missing something, 
of course. What is your concern?

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] [lldb] [clang-tools-extra] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -628,6 +628,10 @@ static bool 
IsStructurallyEquivalent(StructuralEquivalenceContext ,
 return IsStructurallyEquivalent(Context, Arg1.getAsExpr(),
 Arg2.getAsExpr());
 
+  case TemplateArgument::StructuralValue:
+// FIXME: Do we need to customize the comparison?

bolshakov-a wrote:

I agree that it seems like it should work. Dropped the comment.

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] [lldb] [clang-tools-extra] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits

https://github.com/bolshakov-a updated 
https://github.com/llvm/llvm-project/pull/78041

>From b178deb9479e86d2899466c521ebfb28a08d27cb 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   |  39 +++-
 clang/lib/AST/MicrosoftMangle.cpp |  78 +--
 clang/lib/AST/ODRHash.cpp |  72 ++
 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  |  15 +-
 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] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits

https://github.com/bolshakov-a edited 
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] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -14,6 +14,11 @@
 
 #include "clang/AST/ODRHash.h"
 
+#include "clang/AST/APValue.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/CharUnits.h"
+#include "clang/AST/Decl.h"
+#include "clang/AST/DeclCXX.h"

bolshakov-a wrote:

Types from all of them are used inside `AddStructuralValue` function 
(`ASTContext` and `CharUnits` implicitly, as intermediate return types inside 
`D->getASTContext().getMemberPointerPathAdjustment(Value).getQuantity())` 
expression.

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] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -12,6 +12,7 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/DeclVisitor.h"
+#include "clang/AST/ODRHash.h"

bolshakov-a wrote:

`ODRHash` is used inside the newly added code. Btw, what do you mean by 
"necessary"? I think one should not rely on transitive `#include`s in general. 
(I'm just an active contributor of [the IWYU 
project](https://github.com/include-what-you-use/include-what-you-use/). 
~~Trust me!~~)

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] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -25,10 +25,13 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/DeclObjC.h"
+#include "clang/AST/Expr.h"
 #include "clang/AST/NSAPI.h"
 #include "clang/AST/StmtVisitor.h"
+#include "clang/AST/Type.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/CodeGenOptions.h"
+#include "clang/Basic/LLVM.h"

bolshakov-a wrote:

`FullExpr` is defined in `Expr.h`, `QualType` is in `Type.h`, and `LLVM.h` 
pulls `isa` function into `clang` namespace with `using llvm::isa;`. All of 
this is needed for `getConstantExprReferredType` function.

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] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -80,6 +81,13 @@ class TemplateArgument {
 /// that was provided for an integral non-type template parameter.
 Integral,
 
+/// The template argument is a non-type template argument that can't be
+/// represented by the special-case Declaration, NullPtr, or Integral
+/// forms. These values are only ever produced by constant evaluation,
+/// so cannot be dependent.
+/// TODO: merge Declaration, NullPtr and Integral into this?

bolshakov-a wrote:

Honestly, no. Not in the near future, at least.

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] [lldb] [clang] [Clang] [c++20] P1907R1: Support for generalized non-type template ar… (PR #77428)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

@cor3ntin, #78041.

https://github.com/llvm/llvm-project/pull/77428
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [clang-tools-extra] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -5401,6 +5409,8 @@ std::string CGDebugInfo::GetName(const Decl *D, bool 
Qualified) const {
 // feasible some day.
 return TA.getAsIntegral().getBitWidth() <= 64 &&
IsReconstitutableType(TA.getIntegralType());
+  case TemplateArgument::StructuralValue:
+return false;

bolshakov-a wrote:

@dwblaikie, could you verify please? Maybe, non-type template arguments of 
floating point types are reconstitutable though?

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] [lldb] [clang-tools-extra] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-13 Thread Andrey Ali Khan Bolshakov via lldb-commits


@@ -25,7 +25,7 @@ template  struct S {}; // #dr1801-S
 S V; // #dr1801-S-i
 // cxx98-14-error@-1 {{non-type template argument does not refer to any 
declaration}}
 //   cxx98-14-note@#dr1801-S {{template parameter is declared here}}
-// since-cxx17-error@#dr1801-S-i {{non-type template argument refers to 
subobject '.i'}}
+// cxx17-error@#dr1801-S-i {{non-type template argument refers to subobject 
'.i'}}

bolshakov-a wrote:

I'm not sure about this. 
[Here](https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1801) it 
is stated that this should be ill-formed, with a reference to 
[N4268](https://open-std.org/JTC1/SC22/WG21/docs/papers/2014/n4268.html). But 
it seems that it is not actual after P1907R1.

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] [Clang] [c++20] P1907R1: Support for generalized non-type template ar… (PR #77428)

2024-01-09 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

Seems like I should ping reviewers more actively... Ok, thanks, I'll probably 
proceed at the weekend.

https://github.com/llvm/llvm-project/pull/77428
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [clang] [clang-tools-extra] [Clang] [c++20] P1907R1: Support for generalized non-type template ar… (PR #77428)

2024-01-09 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

Have I understood correctly that I should open my own PR to proceed working on 
this?

https://github.com/llvm/llvm-project/pull/77428
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [clang-tools-extra] [clang] [Clang] [c++20] P1907R1: Support for generalized non-type template ar… (PR #77428)

2024-01-09 Thread Andrey Ali Khan Bolshakov via lldb-commits

bolshakov-a wrote:

@cor3ntin, thank you! Could you please take a look and probably merge #71077? 
This depends on that PR.

https://github.com/llvm/llvm-project/pull/77428
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits