[PATCH] D92886: [Sema] Warn about unused functions even when they're inline

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 8 14:46:02 PST 2020


aaronpuchert created this revision.
aaronpuchert added reviewers: aaron.ballman, efriedma, rsmith.
aaronpuchert requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Being inline doesn't change anything about a function having internal
linkage, see [basic.link]p3 for 'static' and p4 for unnamed namespaces.
An internal linkage function can only be used in the same translation
unit, so if it's not being used or needed, that's suspicious.

Also don't recommend "static inline" since for all intents and purposes
it has the same effect as just using "static", which should thus be
preferred.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92886

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaCXX/warn-static-function-inheader.cpp
  clang/test/SemaCXX/warn-static-function-inheader.h
  clang/test/SemaCXX/warn-unused-filescoped.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92886.310353.patch
Type: text/x-patch
Size: 5617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201208/1a56da7c/attachment-0001.bin>


More information about the cfe-commits mailing list