[PATCH] D152707: [clang][Sema] Provide source range to several Wunused warnings

Takuya Shimizu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 12 06:12:34 PDT 2023


hazohelet created this revision.
hazohelet added reviewers: aaron.ballman, cjdb, tbaeder.
Herald added a project: All.
hazohelet requested review of this revision.
Herald added a project: clang.

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>`


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152707

Files:
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Misc/diag-unused-source-ranges.cpp
  clang/test/Misc/diag-unused-source-ranges.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152707.530481.patch
Type: text/x-patch
Size: 9112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230612/3ae1201c/attachment-0001.bin>


More information about the cfe-commits mailing list