Add LocationContext classes to enable creation of cross function

ProgramPoints. ProgramPoints will refer to them in the furture.

llvm-svn: 77941
This commit is contained in:
Zhongxing Xu 2009-08-03 02:52:14 +00:00
parent 18ba271a79
commit 4f4b643afa
1 changed files with 35 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#define LLVM_CLANG_ANALYSIS_ANALYSISCONTEXT_H
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/FoldingSet.h"
#include <map>
namespace clang {
@ -58,6 +59,40 @@ public:
AnalysisContext *getContext(Decl *D);
};
class LocationContext : public llvm::FoldingSetNode {
public:
enum ContextKind { StackFrame, Scope };
private:
ContextKind Kind;
LocationContext *Parent;
AnalysisContext *Ctx;
protected:
LocationContext(ContextKind k, LocationContext *parent, AnalysisContext *ctx)
: Kind(k), Parent(parent), Ctx(ctx) {}
};
class StackFrameContext : public LocationContext {
Stmt *CallSite;
public:
StackFrameContext(Stmt *s, LocationContext *parent, AnalysisContext *ctx)
: LocationContext(StackFrame, parent, ctx), CallSite(s) {}
};
class ScopeContext : public LocationContext {
Stmt *Enter;
public:
ScopeContext(Stmt *s, LocationContext *parent, AnalysisContext *ctx)
: LocationContext(Scope, parent, ctx), Enter(s) {}
};
class LocationContextManager {
llvm::FoldingSet<LocationContext> Contexts;
};
}
#endif