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

Daniel Dunbar daniel at zuster.org
Tue Dec 9 16:25:21 PST 2014


The MetricValue abstraction doesn't currently provide any value really, but it is there in case we ever wanted to make use of the values (e.g., report performance changes). Given that, I think it probably makes sense to just call this JSONMetricValue and make it explicit that this is tied to values which are representable in the output, but which will otherwise be uninterpreted.

================
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)]
+
----------------
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?

================
Comment at: utils/lit/lit/Test.py:96
@@ +95,3 @@
+    elif type(value) in [int, long]:
+        return IntMetricValue(value)
+    elif type(value) is float:
----------------
Same note re: isinstance().

http://reviews.llvm.org/D6576






More information about the cfe-commits mailing list