[PATCH] [LIT] Add NativeMetricValue type to wrap types supported by the json encoder.

Eric Fiselier eric at efcs.ca
Tue Dec 9 17:14:14 PST 2014


I'll make the requested changes.

================
Comment at: utils/lit/lit/Test.py:78
@@ +77,3 @@
+    return type(value) in [dict, list, tuple, str, unicode, int, long, float,
+                           bool, type(None)]
+
----------------
ddunbar wrote:
> Wouldn't isinstance() be more canonical?
> 
> Also, this should probably verify that the container data types themselves contain representable items. Does the json lib provide a function to do that?
You could create a JSONEncoder object and encode it on the spot and throw away the result. However  there is nothing you can do to prevent the value from changing after the check.

You can't keep the encoded string because  you'll end up re-encoding the string later.

http://reviews.llvm.org/D6576






More information about the llvm-commits mailing list