diff options
| author | Ted Kremenek <kremenek@apple.com> | 2007-09-18 18:01:15 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2007-09-18 18:01:15 +0000 |
| commit | 1d77d7683748f71aa44b1d5f4d0c7234531a40d0 (patch) | |
| tree | cf33ce699738e4cf9baabcc8638a1595efaea9ba | |
| parent | 8cca8469deabfd066ca3830033f0ae7f2714677c (diff) | |
| download | bcm5719-llvm-1d77d7683748f71aa44b1d5f4d0c7234531a40d0.tar.gz bcm5719-llvm-1d77d7683748f71aa44b1d5f4d0c7234531a40d0.zip | |
Added type "CFG::Edge" to encapsulate the notion of directed-edges
within source-level CFGs.
llvm-svn: 42098
| -rw-r--r-- | clang/include/clang/AST/CFG.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/include/clang/AST/CFG.h b/clang/include/clang/AST/CFG.h index f940a534c80..2772d185807 100644 --- a/clang/include/clang/AST/CFG.h +++ b/clang/include/clang/AST/CFG.h @@ -212,6 +212,33 @@ public: 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(); |

