[cfe-commits] r45488 - in /cfe/trunk/include/clang/Analysis/PathSensitive: SimulGraph.h SimulVertex.h
Ted Kremenek
kremenek at apple.com
Wed Jan 2 09:45:00 PST 2008
Author: kremenek
Date: Wed Jan 2 11:45:00 2008
New Revision: 45488
URL: http://llvm.org/viewvc/llvm-project?rev=45488&view=rev
Log:
Sprinkled 'typename' and fixed a few typos and type declaration errors to
make these headers compile.
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/SimulGraph.h
cfe/trunk/include/clang/Analysis/PathSensitive/SimulVertex.h
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/SimulGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/SimulGraph.h?rev=45488&r1=45487&r2=45488&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/SimulGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/SimulGraph.h Wed Jan 2 11:45:00 2008
@@ -23,11 +23,13 @@
namespace clang {
-tempalte <typename VertexTy>
+template <typename VertexTy>
class SimulGraph {
// Type definitions.
typedef llvm::FoldingSet<VertexTy> VertexSet;
typedef llvm::DenseMap<ProgramEdge,VertexSet> EdgeVertexSetMap;
+ typedef llvm::SmallVector<VertexTy*,2> RootsTy;
+ typedef llvm::SmallVector<VertexTy*,10> EndVerticesTy;
/// VertexCounter - The number of vertices that have been created, although
/// this need not be the current number of vertices in the graph that
@@ -39,12 +41,10 @@
/// one, but clients are free to establish multiple subgraphs within a single
/// SimulGraph. Moreover, these subgraphs can often merge when paths from
/// different roots reach the same state at the same program location.
- typedef llvm::SmallVector<2,VertexTy*> RootsTy;
RootsTy Roots;
/// EndVertices - The vertices in the simulation graph which have been
/// specially marked as the endpoint of an abstract simulation path.
- llvm::SmallVector<10,VertexTy*> EndVerticesTy
EndVerticesTy EndVertices;
/// VerticesOfEdge - A mapping from edges to vertices.
@@ -67,13 +67,13 @@
// Note: this assumes that a vertex's profile matches with its state,
// which is the case when VertexTy == SimulVertex. (other implementations
// must guarantee this invariant)
- FoldingSetNodeID profile;
+ llvm::FoldingSetNodeID profile;
void* InsertPos = 0;
VertexTy* V = 0;
typename VertexTy::StateTy::Profile(profile,State);
- if (V = VSet::FindNodeOrInsertPos(profile,InsertPos))
+ if (V = VSet.FindNodeOrInsertPos(profile,InsertPos))
return V;
// No cache hit. Allocate a new vertex.
@@ -100,16 +100,16 @@
unsigned getCounter() const { return VertexCounter; }
// Iterators.
- typedef RootsTy::iterator roots_iterator;
- typedef RootsTy::const_iterator const_roots_iterator;
+ typedef typename RootsTy::iterator roots_iterator;
+ typedef typename RootsTy::const_iterator const_roots_iterator;
roots_iterator roots_begin() { return Roots.begin(); }
roots_iterator roots_end() { return Roots.end(); }
const_roots_iterator roots_begin() const { return Roots.begin(); }
const_roots_iterator roots_end() const { return Roots.end(); }
- typedef EndVerticesTy::iterator eop_iterator;
- typedef EndVerticesTy::const_iterator const_eop_iterator;
+ typedef typename EndVerticesTy::iterator eop_iterator;
+ typedef typename EndVerticesTy::const_iterator const_eop_iterator;
eop_iterator eop_begin() { return EndVertices.begin(); }
eop_iterator eop_end() { return EndVertices.end(); }
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/SimulVertex.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/SimulVertex.h?rev=45488&r1=45487&r2=45488&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/SimulVertex.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/SimulVertex.h Wed Jan 2 11:45:00 2008
@@ -16,15 +16,18 @@
#ifndef LLVM_CLANG_ANALYSIS_PS_ANALYSISVERTEX
#define LLVM_CLANG_ANALYSIS_PS_ANALYSISVERTEX
+#include "clang/Analysis/ProgramEdge.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/FoldingSet.h"
namespace clang {
-class ProgramEdge;
-
-template <typename StateTy>
-class SimulVertex : public FoldingSetNode {
+template <typename StateType>
+class SimulVertex : public llvm::FoldingSetNode {
+public:
+ typedef StateType StateTy;
+
+private:
/// VertexID - A unique ID for the vertex. This number indicates the
/// creation order of vertices, with lower numbers being created first.
/// The first created vertex has VertexID == 0.
@@ -45,32 +48,29 @@
// FIXME: Preds and Succs only grows, not shrinks. It would be nice
// if these lists were allocated from the same BumpPtrAllocator as
// the vertices themselves.
- typedef llvm::SmallVector<1,SimulVertex*> AdjacentVertices;
+ typedef llvm::SmallVector<SimulVertex*,2> AdjacentVertices;
AdjacentVertices Preds;
AdjacentVertices Succs;
public:
- typedef typename StateTy StateTy;
-
explicit SimulVertex(unsigned ID, const ProgramEdge& loc, StateTy* state)
: VertexID(ID), Location(loc), State(state) {}
// Accessors.
- State* getState() const { return State; }
+ StateTy* getState() const { return State; }
const ProgramEdge& getLocation() const { return Location; }
unsigned getVertexID() const { return VertexID; }
// Profiling (for FoldingSet).
void Profile(llvm::FoldingSetNodeID& ID) const {
- StateTy::Profile(V.getState(),ID);
+ StateTy::Profile(getState(),ID);
}
// Iterators over successor and predecessor vertices.
- typedef AdjacentVertices::iterator succ_iterator;
- typedef AdjacentVertices::const_iterator const_succ_iterator;
-
- typedef AdjacentVertices::iterator pred_iterator;
- typedef AdjacentVertices::const_iterator const_pred_iterator;
+ typedef typename AdjacentVertices::iterator succ_iterator;
+ typedef typename AdjacentVertices::const_iterator const_succ_iterator;
+ typedef typename AdjacentVertices::iterator pred_iterator;
+ typedef typename AdjacentVertices::const_iterator const_pred_iterator;
pred_iterator pred_begin() { return Preds.begin(); }
pred_iterator pred_end() { return Preds.end(); }
More information about the cfe-commits
mailing list