Allow "same types" to be printed as const char*.

Fixes printing of std::string::c_str().
This commit is contained in:
Axel Naumann 2018-04-26 08:42:40 +02:00 committed by sftnight
parent 0793802867
commit 9d3e144814

View File

@ -574,8 +574,8 @@ static const char* BuildAndEmitVPWrapperBody(cling::Interpreter &Interp,
R.end());
if (auto PT = llvm::dyn_cast<clang::PointerType>(QT.getTypePtr())) {
if (PT->getPointeeType().getUnqualifiedType() != Ctx.CharTy
&& PT->getPointeeType().getUnqualifiedType() != Ctx.WCharTy) {
if (!Ctx.hasSameType(PT->getPointeeType().getUnqualifiedType(), Ctx.CharTy)
&& !Ctx.hasSameType(PT->getPointeeType().getUnqualifiedType(), Ctx.WCharTy)) {
// Normalize `X*` to `const void*`, invoke `printValue(const void**)`.
QT = Ctx.VoidTy;
QT.addConst();