[Lldb-commits] [PATCH] D13878: Add data formatters for go strings and slices.

Ryan Brown via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 20 10:54:52 PDT 2015


ribrdb added inline comments.

================
Comment at: source/Plugins/Language/Go/GoFormatterFunctions.cpp:10
@@ +9,3 @@
+
+#include <vector>
+
----------------
Eugene.Zelenko wrote:
> Please add include section comments. Same for other sections.
Which sections? I've seen a couple types of section markers in different files, but it's not consistent. Are there documented recommendations for these?

================
Comment at: source/Plugins/Language/Go/GoLanguage.cpp:79
@@ +78,3 @@
+HardcodedFormatters::HardcodedSummaryFinder
+GoLanguage::GetHardcodedSummaries ()
+{
----------------
granata.enrico wrote:
> Any reason why you need to use hardcoded formatters here?
> 
> Do strings and slices not have simple type names to match against in Go?
> 
> If at all possible, I would prefer to see you add formatters by name instead of hardcoded matches. Hardcoded matches are really meant for cases where the predicate you're trying to express is something a type name or regular expression on type names can't capture.
Normal string and slice types can be recognized by name.
But it is easy to create other string or slices with an arbitrary name.
The right thing to do is look at the go kind (for these types and eventually also map and chan). Hardcoded formatters seems like the only way to do this.
I also considered trying to represent this as a base type or typedef, but those both seemed complicated and confusing since they're not things the language itself supports.


Repository:
  rL LLVM

http://reviews.llvm.org/D13878





More information about the lldb-commits mailing list