[PATCH] D13761: [llgo] llgoi: separate evaluation from printing

Andrew Wilkins via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 03:01:37 PDT 2016


axw added a comment.

@pcc PTAL. Sorry for leaving this for so long.


================
Comment at: cmd/llgoi/llgoi.go:54
@@ +53,3 @@
+func init() {
+	flag.BoolVar(&dumpSource, "fdump-trace", false, "enable dumping source to stderr before execution")
+}
----------------
pcc wrote:
> I normally just hacked this in manually whenever I needed it. Would that not work for you?
> 
> Nit: can the variable be named like the flag name?
I'll back this out for now.

================
Comment at: cmd/llgoi/llgoi.go:182
@@ +181,3 @@
+		symbolName := irgen.ManglePackagePath(pkgpath) + "." + name
+		global := module.Module.NamedGlobal(symbolName)
+		return in.engine.PointerToGlobal(global)
----------------
pcc wrote:
> Wouldn't this return null if the source package isn't a `interpretLine`-generated package? How do things work in that case?
Fixed to return nil if the symbol isn't found. Should never happen now, anyway, since the `__llgoiResults` call has been moved into `interpretLine`

================
Comment at: cmd/llgoi/llgoi.go:531
@@ +530,3 @@
+	// package qualifiers for types defined within the interpreter.
+	fmt.Fprintf(w, "%+v", v)
+}
----------------
pcc wrote:
> I was working on a pretty printing package for this, mainly because I wanted more whitespace than what `%#v` provides, but I suppose it could also be used to hide internal names. If that sounds useful at all I'll see if I can dig it up.
If you still have this, please do send it along. If not, I'll do it later.


http://reviews.llvm.org/D13761





More information about the llvm-commits mailing list