[all-commits] [llvm/llvm-project] b7c922: GH58368: Correct concept checking in a lambda defi...

Erich Keane via All-commits all-commits at lists.llvm.org
Mon Oct 24 06:32:42 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b7c922607c5ba93db8b893d4ba461052af8317b5
      https://github.com/llvm/llvm-project/commit/b7c922607c5ba93db8b893d4ba461052af8317b5
  Author: Erich Keane <erich.keane at intel.com>
  Date:   2022-10-24 (Mon, 24 Oct 2022)

  Changed paths:
    M clang/include/clang/AST/ASTNodeTraverser.h
    M clang/include/clang/AST/DeclTemplate.h
    M clang/include/clang/AST/ExprConcepts.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/Basic/DeclNodes.td
    M clang/include/clang/Serialization/ASTBitCodes.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/DeclBase.cpp
    M clang/lib/AST/DeclTemplate.cpp
    M clang/lib/AST/ExprConcepts.cpp
    M clang/lib/CodeGen/CGDecl.cpp
    M clang/lib/Sema/SemaConcept.cpp
    M clang/lib/Sema/SemaLambda.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/SemaTemplateInstantiate.cpp
    M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Serialization/ASTCommon.cpp
    M clang/lib/Serialization/ASTReaderDecl.cpp
    M clang/lib/Serialization/ASTReaderStmt.cpp
    M clang/lib/Serialization/ASTWriterDecl.cpp
    M clang/lib/Serialization/ASTWriterStmt.cpp
    M clang/test/AST/ast-dump-concepts.cpp
    M clang/test/SemaTemplate/concepts-lambda.cpp
    M clang/tools/libclang/CIndex.cpp

  Log Message:
  -----------
  GH58368: Correct concept checking in a lambda defined in concept

As that bug reports, the problem here is that the lambda's
'context-decl' was not set to the concept, and the lambda picked up
template arguments from the concept.  SO, we failed to get the correct
template arguments in SemaTemplateInstantiate.

However, a Concept Specialization is NOT a decl, its an expression, so
we weren't able to put the concept in the decl tree like we needed.
This patch introduces a ConceptSpecializationDecl, which is the smallest
type possible to use for this purpose, containing only the template
arguments.

The net memory impliciation of this is turning a
trailing-objects into a pointer to a type with trailing-objects,  so it
should be minor.

As future work, we may consider giving this type more responsibility, or
figuring out how to better merge duplicates, but as this is just a
template-argument collection at the moment, there isn't much value to
it.

Differential Revision: https://reviews.llvm.org/D136451




More information about the All-commits mailing list