aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-06 07:08:50 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-06 07:08:50 +0000
commita127ccaa38a23dbd9bd3884a2627c091075a7227 (patch)
treefd7fe269ab08a50def19f5a8904fd79f5bb4e901
parent14f234ec1257b36c9d070dfb60aa5df53ec04767 (diff)
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
-rw-r--r--include/clang/Analysis/PathDiagnostic.h10
-rw-r--r--lib/Analysis/PathDiagnostic.cpp14
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<PathDiagnosticPiece*> path;
unsigned Size;
+ std::string BugType;
std::string Desc;
std::string Category;
- std::string BugType;
std::vector<std::string> 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) {