[cfe-commits] r77941 - /cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h

Zhongxing Xu xuzhongxing at gmail.com
Sun Aug 2 19:52:15 PDT 2009


Author: zhongxingxu
Date: Sun Aug  2 21:52:14 2009
New Revision: 77941

URL: http://llvm.org/viewvc/llvm-project?rev=77941&view=rev
Log:
Add LocationContext classes to enable creation of cross function 
ProgramPoints. ProgramPoints will refer to them in the furture.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h?rev=77941&r1=77940&r2=77941&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h Sun Aug  2 21:52:14 2009
@@ -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 @@
   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





More information about the cfe-commits mailing list