[PATCH] D85144: [clang] Improve Dumping of APValues

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 9 11:36:37 PDT 2020


riccibruno added a comment.

I agree with you that it's fine to use `printPretty`  for leaves (and additionally it would be annoying to duplicate the `LValue` case); that's what I was planning to do anyway.

What I am not sure I agree with is the additional complexity to handle the (debugger-only and easy to avoid) case where no context is given.



================
Comment at: clang/lib/AST/APValue.cpp:539
         Out << '[' << Path[I].getAsArrayIndex() << ']';
-        ElemTy = Ctx.getAsArrayType(ElemTy)->getElementType();
+        ElemTy = cast<ArrayType>(ElemTy.getCanonicalType())->getElementType();
       }
----------------
riccibruno wrote:
> And also I don't think that this change is safe since `ASTContext::getAsArrayType` applies qualifiers from the array type to the element type.
This works because we only use `ElemTy` to distinguish between the array case and the base-or-member case right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85144/new/

https://reviews.llvm.org/D85144



More information about the cfe-commits mailing list