ClangBackEnd: Fix unsaved file printer for default constructed object.

Change-Id: Ifcc8c2b60521e1f48ca2921d568b4e18d9d0a4eb
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
David Schulz
2016-06-21 10:21:28 +02:00
committed by David Schulz
parent 82a5320a42
commit 1a68968c22

View File

@@ -118,11 +118,16 @@ UnsavedFile::~UnsavedFile()
cxUnsavedFile.Length = 0; cxUnsavedFile.Length = 0;
} }
static const char *printCString(const char *str)
{
return str ? str : "nullptr";
}
void PrintTo(const UnsavedFile &unsavedFile, std::ostream *os) void PrintTo(const UnsavedFile &unsavedFile, std::ostream *os)
{ {
*os << "UnsavedFile(" *os << "UnsavedFile("
<< unsavedFile.cxUnsavedFile.Filename << ", " << printCString(unsavedFile.cxUnsavedFile.Filename) << ", "
<< unsavedFile.cxUnsavedFile.Contents << ", " << printCString(unsavedFile.cxUnsavedFile.Contents) << ", "
<< unsavedFile.cxUnsavedFile.Length << ")"; << unsavedFile.cxUnsavedFile.Length << ")";
} }