diff options
Diffstat (limited to 'lib/StaticAnalyzer/Core/PathDiagnostic.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index 15a6635062..d010a668d9 100644 --- a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -208,41 +208,6 @@ void PathDiagnosticConsumer::HandlePathDiagnostic(PathDiagnostic *D) { namespace { - -static llvm::Optional<bool> comparePiece(PathDiagnosticPiece &X, - PathDiagnosticPiece &Y) { - PathDiagnosticPiece::Kind XK = X.getKind(), YK = Y.getKind(); - if (XK != YK) { - return XK < YK; - } - FullSourceLoc XL = X.getLocation().asLocation(); - FullSourceLoc YL = Y.getLocation().asLocation(); - if (XL < YL) - return true; - if (YL < XL) - return false; - const std::string &XS = X.getString(); - const std::string &YS = Y.getString(); - if (XS != YS) - return XS < YS; - return llvm::Optional<bool>(); -} - -static bool comparePathPieces(const PathPieces &X, const PathPieces &Y) { - if (X.size() < Y.size()) - return true; - if (X.size() > Y.size()) - return false; - // Compare individual parts of the path. - assert(X.size() == Y.size()); - for (unsigned i = 0, n = X.size(); i < n; ++i) { - llvm::Optional<bool> B = comparePiece(*X[i], *Y[i]); - if (B.hasValue()) - return B.getValue(); - } - return false; -} - struct CompareDiagnostics { // Compare if 'X' is "<" than 'Y'. bool operator()(const PathDiagnostic *X, const PathDiagnostic *Y) const { @@ -251,7 +216,7 @@ struct CompareDiagnostics { const FullSourceLoc &YLoc = Y->getLocation().asLocation(); if (XLoc < YLoc) return true; - if (YLoc < XLoc) + if (XLoc != YLoc) return false; // Next, compare by bug type. @@ -270,8 +235,8 @@ struct CompareDiagnostics { if (XDesc != YDesc) return false; - // Fall back to comparing path pieces. - return comparePathPieces(X->path, Y->path); + // FIXME: Further refine by comparing PathDiagnosticPieces? + return false; } }; } |