[all-commits] [llvm/llvm-project] 44a42e: [clang-tidy] Fix false positive in misc-redundant-...

Peiqi Li via All-commits all-commits at lists.llvm.org
Mon Jul 13 21:53:27 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 44a42e631e5b4e01855750c371dea87fb3927550
      https://github.com/llvm/llvm-project/commit/44a42e631e5b4e01855750c371dea87fb3927550
  Author: Peiqi Li <voyager.lpq at gmail.com>
  Date:   2026-07-14 (Tue, 14 Jul 2026)

  Changed paths:
    M clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/test/clang-tidy/checkers/misc/redundant-expression.cpp

  Log Message:
  -----------
  [clang-tidy] Fix false positive in misc-redundant-expression with type aliases (#198085)

The `misc-redundant-expression` check previously flagged expressions as
redundant if their underlying `DeclRefExpr` pointed to the same
declaration. This caused false positives when comparing identical values
accessed through distinct type aliases.

Following Clang's diagnostic `aka` logic, this patch uses the AST
Printer to stringify and compare the `NestedNameSpecifier` and
`TemplateArguments`. This safely preserves sugared types while natively
normalizing all whitespaces and newlines, ensuring robustness against
multiline formatting changes.

Fixes #145415



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