mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 19:49:36 +00:00
Suppress unused warning on static inline function template specializations.
Patch by Halfdan Ingvarsson! llvm-svn: 179598
This commit is contained in:
parent
f6edda8c30
commit
3c4a251ce8
@ -1219,7 +1219,10 @@ bool Sema::ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const {
|
||||
return false;
|
||||
} else {
|
||||
// 'static inline' functions are used in headers; don't warn.
|
||||
if (FD->getStorageClass() == SC_Static &&
|
||||
// Make sure we get the storage class from the canonical declaration,
|
||||
// since otherwise we will get spurious warnings on specialized
|
||||
// static template functions.
|
||||
if (FD->getCanonicalDecl()->getStorageClass() == SC_Static &&
|
||||
FD->isInlineSpecified())
|
||||
return false;
|
||||
}
|
||||
|
@ -133,6 +133,27 @@ namespace test6 {
|
||||
};
|
||||
}
|
||||
|
||||
namespace test7
|
||||
{
|
||||
template<typename T>
|
||||
static inline void foo(T) { }
|
||||
|
||||
// This should not emit an unused-function warning since it inherits
|
||||
// the static storage type from the base template.
|
||||
template<>
|
||||
inline void foo(int) { }
|
||||
|
||||
// Partial specialization
|
||||
template<typename T, typename U>
|
||||
static inline void bar(T, U) { }
|
||||
|
||||
template<typename U>
|
||||
inline void bar(int, U) { }
|
||||
|
||||
template<>
|
||||
inline void bar(int, int) { }
|
||||
};
|
||||
|
||||
namespace pr14776 {
|
||||
namespace {
|
||||
struct X {};
|
||||
|
Loading…
Reference in New Issue
Block a user