ValuePrinter: for auto
decls, we should use the deduced type
Value printing an expression of type `AutoType` ended up in calling the general fallback `printValue(const void *)`. To call the appropriate overload, the deduced type should be used instead. Fixes ROOT-9687.
This commit is contained in:
parent
abe65b3bed
commit
ba4ece8f3d
@ -621,6 +621,15 @@ static const char* BuildAndEmitVPWrapperBody(cling::Interpreter &Interp,
|
||||
R.begin(),
|
||||
R.end());
|
||||
|
||||
// For `auto foo = bar;` decls, we are interested in the deduced type, i.e.
|
||||
// AutoType 0x55e5ac848030 'int *' sugar
|
||||
// `-PointerType 0x55e5ac847f70 'int *' << this type
|
||||
// `-BuiltinType 0x55e5ab517420 'int'
|
||||
if (auto AT = llvm::dyn_cast<clang::AutoType>(QT.getTypePtr())) {
|
||||
if (AT->isDeduced())
|
||||
QT = AT->getDeducedType();
|
||||
}
|
||||
|
||||
if (auto PT = llvm::dyn_cast<clang::PointerType>(QT.getTypePtr())) {
|
||||
// Normalize `X*` to `const void*`, invoke `printValue(const void**)`,
|
||||
// unless it's a character string.
|
||||
|
Loading…
x
Reference in New Issue
Block a user