summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2013-08-29 00:48:39 +0000
committerDaniel Dunbar <daniel@zuster.org>2013-08-29 00:48:39 +0000
commitd73eaabc8f71ebfe445fda5498e3420d2c747222 (patch)
tree7a91251c0a1c2aebabbcdd820191201a230fcca7 /llvm/utils
parentf8a75c3793eaf959c2423f861c24aa24ccdcda0f (diff)
downloadbcm5719-llvm-d73eaabc8f71ebfe445fda5498e3420d2c747222.tar.gz
bcm5719-llvm-d73eaabc8f71ebfe445fda5498e3420d2c747222.zip
[lit] Change lit.Test.ResultCode to be unique across pickling.
llvm-svn: 189549
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/lit/lit/Test.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/utils/lit/lit/Test.py b/llvm/utils/lit/lit/Test.py
index 59ca6943e76..05cae99a2f6 100644
--- a/llvm/utils/lit/lit/Test.py
+++ b/llvm/utils/lit/lit/Test.py
@@ -5,6 +5,17 @@ import os
class ResultCode(object):
"""Test result codes."""
+ # We override __new__ and __getnewargs__ to ensure that pickling still
+ # provides unique ResultCode objects in any particular instance.
+ _instances = {}
+ def __new__(cls, name, isFailure):
+ res = cls._instances.get(name)
+ if res is None:
+ cls._instances[name] = res = super(ResultCode, cls).__new__(cls)
+ return res
+ def __getnewargs__(self):
+ return (self.name, self.isFailure)
+
def __init__(self, name, isFailure):
self.name = name
self.isFailure = isFailure
OpenPOWER on IntegriCloud