Skip to content

Commit dd61558

Browse files
Static analysis fixes (#2320)
This changelist addresses two static analysis warnings flagged by PVS-Studio: - Favor defaulted destructors over explicit empty destructors for performance. - Add a missing initializer for the _inlined member of SourceCodeNode.
1 parent 60bc85d commit dd61558

16 files changed

Lines changed: 22 additions & 23 deletions

File tree

source/MaterialXCore/Document.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Document::Cache
3232
valid(false)
3333
{
3434
}
35-
~Cache() { }
35+
~Cache() = default;
3636

3737
void refresh()
3838
{

source/MaterialXCore/Element.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ template <class T> class ElementRegistry
933933
{
934934
Element::_creatorMap[T::CATEGORY] = Element::createElement<T>;
935935
}
936-
~ElementRegistry() { }
936+
~ElementRegistry() = default;
937937
};
938938

939939
//

source/MaterialXCore/Element.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ class MX_CORE_API ElementEquivalenceOptions
13661366
floatPrecision = Value::getFloatPrecision();
13671367
attributeExclusionList = {};
13681368
};
1369-
~ElementEquivalenceOptions() { }
1369+
~ElementEquivalenceOptions() = default;
13701370

13711371
/// Perform value comparisons as opposed to literal string comparisons.
13721372
/// Default is true.

source/MaterialXCore/Geom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class MX_CORE_API GeomPath
6464
_empty(true)
6565
{
6666
}
67-
~GeomPath() { }
67+
~GeomPath() = default;
6868

6969
bool operator==(const GeomPath& rhs) const
7070
{

source/MaterialXCore/Traversal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MX_CORE_API Edge
3535
_elemUp(elemUp)
3636
{
3737
}
38-
~Edge() { }
38+
~Edge() = default;
3939

4040
bool operator==(const Edge& rhs) const
4141
{
@@ -94,7 +94,7 @@ class MX_CORE_API TreeIterator
9494
_holdCount(0)
9595
{
9696
}
97-
~TreeIterator() { }
97+
~TreeIterator() = default;
9898

9999
private:
100100
using StackFrame = std::pair<ElementPtr, size_t>;
@@ -198,7 +198,7 @@ class MX_CORE_API GraphIterator
198198
{
199199
_pathElems.insert(elem);
200200
}
201-
~GraphIterator() { }
201+
~GraphIterator() = default;
202202

203203
private:
204204
using ElementSet = std::set<ElementPtr>;
@@ -341,7 +341,7 @@ class MX_CORE_API InheritanceIterator
341341
{
342342
_pathElems.insert(elem);
343343
}
344-
~InheritanceIterator() { }
344+
~InheritanceIterator() = default;
345345

346346
private:
347347
using ConstElementSet = std::set<ConstElementPtr>;

source/MaterialXCore/Value.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ template <class T> class ValueRegistry
421421
Value::_creatorMap[TypedValue<T>::TYPE] = TypedValue<T>::createFromString;
422422
}
423423
}
424-
~ValueRegistry() { }
424+
~ValueRegistry() = default;
425425
};
426426

427427
//

source/MaterialXFormat/File.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class MX_FORMAT_API FilePath
4949
_type(TypeRelative)
5050
{
5151
}
52-
~FilePath() { }
52+
~FilePath() = default;
5353

5454
bool operator==(const FilePath& rhs) const
5555
{

source/MaterialXFormat/XmlIo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MX_FORMAT_API XmlReadOptions
3535
{
3636
public:
3737
XmlReadOptions();
38-
~XmlReadOptions() { }
38+
~XmlReadOptions() = default;
3939

4040
/// If true, then XML comments will be read into documents as comment elements.
4141
/// Defaults to false.
@@ -64,7 +64,7 @@ class MX_FORMAT_API XmlWriteOptions
6464
{
6565
public:
6666
XmlWriteOptions();
67-
~XmlWriteOptions() { }
67+
~XmlWriteOptions() = default;
6868

6969
/// If true, elements with source file markings will be written as
7070
/// XIncludes rather than explicit data. Defaults to true.

source/MaterialXGenShader/Nodes/SourceCodeNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class MX_GENSHADER_API SourceCodeNode : public ShaderNodeImpl
2929
/// Resolve the source file and read the source code during the initialization of the node.
3030
virtual void resolveSourceCode(const InterfaceElement& element, GenContext& context);
3131

32-
bool _inlined;
32+
bool _inlined = false;
3333
string _functionName;
3434
string _functionSource;
3535
FilePath _sourceFilename;

source/MaterialXGenShader/ShaderGraph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class MX_GENSHADER_API ShaderGraphEdgeIterator
235235
{
236236
public:
237237
ShaderGraphEdgeIterator(ShaderOutput* output);
238-
~ShaderGraphEdgeIterator() { }
238+
~ShaderGraphEdgeIterator() = default;
239239

240240
bool operator==(const ShaderGraphEdgeIterator& rhs) const
241241
{

0 commit comments

Comments
 (0)