]> granicus.if.org Git - clang/commitdiff
Add LocationContext classes to enable creation of cross function
authorZhongxing Xu <xuzhongxing@gmail.com>
Mon, 3 Aug 2009 02:52:14 +0000 (02:52 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Mon, 3 Aug 2009 02:52:14 +0000 (02:52 +0000)
ProgramPoints. ProgramPoints will refer to them in the furture.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77941 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/AnalysisContext.h

index 2d3f15933c6fb2ea71825091ad974e74f58c9211..13331fa000809dd00fdc13114c390b9f64f89e34 100644 (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