[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-05-27 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment. In https://reviews.llvm.org/D29877#766301, @rsmith wrote: > In https://reviews.llvm.org/D29877#766196, @EricWF wrote: > > > No. But I can point you to `range-v3` which uses this pattern and I think > > the idiom is somewhat appealing, but that's orthogonal to Clang

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-05-27 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added inline comments. Comment at: include/clang/Basic/DiagnosticGroups.td:631 // UnusedParameter, (matches GCC's behavior) +// UnusedTemplate, (clean-up libc++ before enabling) //

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-05-26 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments. Comment at: include/clang/Basic/DiagnosticGroups.td:631 // UnusedParameter, (matches GCC's behavior) +// UnusedTemplate, (clean-up libc++ before enabling) //

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-05-26 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment. In https://reviews.llvm.org/D29877#766196, @EricWF wrote: > No. But I can point you to `range-v3` which uses this pattern and I think the > idiom is somewhat appealing, but that's orthogonal to Clang diagnosing it. I found this:

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-05-26 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment. In https://reviews.llvm.org/D29877#766196, @EricWF wrote: > In https://reviews.llvm.org/D29877#766176, @rsmith wrote: > > > In https://reviews.llvm.org/D29877#765968, @EricWF wrote: > > > > > I think this patch still gets the following case wrong: > > > > > > // foo.h >

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-05-26 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment. In https://reviews.llvm.org/D29877#766176, @rsmith wrote: > In https://reviews.llvm.org/D29877#765968, @EricWF wrote: > > > I think this patch still gets the following case wrong: > > > > // foo.h > > constexpr struct { > > template void operator()(T) {} // emits

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-05-26 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment. In https://reviews.llvm.org/D29877#765968, @EricWF wrote: > I think this patch still gets the following case wrong: > > // foo.h > constexpr struct { > template void operator()(T) {} // emits unused template warning > } foo; > What specifically do you think

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-05-26 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment. I think this patch still gets the following case wrong: // foo.h constexpr struct { template void operator()(T) {} // emits unused template warning } foo; https://reviews.llvm.org/D29877 ___ cfe-commits mailing

Re: [PATCH] D29877: Warn about unused static file scope function template declarations.

2017-05-09 Thread Vassil Vassilev via cfe-commits
On 11/04/17 22:25, Richard Smith wrote: On 11 April 2017 at 08:35, Marshall Clow via Phabricator via cfe-commits > wrote: mclow.lists added a comment. Complete reproducer: // Tested with with: clang++ -std=c++14

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-05-09 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev closed this revision. v.g.vassilev added a comment. Relanded in r302518. https://reviews.llvm.org/D29877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-28 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment. @rsmith, @mclow.lists, @arphaman, I am planning to reland that soon. Let me know if you have any objections. https://reviews.llvm.org/D29877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-28 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 97098. v.g.vassilev added a comment. This revision is now accepted and ready to land. Implement a special diagnostic switch for the warning. https://reviews.llvm.org/D29877 Files: include/clang/Basic/DiagnosticGroups.td

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-12 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev planned changes to this revision. v.g.vassilev added a comment. We agreed to implement a special switch for this, eg. `-Wunused-template` https://reviews.llvm.org/D29877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

Re: [PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Richard Smith via cfe-commits
On 11 April 2017 at 08:35, Marshall Clow via Phabricator via cfe-commits < cfe-commits@lists.llvm.org> wrote: > mclow.lists added a comment. > > Complete reproducer: > > // Tested with with: clang++ -std=c++14 -Wunused-function > UnusedFVassily.cpp > // > // UnusedFVassily.cpp:8:39: warning:

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment. Reverted in r299956, due to failures like: template static int __test(...); template auto v = __test<_Tp>(0); https://reviews.llvm.org/D29877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment. Complete reproducer: // Tested with with: clang++ -std=c++14 -Wunused-function UnusedFVassily.cpp // // UnusedFVassily.cpp:8:39: warning: unused function '__test' [-Wunused-function] // template static __two __test(...); //

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment. @mclow.lists, hm... it seems that I cannot reproduce it. It'd really help if you could paste a standalone reproducer. https://reviews.llvm.org/D29877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment. @chapuni, the LLVM warnings should be fixed in r299947. @mclow.lists, sorry for not giving heads up :( I am working on the false positive that you reported. https://reviews.llvm.org/D29877 ___ cfe-commits mailing

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment. The following idiom for detecting member typedefs now throws an warning: struct __two {char __lx; char __lxx;}; namespace __has_pointer_type_imp { template __two __test(...); template char __test(typename _Up::pointer* = 0); } template

Re: [PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Marshall Clow via cfe-commits
On Tue, Apr 11, 2017 at 6:59 AM, Alex Lorenz via Phabricator via cfe-commits wrote: > arphaman added a comment. > > Ah, I see. I guess if `static` is removed the warning will go away. Thanks! > > https://reviews.llvm.org/D29877 > > I would have appreciated a heads-up

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment. Ah, I see. I guess if `static` is removed the warning will go away. Thanks! https://reviews.llvm.org/D29877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment. @arphaman, it seems they are marked as static and this seemed like a bug to @rsmith. https://reviews.llvm.org/D29877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment. The operators in PointerUnion seem useful. I don't think they should be removed even if they're not used in tree, since they might be used by some out-of-tree code. https://reviews.llvm.org/D29877 ___ cfe-commits mailing

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread NAKAMURA Takumi via Phabricator via cfe-commits
chapuni added a comment. I think yes, you may do. Warnings fix may be trivial as far as they are NFC. It'd be fine that clang tree should be free from warnings with just-built clang. https://reviews.llvm.org/D29877 ___ cfe-commits mailing list

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment. Thanks for pinging us. Yeah, I knew them but I was hesitant whether I should fix them or they should be fixed by the code owners. Shall I commit the fixes? https://reviews.llvm.org/D29877 ___ cfe-commits mailing list

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread NAKAMURA Takumi via Phabricator via cfe-commits
chapuni added a comment. This brought warnings in llvm tree. Could you take a look, please? http://bb.pgr.jp/builders/clang-3stage-x86_64-linux/builds/14936 (w/o asserts) llvm/include/llvm/ADT/PointerUnion.h:193:13: warning: unused function 'operator==' [-Wunused-function]

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-11 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev closed this revision. v.g.vassilev marked 5 inline comments as done. v.g.vassilev added a comment. Landed in r299930. https://reviews.llvm.org/D29877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-10 Thread Richard Smith via Phabricator via cfe-commits
rsmith accepted this revision. rsmith added a comment. This revision is now accepted and ready to land. LGTM with the overloaded operator check removed. https://reviews.llvm.org/D29877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-10 Thread Richard Smith via Phabricator via cfe-commits
rsmith added inline comments. Comment at: lib/Sema/Sema.cpp:473 if (const FunctionDecl *FD = dyn_cast(D)) { +// If this is a function template and neither of its specs is used, warn. +if (FunctionTemplateDecl *Template = FD->getDescribedFunctionTemplate())

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-06 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 94352. v.g.vassilev marked an inline comment as done. v.g.vassilev added a comment. Improve comment. https://reviews.llvm.org/D29877 Files: lib/Sema/Sema.cpp lib/Sema/SemaDecl.cpp test/SemaCXX/warn-unused-filescoped.cpp Index:

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-06 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 94350. v.g.vassilev added a comment. Found out which is the right place to avoid the linkage computation issues. https://reviews.llvm.org/D29877 Files: lib/Sema/Sema.cpp lib/Sema/SemaDecl.cpp test/SemaCXX/warn-unused-filescoped.cpp Index:

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-05 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added inline comments. Comment at: lib/Sema/SemaDecl.cpp:1496 return false; + // 'static operator' functions are defined in headers; don't warn. + if (FD->isOverloadedOperator() && rsmith wrote: > Why? Defining a static operator

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-05 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 94294. v.g.vassilev added a comment. Attach the right diff. https://reviews.llvm.org/D29877 Files: lib/Sema/Sema.cpp lib/Sema/SemaDecl.cpp test/SemaCXX/warn-unused-filescoped.cpp Index: test/SemaCXX/warn-unused-filescoped.cpp

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-04-05 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 94293. v.g.vassilev marked 2 inline comments as done. v.g.vassilev added a comment. Iterate over the specs. Diagnose unused variable templates. https://reviews.llvm.org/D29877 Files: include/clang/Sema/Sema.h lib/Sema/Sema.cpp

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-03-13 Thread Richard Smith via Phabricator via cfe-commits
rsmith added inline comments. Comment at: lib/Sema/Sema.cpp:472-477 +// If this is a function template, we should remove if it has no +// specializations. +if (FunctionTemplateDecl *Template = FD->getDescribedFunctionTemplate()) { + if

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-03-13 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment. @rsmith ping... https://reviews.llvm.org/D29877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-03-02 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 90360. v.g.vassilev added a comment. Rebase + ping. https://reviews.llvm.org/D29877 Files: lib/Sema/Sema.cpp lib/Sema/SemaDecl.cpp test/SemaCXX/warn-unused-filescoped.cpp Index: test/SemaCXX/warn-unused-filescoped.cpp

[PATCH] D29877: Warn about unused static file scope function template declarations.

2017-02-12 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev created this revision. Repository: rL LLVM https://reviews.llvm.org/D29877 Files: lib/Sema/Sema.cpp lib/Sema/SemaDecl.cpp lib/Serialization/ASTReader.cpp test/SemaCXX/warn-unused-filescoped.cpp Index: test/SemaCXX/warn-unused-filescoped.cpp