[PATCH] D146809: [clang-repl] Implement Value pretty printing

Jun Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 20:24:07 PDT 2023


junaire added inline comments.


================
Comment at: clang/lib/Interpreter/Interpreter.cpp:434
+
+llvm::Expected<llvm::orc::ExecutorAddr> Interpreter::CompileDecl(Decl *D) {
+  assert(D && "The Decl being compiled can't be null");
----------------
aaron.ballman wrote:
> Any way to make this take a `const Decl *` instead?
`DeclGroupRef` in line 439 asks a non-const Decl*, should we use `const Decl*` and const cast it?


================
Comment at: clang/lib/Interpreter/Value.cpp:272
+
 void Value::print(llvm::raw_ostream &Out) const {
   assert(OpaqueType != nullptr && "Can't print default Value");
----------------
v.g.vassilev wrote:
> We should add some documentation for users how to write a pretty-printer for a custom class.
> 
> We do not seem to support the multiple inheritance case where one of the base classes has a pretty-printer and the other does not. See the explanation in Cling. It is okay to not have it at the moment but we should include a FIXME here saying that we do not yet support it.
Where should I put the doc? Value.cpp is the implementation and it's unlikely for regular users to read it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146809



More information about the cfe-commits mailing list