[all-commits] [llvm/llvm-project] d05781: [clang] fix diagnostic printing of expressions ign...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Mon Apr 7 19:19:54 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d057811655d8de3900748bba03d0c7ebcb6fafe3
      https://github.com/llvm/llvm-project/commit/d057811655d8de3900748bba03d0c7ebcb6fafe3
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2025-04-07 (Mon, 07 Apr 2025)

  Changed paths:
    M clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/Expr.h
    M clang/include/clang/AST/TemplateBase.h
    M clang/include/clang/Basic/Diagnostic.h
    M clang/lib/AST/ASTDiagnostic.cpp
    M clang/lib/AST/TemplateBase.cpp
    M clang/lib/Basic/Diagnostic.cpp
    M clang/lib/Sema/SemaTemplateDeduction.cpp
    M clang/lib/Sema/SemaTemplateVariadic.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl
    M clang/test/SemaTemplate/instantiate-expanded-type-constraint.cpp
    M clang/test/SemaTemplate/instantiate-requires-expr.cpp
    M clang/test/SemaTemplate/trailing-return-short-circuit.cpp
    M libcxx/test/libcxx/algorithms/cpp17_iterator_concepts.verify.cpp

  Log Message:
  -----------
  [clang] fix diagnostic printing of expressions ignoring LangOpts (#134693)

Currently when printing a template argument of expression type, the
expression is converted immediately into a string to be sent to the
diagnostic engine, unsing a fake LangOpts.

This makes the expression printing look incorrect for the current
language, besides being inneficient, as we don't actually need to print
the expression if the diagnostic would be ignored.

This fixes a nastiness with the TemplateArgument constructor for
expressions being implicit, and all current users just passing an
expression to a diagnostic were implicitly going through the template
argument path.

The expressions are also being printed unquoted. This will be fixed in a
subsequent patch, as the test churn is much larger.



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