[all-commits] [llvm/llvm-project] 9aad38: [clang-tidy] fix false-positives for templates in ...

Julian Schmidt via All-commits all-commits at lists.llvm.org
Sun May 5 08:51:55 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9aad38b61586cab8b125c3f522789267f9b749a9
      https://github.com/llvm/llvm-project/commit/9aad38b61586cab8b125c3f522789267f9b749a9
  Author: Julian Schmidt <git.julian.schmidt at gmail.com>
  Date:   2024-05-05 (Sun, 05 May 2024)

  Changed paths:
    M clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
    M clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp

  Log Message:
  -----------
  [clang-tidy] fix false-positives for templates in `bugprone-return-const-ref-from-parameter` (#90273)

In the AST for function templates, the return will be a DeclRefExpr,
even if the return type differs from that of the returned variable.
Protect against false-positives by constraining the canonical return
type to be that of the parameter.
Also streams the source range of the returned expression into the
diagnostic.



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