aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-10 02:50:49 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-10 02:50:49 +0000
commit83d889b6e8b5b0bb7305cc1d1749780d205a6c9b (patch)
tree18de742b98476bd22c9eedecb6751417c9c57159
parent0008683bee5ab26c2a5a495adb2a894fc7e7c7c9 (diff)
PathDiagnosticControlFlowPiece:
- Correctly set "ControlFlow" kind (fix regression) PathDiagnosticMacroPiece: - add method "containsEvent" to determine if a PathDiagnosticMacroPiece transitively contains a PathDiagnosticEvent git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66519 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Analysis/PathDiagnostic.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/include/clang/Analysis/PathDiagnostic.h b/include/clang/Analysis/PathDiagnostic.h
index d5fa0a2192..f9e595f64c 100644
--- a/include/clang/Analysis/PathDiagnostic.h
+++ b/include/clang/Analysis/PathDiagnostic.h
@@ -75,7 +75,7 @@ public:
meta_iterator meta_end() const { return OtherDesc.end(); }
void addMeta(const std::string& s) { OtherDesc.push_back(s); }
void addMeta(const char* s) { OtherDesc.push_back(s); }
-
+
void push_front(PathDiagnosticPiece* piece) {
path.push_front(piece);
++Size;
@@ -97,6 +97,8 @@ public:
unsigned size() const { return Size; }
bool empty() const { return Size == 0; }
+ void resetPath(bool deletePieces = true);
+
class iterator {
public:
typedef std::list<PathDiagnosticPiece*>::iterator ImplTy;
@@ -218,7 +220,7 @@ public:
void addCodeModificationHint(const CodeModificationHint& Hint) {
CodeModificationHints.push_back(Hint);
}
-
+
typedef const SourceRange* range_iterator;
range_iterator ranges_begin() const {
@@ -269,10 +271,10 @@ public:
class PathDiagnosticControlFlowPiece : public PathDiagnosticPiece {
public:
PathDiagnosticControlFlowPiece(FullSourceLoc pos, const std::string& s)
- : PathDiagnosticPiece(pos, s, Event) {}
+ : PathDiagnosticPiece(pos, s, ControlFlow) {}
PathDiagnosticControlFlowPiece(FullSourceLoc pos, const char* s)
- : PathDiagnosticPiece(pos, s, Event) {}
+ : PathDiagnosticPiece(pos, s, ControlFlow) {}
~PathDiagnosticControlFlowPiece();
@@ -284,20 +286,23 @@ public:
class PathDiagnosticMacroPiece : public PathDiagnosticPiece {
std::vector<PathDiagnosticPiece*> SubPieces;
public:
- PathDiagnosticMacroPiece(FullSourceLoc pos, const std::string& s)
- : PathDiagnosticPiece(pos, s, Macro) {}
-
- PathDiagnosticMacroPiece(FullSourceLoc pos, const char* s)
- : PathDiagnosticPiece(pos, s, Macro) {}
+ PathDiagnosticMacroPiece(FullSourceLoc pos)
+ : PathDiagnosticPiece(pos, "", Macro) {}
~PathDiagnosticMacroPiece();
+ bool containsEvent() const;
+
void push_back(PathDiagnosticPiece* P) { SubPieces.push_back(P); }
typedef std::vector<PathDiagnosticPiece*>::iterator iterator;
iterator begin() { return SubPieces.begin(); }
iterator end() { return SubPieces.end(); }
+ typedef std::vector<PathDiagnosticPiece*>::const_iterator const_iterator;
+ const_iterator begin() const { return SubPieces.begin(); }
+ const_iterator end() const { return SubPieces.end(); }
+
static inline bool classof(const PathDiagnosticPiece* P) {
return P->getKind() == Macro;
}