Skip to content
Snippets Groups Projects
Commit 29f7fcc5 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

COMP: workaround clang-13 optimization issue (vtk handling)

parent 9a512511
Branches
Tags
No related merge requests found
......@@ -49,6 +49,18 @@ Foam::vtk::fileWriter::stateNames
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::vtk::fileWriter::checkFormatterValidity() const
{
// In parallel can be unallocated on non-master nodes
if ((parallel_ ? Pstream::master() : true) && !format_)
{
FatalErrorInFunction
<< "unallocated formatter" << endl
<< exit(FatalError);
}
}
Foam::Ostream& Foam::vtk::fileWriter::reportBadState
(
Ostream& os,
......@@ -285,7 +297,7 @@ Foam::vtk::fileWriter::fileWriter
nCellData_(0),
nPointData_(0),
outputFile_(),
format_(),
format_(nullptr),
os_()
{
// We do not currently support append mode at all
......@@ -313,7 +325,7 @@ bool Foam::vtk::fileWriter::open(const fileName& file, bool parallel)
if (format_)
{
format_.clear();
format_.reset(nullptr);
os_.close();
}
nCellData_ = nPointData_ = 0;
......@@ -368,7 +380,7 @@ void Foam::vtk::fileWriter::close()
if (format_)
{
format_.clear();
format_.reset(nullptr);
os_.close();
}
......
......@@ -116,6 +116,9 @@ protected:
// Protected Member Functions
//- Verify that formatter in either allocated or not required
void checkFormatterValidity() const;
//- Generate message reporting bad writer state
Ostream& reportBadState(Ostream&, outputState expected) const;
......
......@@ -315,6 +315,11 @@ void Foam::vtk::internalMeshWriter::writeCellsConnectivity
}
else
{
// FIXME: clang-13 optimization jumps into incorrect branch
#ifdef __clang__
checkFormatterValidity();
#endif
vtk::writeList(format(), cellTypes);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment