llvm-project
398573ee - [lit] Make MetricValue a proper abstract base class (#200187)

Commit
52 days ago
[lit] Make MetricValue a proper abstract base class (#200187) Currently, `MetricValue` signals abstract methods by raising `RuntimeError("abstract method")` at runtime. This means a subclass that forgets to implement `format()` or `todata()` is only caught when the method is actually called. This change makes `MetricValue` inherit from `abc.ABC` and decorates `format` and `todata` with `@abc.abstractmethod`. All three existing subclasses (`IntMetricValue`, `RealMetricValue`, `JSONMetricValue`) already implement both methods. No change in behavior. Signed-off-by: Prasoon Kumar <prasoonkumar054@gmail.com>
Author
Parents
Loading