Avoid memset by using in-class member init.

This commit is contained in:
Axel Naumann 2017-06-22 12:46:58 +02:00 committed by sftnight
parent 7504234e21
commit 65b4cd2cc3
2 changed files with 1 additions and 5 deletions

View File

@ -57,7 +57,7 @@ namespace cling {
private:
std::unique_ptr<clang::Parser> m_Parser;
Interpreter* m_Interpreter; // we do not own.
const clang::Type* m_StringTy[kNumCachedStrings];
const clang::Type* m_StringTy[kNumCachedStrings] = {};
public:
LookupHelper(clang::Parser* P, Interpreter* interp);

View File

@ -39,8 +39,6 @@ namespace cling {
// the dtor on the OwningPtr
LookupHelper::LookupHelper(clang::Parser* P, Interpreter* interp)
: m_Parser(P), m_Interpreter(interp) {
// Always properly initialized in getStringType
// ::memset(m_StringTy, 0, sizeof(m_StringTy));
}
LookupHelper::~LookupHelper() {}
@ -1912,8 +1910,6 @@ namespace cling {
assert(Type && "Type cannot be null");
const Transaction*& Cache = m_Interpreter->getStdStringTransaction();
if (!Cache || !m_StringTy[kStdString]) {
if (!Cache) ::memset(m_StringTy, 0, sizeof(m_StringTy));
QualType Qt = findType("std::string", WithDiagnostics);
m_StringTy[kStdString] = Qt.isNull() ? nullptr : Qt.getTypePtr();
if (!m_StringTy[kStdString]) return kNotAString;