[cfe-commits] r42098 - /cfe/trunk/include/clang/AST/CFG.h

Ted Kremenek kremenek at apple.com
Tue Sep 18 11:01:17 PDT 2007


Author: kremenek
Date: Tue Sep 18 13:01:15 2007
New Revision: 42098

URL: http://llvm.org/viewvc/llvm-project?rev=42098&view=rev
Log:
Added type "CFG::Edge" to encapsulate the notion of directed-edges
within source-level CFGs.


Modified:
    cfe/trunk/include/clang/AST/CFG.h

Modified: cfe/trunk/include/clang/AST/CFG.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CFG.h?rev=42098&r1=42097&r2=42098&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/CFG.h (original)
+++ cfe/trunk/include/clang/AST/CFG.h Tue Sep 18 13:01:15 2007
@@ -212,6 +212,33 @@
   CFGBlock*        getIndirectGotoBlock() { return IndirectGotoBlock; }
   const CFGBlock*  getIndirectGotoBlock() const { return IndirectGotoBlock; }
   
+  // Edges
+  
+  class Edge {
+    const CFGBlock* Src;
+    const CFGBlock* Dst;
+  public:
+    Edge(const CFGBlock* src, const CFGBlock* dst) : Src(src), Dst(dst) {}
+    Edge(const Edge& RHS) : Src(RHS.Src), Dst(RHS.Dst) {}
+    
+    Edge& operator=(const Edge& RHS) { 
+      Src = RHS.Src;
+      Dst = RHS.Dst;
+      return *this; 
+    }
+    
+    const CFGBlock* getSrc() const { return Src; }
+    const CFGBlock* getDst() const { return Dst; }
+        
+    bool operator==(const Edge& RHS) const {
+      return Src == RHS.Src && Dst == RHS.Dst;
+    }
+    
+    bool operator!=(const Edge& RHS) const {
+      return !(*this == RHS);
+    }
+  };
+  
   // Utility
   
   CFGBlock* createBlock();





More information about the cfe-commits mailing list