[PATCH] D140996: [c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

Andrey Ali Khan Bolshakov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 4 08:33:22 PST 2023


bolshakov-a created this revision.
bolshakov-a added reviewers: aaron.ballman, rsmith, mizvekov.
Herald added subscribers: kadircet, arphaman, martong, kristof.beyls.
Herald added a reviewer: shafik.
Herald added a project: All.
bolshakov-a requested review of this revision.
Herald added projects: clang, LLDB, clang-tools-extra.
Herald added subscribers: cfe-commits, lldb-commits.

Previously committed as 9e08e51a20d0d2b1c5724bb17e969d036fced4cd <https://reviews.llvm.org/rG9e08e51a20d0d2b1c5724bb17e969d036fced4cd>, and
reverted because a dependency commit was reverted, then commited again
as 4b574008aef5a7235c1f894ab065fe300d26e786 <https://reviews.llvm.org/rG4b574008aef5a7235c1f894ab065fe300d26e786> and reverted again because
"dependency commit" 5a391d38ac6c561ba908334d427f26124ed9132e <https://reviews.llvm.org/rG5a391d38ac6c561ba908334d427f26124ed9132e> was
reverted. But it doesn't seem that 5a391d38ac6c <https://reviews.llvm.org/rG5a391d38ac6c561ba908334d427f26124ed9132e> was a real dependency
for this.

This commit incorporates 4b574008aef5a7235c1f894ab065fe300d26e786 <https://reviews.llvm.org/rG4b574008aef5a7235c1f894ab065fe300d26e786> and
18e093faf726d15f210ab4917142beec51848258 <https://reviews.llvm.org/rG18e093faf726d15f210ab4917142beec51848258> by Richard Smith, with some
minor fixes, most notably:

- `VK_PRValue` instead of `VK_RValue` as default kind in lvalue and

member pointer handling branch
in `BuildExpressionFromNonTypeTemplateArgumentValue`;

- handling of `UncommonValue` in `IsTypeDeclaredInsideVisitor`;

- filling in `SugaredConverted` along with `CanonicalConverted`

parameter in `Sema::CheckTemplateArgument`;

- minor cleanup

in `TemplateInstantiator::transformNonTypeTemplateParmRef`;

- `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` test fixed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140996

Files:
  clang-tools-extra/clangd/DumpAST.cpp
  clang-tools-extra/clangd/FindTarget.cpp
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/PropertiesBase.td
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/TemplateArgumentVisitor.h
  clang/include/clang/AST/TemplateBase.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  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/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/temp/temp.arg/temp.arg.nontype/p1.cpp
  clang/test/CodeGenCXX/mangle-ms-templates.cpp
  clang/test/CodeGenCXX/mangle-template.cpp
  clang/test/CodeGenCXX/template-arguments.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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140996.486304.patch
Type: text/x-patch
Size: 67837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230104/057043f5/attachment-0001.bin>


More information about the cfe-commits mailing list