aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-09-08 01:25:00 +0000
committerTed Kremenek <kremenek@apple.com>2012-09-08 01:25:00 +0000
commite157ae53772e90a3ee3cba3eaa7da3300eb249eb (patch)
treed2bd240d5bf4a69b5ae92e69ad8c4cd13823d5db /lib/StaticAnalyzer/Core/PathDiagnostic.cpp
parent62a456312ad633169528d5fc85063704dc8f5d0f (diff)
Revert "Attempt to make the PathDiagnostic emission order more deterministic by"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163446 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/PathDiagnostic.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/PathDiagnostic.cpp41
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;
}
};
}