forked from OSchip/llvm-project
PR18733: Remove -Wweak-template-vtables
It isn't really pulling its weight and I think splitting it out from -Wweak-vtables was the wrong call: I think it was just a bug in the original warning, which was trying to not diagnose template instantiations, implicit or explicit.
This commit is contained in:
parent
516884f58b
commit
8c13680524
|
@ -1643,10 +1643,6 @@ def warn_weak_vtable : Warning<
|
|||
"%0 has no out-of-line virtual method definitions; its vtable will be "
|
||||
"emitted in every translation unit">,
|
||||
InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
|
||||
def warn_weak_template_vtable : Warning<
|
||||
"explicit template instantiation %0 will emit a vtable in every "
|
||||
"translation unit">,
|
||||
InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
|
||||
|
||||
def ext_using_undefined_std : ExtWarn<
|
||||
"using directive refers to implicitly-defined namespace 'std'">;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "clang/AST/TypeOrdering.h"
|
||||
#include "clang/Basic/AttributeCommonInfo.h"
|
||||
#include "clang/Basic/PartialDiagnostic.h"
|
||||
#include "clang/Basic/Specifiers.h"
|
||||
#include "clang/Basic/TargetInfo.h"
|
||||
#include "clang/Lex/LiteralSupport.h"
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
|
@ -17647,16 +17648,12 @@ bool Sema::DefineUsedVTables() {
|
|||
// no key function or the key function is inlined. Don't warn in C++ ABIs
|
||||
// that lack key functions, since the user won't be able to make one.
|
||||
if (Context.getTargetInfo().getCXXABI().hasKeyFunctions() &&
|
||||
Class->isExternallyVisible() && ClassTSK != TSK_ImplicitInstantiation) {
|
||||
Class->isExternallyVisible() && ClassTSK != TSK_ImplicitInstantiation &&
|
||||
ClassTSK != TSK_ExplicitInstantiationDefinition) {
|
||||
const FunctionDecl *KeyFunctionDef = nullptr;
|
||||
if (!KeyFunction || (KeyFunction->hasBody(KeyFunctionDef) &&
|
||||
KeyFunctionDef->isInlined())) {
|
||||
Diag(Class->getLocation(),
|
||||
ClassTSK == TSK_ExplicitInstantiationDefinition
|
||||
? diag::warn_weak_template_vtable
|
||||
: diag::warn_weak_vtable)
|
||||
<< Class;
|
||||
}
|
||||
KeyFunctionDef->isInlined()))
|
||||
Diag(Class->getLocation(), diag::warn_weak_vtable) << Class;
|
||||
}
|
||||
}
|
||||
VTableUses.clear();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// RUN: %clang_cc1 %s -fsyntax-only -verify -triple %itanium_abi_triple -Wweak-vtables -Wweak-template-vtables
|
||||
// RUN: %clang_cc1 %s -fsyntax-only -verify -triple %itanium_abi_triple -Wweak-vtables
|
||||
//
|
||||
// Check that this warning is disabled on MS ABI targets which don't have key
|
||||
// functions.
|
||||
// RUN: %clang_cc1 %s -fsyntax-only -triple %ms_abi_triple -Werror -Wweak-vtables -Wweak-template-vtables
|
||||
// RUN: %clang_cc1 %s -fsyntax-only -triple %ms_abi_triple -Werror -Wweak-vtables
|
||||
|
||||
struct A { // expected-warning {{'A' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit}}
|
||||
virtual void f() { }
|
||||
|
@ -63,7 +63,7 @@ template<typename T> struct TemplVirt {
|
|||
virtual void f();
|
||||
};
|
||||
|
||||
template class TemplVirt<float>; // expected-warning{{explicit template instantiation 'TemplVirt<float>' will emit a vtable in every translation unit}}
|
||||
template class TemplVirt<float>;
|
||||
|
||||
template<> struct TemplVirt<bool> {
|
||||
virtual void f();
|
||||
|
|
Loading…
Reference in New Issue