[cfe-commits] r66519 - /cfe/trunk/include/clang/Analysis/PathDiagnostic.h

Ted Kremenek kremenek at apple.com
Mon Mar 9 19:50:49 PDT 2009


Author: kremenek
Date: Mon Mar  9 21:50:49 2009
New Revision: 66519

URL: http://llvm.org/viewvc/llvm-project?rev=66519&view=rev
Log:
PathDiagnosticControlFlowPiece:
- Correctly set "ControlFlow" kind (fix regression)

PathDiagnosticMacroPiece:
- add method "containsEvent" to determine if a PathDiagnosticMacroPiece
  transitively contains a PathDiagnosticEvent

Modified:
    cfe/trunk/include/clang/Analysis/PathDiagnostic.h

Modified: cfe/trunk/include/clang/Analysis/PathDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathDiagnostic.h?rev=66519&r1=66518&r2=66519&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathDiagnostic.h (original)
+++ cfe/trunk/include/clang/Analysis/PathDiagnostic.h Mon Mar  9 21:50:49 2009
@@ -75,7 +75,7 @@
   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 @@
   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 @@
   void addCodeModificationHint(const CodeModificationHint& Hint) {
     CodeModificationHints.push_back(Hint);
   }
-
+  
   typedef const SourceRange* range_iterator;
   
   range_iterator ranges_begin() const {
@@ -269,10 +271,10 @@
 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 @@
 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;
   }





More information about the cfe-commits mailing list