[all-commits] [llvm/llvm-project] 6876f4: [clang] implement printing of canonical expressions

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Sat Apr 12 16:55:26 PDT 2025


  Branch: refs/heads/users/mizvekov/print-canonical-expr
  Home:   https://github.com/llvm/llvm-project
  Commit: 6876f4a602b44d587eb62163acd3e769b212b40b
      https://github.com/llvm/llvm-project/commit/6876f4a602b44d587eb62163acd3e769b212b40b
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2025-04-12 (Sat, 12 Apr 2025)

  Changed paths:
    M clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
    M clang-tools-extra/clang-tidy/utils/Matchers.cpp
    M clang/include/clang/AST/PrettyPrinter.h
    M clang/lib/AST/DeclPrinter.cpp
    M clang/lib/AST/JSONNodeDumper.cpp
    M clang/lib/AST/StmtPrinter.cpp
    M clang/lib/AST/TemplateBase.cpp
    M clang/lib/AST/TemplateName.cpp
    M clang/lib/AST/TextNodeDumper.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/test/AST/ast-dump-templates.cpp
    M clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
    M clang/unittests/AST/TypePrinterTest.cpp

  Log Message:
  -----------
  [clang] implement printing of canonical expressions

This patch extends the canonicalization printing policy to cover expressions
and template names, and wires that up to the template argument printer,
covering expressions, and to the expression within a dependent decltype.

This is helpful for debugging, or if these expressions somehow end up
in diagnostics, as without this patch they can print as completely unrelated
expressions, which can be quite confusing.

This is because expressions are not uniqued, unlike types, and
when a template specialization containing an expression is the first to be
canonicalized, the expression ends up appearing in the canonical type of
subsequent equivalent specializations.

Fixes https://github.com/llvm/llvm-project/issues/92292



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