From: Anna Zaks Date: Tue, 20 Sep 2011 22:30:48 +0000 (+0000) Subject: [analyzer] Remove dead code. (This code is trying to implement the idea that PathDiag... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc0a3016b9fd51f84780f0f82fb0f7f2ca93e8ff;p=clang [analyzer] Remove dead code. (This code is trying to implement the idea that PathDiagnosticClient could implement DiagnosticClient and has been dead for a while). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140198 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h index 298b3ca10e..53703f6662 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -45,7 +45,7 @@ class ExplodedNode; class PathDiagnostic; -class PathDiagnosticClient : public DiagnosticClient { +class PathDiagnosticClient { public: PathDiagnosticClient() {} @@ -60,8 +60,6 @@ public: virtual StringRef getName() const = 0; - virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, - const DiagnosticInfo &Info); void HandlePathDiagnostic(const PathDiagnostic* D); enum PathGenerationScheme { Minimal, Extensive }; diff --git a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index 2de96bd101..932689cf5c 100644 --- a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -82,43 +82,6 @@ PathDiagnostic::PathDiagnostic(StringRef bugtype, StringRef desc, Desc(StripTrailingDots(desc)), Category(StripTrailingDots(category)) {} -void PathDiagnosticClient::HandleDiagnostic(Diagnostic::Level DiagLevel, - const DiagnosticInfo &Info) { - // Default implementation (Warnings/errors count). - DiagnosticClient::HandleDiagnostic(DiagLevel, Info); - - // Create a PathDiagnostic with a single piece. - - PathDiagnostic* D = new PathDiagnostic(); - - const char *LevelStr; - switch (DiagLevel) { - default: - case Diagnostic::Ignored: assert(0 && "Invalid diagnostic type"); - case Diagnostic::Note: LevelStr = "note: "; break; - case Diagnostic::Warning: LevelStr = "warning: "; break; - case Diagnostic::Error: LevelStr = "error: "; break; - case Diagnostic::Fatal: LevelStr = "fatal error: "; break; - } - - llvm::SmallString<100> StrC; - StrC += LevelStr; - Info.FormatDiagnostic(StrC); - - PathDiagnosticPiece *P = - new PathDiagnosticEventPiece(FullSourceLoc(Info.getLocation(), - Info.getSourceManager()), - StrC.str()); - - for (unsigned i = 0, e = Info.getNumRanges(); i != e; ++i) - P->addRange(Info.getRange(i).getAsRange()); - for (unsigned i = 0, e = Info.getNumFixItHints(); i != e; ++i) - P->addFixItHint(Info.getFixItHint(i)); - D->push_front(P); - - HandlePathDiagnostic(D); -} - void PathDiagnosticClient::HandlePathDiagnostic(const PathDiagnostic *D) { // For now this simply forwards to HandlePathDiagnosticImpl. In the future // we can use this indirection to control for multi-threaded access to