Buffer Interpreter-local std::string lookup; ValuePrinter needs it.

This commit is contained in:
Axel Naumann 2017-05-08 11:26:17 +02:00 committed by sftnight
parent ef501e64a0
commit cb2384fc55
2 changed files with 13 additions and 1 deletions

View File

@ -41,6 +41,7 @@ namespace cling {
private:
std::unique_ptr<clang::Parser> m_Parser;
Interpreter* m_Interpreter; // we do not own.
const clang::Type* m_StringTy;
public:
enum DiagSetting {
@ -221,6 +222,10 @@ namespace cling {
bool hasFunction(const clang::Decl* scopeDecl, llvm::StringRef funcName,
DiagSetting diagOnOff) const;
///\brief Retrieve the QualType of `std::string`.
const clang::Type* getStringType();
};
} // end namespace

View File

@ -38,7 +38,7 @@ namespace cling {
// pin *tor here so that we can have clang::Parser defined and be able to call
// the dtor on the OwningPtr
LookupHelper::LookupHelper(clang::Parser* P, Interpreter* interp)
: m_Parser(P), m_Interpreter(interp) {}
: m_Parser(P), m_Interpreter(interp), m_StringTy(nullptr) {}
LookupHelper::~LookupHelper() {}
@ -1896,4 +1896,11 @@ namespace cling {
hasFunctionSelector,
diagOnOff);
}
const Type* LookupHelper::getStringType() {
if (!m_StringTy)
m_StringTy = findType("std::string", WithDiagnostics).getTypePtr();
return m_StringTy;
}
} // end namespace cling