Skip to content

Commit 7092398

Browse files
committed
Improve pretty-printing for APValues of void type.
No functionality change intended: there doesn't seem to be any way to cause Clang to print such a value, but they can show up when dumping APValues from a debugger.
1 parent 53aff8d commit 7092398

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

clang/lib/AST/APValue.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,13 @@ static double GetApproxValue(const llvm::APFloat &F) {
388388

389389
void APValue::printPretty(raw_ostream &Out, const ASTContext &Ctx,
390390
QualType Ty) const {
391+
// There are no objects of type 'void', but values of this type can be
392+
// returned from functions.
393+
if (Ty->isVoidType()) {
394+
Out << "void()";
395+
return;
396+
}
397+
391398
switch (getKind()) {
392399
case APValue::None:
393400
Out << "<out of lifetime>";

0 commit comments

Comments
 (0)