[all-commits] [llvm/llvm-project] 640831: [clang][Sema] Provide source range to several Wunu...

Takuya Shimizu via All-commits all-commits at lists.llvm.org
Fri Jun 16 03:31:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 64083172eea26e50c8b22b85697a825be8bda424
      https://github.com/llvm/llvm-project/commit/64083172eea26e50c8b22b85697a825be8bda424
  Author: Takuya Shimizu <shimizu2486 at gmail.com>
  Date:   2023-06-16 (Fri, 16 Jun 2023)

  Changed paths:
    M clang/lib/Sema/Sema.cpp
    M clang/lib/Sema/SemaDecl.cpp
    A clang/test/Misc/Inputs/diag-unused-source-ranges.h
    A clang/test/Misc/diag-unused-source-ranges.cpp

  Log Message:
  -----------
  [clang][Sema] Provide source range to several Wunused warnings

When the diagnosed function/variable is a template specialization, the source range covers the specialization arguments.
e.g.
```
warning: unused function 'func<int>' [-Wunused-function]
template <> int func<int> () {}
                ^~~~~~~~~
```
This comes in line with the printed text in the warning message. In the above case, `func<int>`

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D152707




More information about the All-commits mailing list