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

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Mon Apr 7 10:02:34 PDT 2025


  Branch: refs/heads/users/mizvekov/diag-expr
  Home:   https://github.com/llvm/llvm-project
  Commit: ab5d8412f50073535eab90d1f66b6d79804c5a15
      https://github.com/llvm/llvm-project/commit/ab5d8412f50073535eab90d1f66b6d79804c5a15
  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

  Log Message:
  -----------
  [clang] fix diagnostic printing of expressions ignoring LangOpts

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