Enable warning for non-virtual destructors
Virtual functions are removed from TSymbol, so the warning for
non-virtual destructor found in a class with virtual functions can be
enabled.
BUG=angleproject:2417
TEST=angle_unittests
Change-Id: Icd0ea2c77ce826739fbe954137f8ee78e6ef5386
Reviewed-on: https://chromium-review.googlesource.com/1051830
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/Symbol.cpp b/src/compiler/translator/Symbol.cpp
index cb3331c..9b60d10 100644
--- a/src/compiler/translator/Symbol.cpp
+++ b/src/compiler/translator/Symbol.cpp
@@ -33,11 +33,13 @@
TSymbol::TSymbol(TSymbolTable *symbolTable,
const ImmutableString &name,
SymbolType symbolType,
+ SymbolClass symbolClass,
TExtension extension)
: mName(name),
mUniqueId(symbolTable->nextUniqueId()),
mSymbolType(symbolType),
- mExtension(extension)
+ mExtension(extension),
+ mSymbolClass(symbolClass)
{
ASSERT(mSymbolType == SymbolType::BuiltIn || mExtension == TExtension::UNDEFINED);
ASSERT(mName != "" || mSymbolType == SymbolType::AngleInternal ||
@@ -62,6 +64,12 @@
ImmutableString TSymbol::getMangledName() const
{
+ if (mSymbolClass == SymbolClass::Function)
+ {
+ // We do this instead of using proper virtual functions so that we can better support
+ // constexpr symbols.
+ return static_cast<const TFunction *>(this)->getFunctionMangledName();
+ }
ASSERT(mSymbolType != SymbolType::Empty);
return name();
}
@@ -71,7 +79,9 @@
const TType *type,
SymbolType symbolType,
TExtension extension)
- : TSymbol(symbolTable, name, symbolType, extension), mType(type), unionArray(nullptr)
+ : TSymbol(symbolTable, name, symbolType, SymbolClass::Variable, extension),
+ mType(type),
+ unionArray(nullptr)
{
ASSERT(mType);
}
@@ -80,7 +90,7 @@
const ImmutableString &name,
const TFieldList *fields,
SymbolType symbolType)
- : TSymbol(symbolTable, name, symbolType), TFieldListCollection(fields)
+ : TSymbol(symbolTable, name, symbolType, SymbolClass::Struct), TFieldListCollection(fields)
{
}
@@ -88,7 +98,8 @@
const ImmutableString &name,
TExtension extension,
const TFieldList *fields)
- : TSymbol(id, name, SymbolType::BuiltIn, extension), TFieldListCollection(fields)
+ : TSymbol(id, name, SymbolType::BuiltIn, extension, SymbolClass::Struct),
+ TFieldListCollection(fields)
{
}
@@ -126,7 +137,7 @@
const TLayoutQualifier &layoutQualifier,
SymbolType symbolType,
TExtension extension)
- : TSymbol(symbolTable, name, symbolType, extension),
+ : TSymbol(symbolTable, name, symbolType, SymbolClass::InterfaceBlock, extension),
TFieldListCollection(fields),
mBlockStorage(layoutQualifier.blockStorage),
mBinding(layoutQualifier.binding)
@@ -138,7 +149,7 @@
const ImmutableString &name,
TExtension extension,
const TFieldList *fields)
- : TSymbol(id, name, SymbolType::BuiltIn, extension),
+ : TSymbol(id, name, SymbolType::BuiltIn, extension, SymbolClass::InterfaceBlock),
TFieldListCollection(fields),
mBlockStorage(EbsUnspecified),
mBinding(0)
@@ -150,7 +161,7 @@
SymbolType symbolType,
const TType *retType,
bool knownToNotHaveSideEffects)
- : TSymbol(symbolTable, name, symbolType, TExtension::UNDEFINED),
+ : TSymbol(symbolTable, name, symbolType, SymbolClass::Function, TExtension::UNDEFINED),
mParametersVector(new TParamVector()),
mParameters(nullptr),
mParamCount(0u),