summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/PathDiagnostic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Analysis/PathDiagnostic.cpp')
-rw-r--r--clang/lib/Analysis/PathDiagnostic.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp
index ae53ed9dbf0..a504e80b596 100644
--- a/clang/lib/Analysis/PathDiagnostic.cpp
+++ b/clang/lib/Analysis/PathDiagnostic.cpp
@@ -13,8 +13,24 @@
#include "clang/Analysis/PathDiagnostic.h"
#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Casting.h"
#include <sstream>
using namespace clang;
+using llvm::dyn_cast;
+using llvm::isa;
+
+bool PathDiagnosticMacroPiece::containsEvent() const {
+ for (const_iterator I = begin(), E = end(); I!=E; ++I) {
+ if (isa<PathDiagnosticEventPiece>(*I))
+ return true;
+
+ if (PathDiagnosticMacroPiece *MP = dyn_cast<PathDiagnosticMacroPiece>(*I))
+ if (MP->containsEvent())
+ return true;
+ }
+
+ return false;
+}
static size_t GetNumCharsToLastNonPeriod(const char *s) {
const char *start = s;
@@ -63,6 +79,16 @@ PathDiagnostic::~PathDiagnostic() {
for (iterator I = begin(), E = end(); I != E; ++I) delete &*I;
}
+void PathDiagnostic::resetPath(bool deletePieces) {
+ Size = 0;
+
+ if (deletePieces)
+ for (iterator I=begin(), E=end(); I!=E; ++I)
+ delete &*I;
+
+ path.clear();
+}
+
PathDiagnostic::PathDiagnostic(const char* bugtype, const char* desc,
const char* category)
OpenPOWER on IntegriCloud