[all-commits] [llvm/llvm-project] 578f38: Reland: [clang] preserve class type sugar when tak...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Thu Mar 20 11:34:15 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 578f38cd08ba71300b013644e5ae8c8a64598800
      https://github.com/llvm/llvm-project/commit/578f38cd08ba71300b013644e5ae8c8a64598800
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2025-03-20 (Thu, 20 Mar 2025)

  Changed paths:
    M clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
    M clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp
    M clang-tools-extra/clangd/unittests/FindTargetTests.cpp
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/ASTContext.h
    M clang/include/clang/AST/ASTNodeTraverser.h
    M clang/include/clang/AST/CanonicalType.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/AST/Type.h
    M clang/include/clang/AST/TypeLoc.h
    M clang/include/clang/AST/TypeProperties.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/ASTImporter.cpp
    M clang/lib/AST/ASTStructuralEquivalence.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/NestedNameSpecifier.cpp
    M clang/lib/AST/ODRHash.cpp
    M clang/lib/AST/QualTypeNames.cpp
    M clang/lib/AST/Type.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/CodeGen/CGCXXABI.cpp
    M clang/lib/CodeGen/CGPointerAuth.cpp
    M clang/lib/CodeGen/CGVTables.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    M clang/lib/CodeGen/MicrosoftCXXABI.cpp
    M clang/lib/Sema/SemaAccess.cpp
    M clang/lib/Sema/SemaCast.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/lib/Sema/SemaOpenMP.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/SemaTemplateDeduction.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/Serialization/TemplateArgumentHasher.cpp
    M clang/test/AST/ast-dump-template-json-win32-mangler-crash.cpp
    M clang/test/AST/ast-dump-templates.cpp
    M clang/test/AST/ast-dump-types-json.cpp
    M clang/test/AST/attr-print-emit.cpp
    M clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
    M clang/test/CXX/class.access/p6.cpp
    M clang/test/CXX/drs/cwg0xx.cpp
    M clang/test/CXX/drs/cwg13xx.cpp
    M clang/test/CXX/drs/cwg26xx.cpp
    M clang/test/CXX/drs/cwg2xx.cpp
    M clang/test/CXX/drs/cwg4xx.cpp
    M clang/test/CXX/drs/cwg7xx.cpp
    M clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
    M clang/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
    M clang/test/Index/print-type.cpp
    M clang/test/SemaCXX/addr-of-overloaded-function.cpp
    M clang/test/SemaCXX/builtin-ptrtomember-ambig.cpp
    M clang/test/SemaCXX/calling-conv-compat.cpp
    M clang/test/SemaCXX/err_init_conversion_failed.cpp
    M clang/test/SemaCXX/member-pointer.cpp
    M clang/test/SemaOpenACC/combined-construct-if-ast.cpp
    M clang/test/SemaOpenACC/combined-construct-num_workers-ast.cpp
    M clang/test/SemaOpenACC/compute-construct-clause-ast.cpp
    M clang/test/SemaOpenACC/compute-construct-intexpr-clause-ast.cpp
    M clang/test/SemaOpenACC/data-construct-if-ast.cpp
    M clang/test/SemaTemplate/instantiate-member-pointers.cpp
    M clang/tools/libclang/CXType.cpp
    M clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
    M lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

  Log Message:
  -----------
  Reland: [clang] preserve class type sugar when taking pointer to member (#132234)

Original PR: #130537
Reland after updating lldb too.

This changes the MemberPointerType representation to use a
NestedNameSpecifier instead of a Type to represent the base class.

Since the qualifiers are always parsed as nested names, there was an
impedance mismatch when converting these back and forth into types, and
this led to issues in preserving sugar.

The nested names are indeed a better match for these, as the differences
which a QualType can represent cannot be expressed syntatically, and
they represent the use case more exactly, being either dependent or
referring to a CXXRecord, unqualified.

This patch also makes the MemberPointerType able to represent sugar for
a {up/downcast}cast conversion of the base class, although for now the
underlying type is canonical, as preserving the sugar up to that point
requires further work.

As usual, includes a few drive-by fixes in order to make use of the
improvements.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list