diff --git a/include/klee/Module/SarifReport.h b/include/klee/Module/SarifReport.h index df851b25e7..348588c21c 100644 --- a/include/klee/Module/SarifReport.h +++ b/include/klee/Module/SarifReport.h @@ -257,7 +257,6 @@ struct LocRange { virtual Precision maxPrecision() const = 0; virtual size_t hash() const = 0; virtual std::string toString() const = 0; - virtual bool operator==(const LocRange &other) const = 0; bool hasInside(KInstruction *ki) const; void hasInside(InstrWithPrecision &kp) const { if (kp.precision > maxPrecision()) { @@ -333,10 +332,8 @@ class LineColumnRange final : public LocRange { kp.precision = Precision::Line; } - bool operator==(const LocRange &other) const final { - if (auto p = dynamic_cast(&other)) - return startLine == p->startLine && endLine == p->endLine && startColumn == p->startColumn && endColumn == p->endColumn; - return false; + bool operator==(const LineColumnRange &p) const { + return startLine == p.startLine && endLine == p.endLine && startColumn == p.startColumn && endColumn == p.endColumn; } }; @@ -376,7 +373,7 @@ struct Location { class ReferenceCounter _refCount; bool operator==(const Location &other) const { - return filename == other.filename && *range == *other.range; + return filename == other.filename && range->getRange() == other.range->getRange(); } bool isInside(const std::string &name) const; diff --git a/lib/Module/SarifReport.cpp b/lib/Module/SarifReport.cpp index 387f93f9bb..70e087eda4 100644 --- a/lib/Module/SarifReport.cpp +++ b/lib/Module/SarifReport.cpp @@ -389,12 +389,6 @@ class InstructionRange : public LocRange { kp.precision = std::min(kp.precision, Precision::Column); } - bool operator==(const LocRange &other) const final { - if (auto p = dynamic_cast(&other)) - return opCode == p->opCode && range == p->range; - return false; - } - protected: virtual bool hasInsidePrecise(const KInstruction *ki) const { return true; } };