]> granicus.if.org Git - clang/commitdiff
Like PathDiagnosticPieces, strip trailing periods at the end of PathDiagnostic descri...
authorTed Kremenek <kremenek@apple.com>
Fri, 6 Mar 2009 07:08:50 +0000 (07:08 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 6 Mar 2009 07:08:50 +0000 (07:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66263 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathDiagnostic.h
lib/Analysis/PathDiagnostic.cpp

index bdfa88b4ad4e5b6c891ceac4375d295799ec0109..702879c3dd0b36157b5b318440ff6a9f6879d761 100644 (file)
@@ -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; }
index 818c5480ee9f6d8061d8fa7cc8f7531d36d2d59a..c078b6d0f2ebf7049614e87219a944c4e414deda 100644 (file)
@@ -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) {