From a127ccaa38a23dbd9bd3884a2627c091075a7227 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 6 Mar 2009 07:08:50 +0000 Subject: [PATCH] Like PathDiagnosticPieces, strip trailing periods at the end of PathDiagnostic descriptions git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66263 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Analysis/PathDiagnostic.h | 10 ++++------ lib/Analysis/PathDiagnostic.cpp | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/include/clang/Analysis/PathDiagnostic.h b/include/clang/Analysis/PathDiagnostic.h index bdfa88b4ad..702879c3dd 100644 --- a/include/clang/Analysis/PathDiagnostic.h +++ b/include/clang/Analysis/PathDiagnostic.h @@ -94,21 +94,19 @@ public: class PathDiagnostic { std::list path; unsigned Size; + std::string BugType; std::string Desc; std::string Category; - std::string BugType; std::vector OtherDesc; public: PathDiagnostic() : Size(0) {} - PathDiagnostic(const char* bugtype, const char* desc, const char* category) - : Size(0), Desc(desc), Category(category), BugType(bugtype) {} + PathDiagnostic(const char* bugtype, const char* desc, const char* category); PathDiagnostic(const std::string& bugtype, const std::string& desc, - const std::string& category) - : Size(0), Desc(desc), Category(category), BugType(bugtype) {} - + const std::string& category); + ~PathDiagnostic(); const std::string& getDescription() const { return Desc; } diff --git a/lib/Analysis/PathDiagnostic.cpp b/lib/Analysis/PathDiagnostic.cpp index 818c5480ee..c078b6d0f2 100644 --- a/lib/Analysis/PathDiagnostic.cpp +++ b/lib/Analysis/PathDiagnostic.cpp @@ -47,6 +47,20 @@ PathDiagnostic::~PathDiagnostic() { for (iterator I = begin(), E = end(); I != E; ++I) delete &*I; } + +PathDiagnostic::PathDiagnostic(const char* bugtype, const char* desc, + const char* category) + : BugType(bugtype, GetNumCharsToLastNonPeriod(bugtype)), + Desc(desc, GetNumCharsToLastNonPeriod(desc)), + Category(category, GetNumCharsToLastNonPeriod(category)) {} + +PathDiagnostic::PathDiagnostic(const std::string& bugtype, + const std::string& desc, + const std::string& category) + : BugType(bugtype, 0, GetNumCharsToLastNonPeriod(bugtype)), + Desc(desc, 0, GetNumCharsToLastNonPeriod(desc)), + Category(category, 0, GetNumCharsToLastNonPeriod(category)) {} + void PathDiagnosticClient::HandleDiagnostic(Diagnostic::Level DiagLevel, const DiagnosticInfo &Info) { -- 2.40.0