diff --git a/clang/include/clang/Analysis/PathDiagnostic.h b/clang/include/clang/Analysis/PathDiagnostic.h index bdfa88b4ad4e..702879c3dd0b 100644 --- a/clang/include/clang/Analysis/PathDiagnostic.h +++ b/clang/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/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp index 818c5480ee9f..c078b6d0f2eb 100644 --- a/clang/lib/Analysis/PathDiagnostic.cpp +++ b/clang/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) {