[cfe-commits] r79700 - in /cfe/trunk: include/clang/Analysis/PathSensitive/AnalysisContext.h lib/Analysis/AnalysisContext.cpp
Ted Kremenek
kremenek at apple.com
Fri Aug 21 16:39:59 PDT 2009
Author: kremenek
Date: Fri Aug 21 18:39:58 2009
New Revision: 79700
URL: http://llvm.org/viewvc/llvm-project?rev=79700&view=rev
Log:
Constify LocationContext* (parent) and Stmt* fields in LocationContext.
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h
cfe/trunk/lib/Analysis/AnalysisContext.cpp
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=79700&r1=79699&r2=79700&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/AnalysisContext.h Fri Aug 21 18:39:58 2009
@@ -71,10 +71,11 @@
private:
ContextKind Kind;
AnalysisContext *Ctx;
- LocationContext *Parent;
+ const LocationContext *Parent;
protected:
- LocationContext(ContextKind k, AnalysisContext *ctx, LocationContext *parent)
+ LocationContext(ContextKind k, AnalysisContext *ctx,
+ const LocationContext *parent)
: Kind(k), Ctx(ctx), Parent(parent) {}
public:
@@ -82,7 +83,7 @@
AnalysisContext *getAnalysisContext() const { return Ctx; }
- LocationContext *getParent() const { return Parent; }
+ const LocationContext *getParent() const { return Parent; }
const Decl *getDecl() const { return getAnalysisContext()->getDecl(); }
@@ -101,16 +102,17 @@
}
static void Profile(llvm::FoldingSetNodeID &ID, ContextKind k,
- AnalysisContext *ctx, LocationContext *parent);
+ AnalysisContext *ctx, const LocationContext *parent);
static bool classof(const LocationContext*) { return true; }
};
class StackFrameContext : public LocationContext {
- Stmt *CallSite;
+ const Stmt *CallSite;
public:
- StackFrameContext(AnalysisContext *ctx, LocationContext *parent, Stmt *s)
+ StackFrameContext(AnalysisContext *ctx, const LocationContext *parent,
+ const Stmt *s)
: LocationContext(StackFrame, ctx, parent), CallSite(s) {}
void Profile(llvm::FoldingSetNodeID &ID) {
@@ -118,7 +120,7 @@
}
static void Profile(llvm::FoldingSetNodeID &ID, AnalysisContext *ctx,
- LocationContext *parent, Stmt *s);
+ const LocationContext *parent, const Stmt *s);
static bool classof(const LocationContext* Ctx) {
return Ctx->getKind() == StackFrame;
@@ -126,10 +128,11 @@
};
class ScopeContext : public LocationContext {
- Stmt *Enter;
+ const Stmt *Enter;
public:
- ScopeContext(AnalysisContext *ctx, LocationContext *parent, Stmt *s)
+ ScopeContext(AnalysisContext *ctx, const LocationContext *parent,
+ const Stmt *s)
: LocationContext(Scope, ctx, parent), Enter(s) {}
void Profile(llvm::FoldingSetNodeID &ID) {
@@ -137,7 +140,7 @@
}
static void Profile(llvm::FoldingSetNodeID &ID, AnalysisContext *ctx,
- LocationContext *parent, Stmt *s);
+ const LocationContext *parent, const Stmt *s);
static bool classof(const LocationContext* Ctx) {
return Ctx->getKind() == Scope;
@@ -148,13 +151,13 @@
llvm::FoldingSet<LocationContext> Contexts;
public:
- StackFrameContext *getStackFrame(AnalysisContext *ctx,LocationContext *parent,
- Stmt *s);
-
- ScopeContext *getScope(AnalysisContext *ctx,LocationContext *parent, Stmt *s);
+ StackFrameContext *getStackFrame(AnalysisContext *ctx,
+ const LocationContext *parent,
+ const Stmt *s);
+ ScopeContext *getScope(AnalysisContext *ctx, const LocationContext *parent,
+ const Stmt *s);
};
-
-}
-
+
+} // end clang namespace
#endif
Modified: cfe/trunk/lib/Analysis/AnalysisContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/AnalysisContext.cpp?rev=79700&r1=79699&r2=79700&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/AnalysisContext.cpp (original)
+++ cfe/trunk/lib/Analysis/AnalysisContext.cpp Fri Aug 21 18:39:58 2009
@@ -81,26 +81,29 @@
}
void LocationContext::Profile(llvm::FoldingSetNodeID &ID, ContextKind k,
- AnalysisContext *ctx, LocationContext *parent) {
+ AnalysisContext *ctx,
+ const LocationContext *parent) {
ID.AddInteger(k);
ID.AddPointer(ctx);
ID.AddPointer(parent);
}
void StackFrameContext::Profile(llvm::FoldingSetNodeID &ID,AnalysisContext *ctx,
- LocationContext *parent, Stmt *s) {
+ const LocationContext *parent, const Stmt *s) {
LocationContext::Profile(ID, StackFrame, ctx, parent);
ID.AddPointer(s);
}
void ScopeContext::Profile(llvm::FoldingSetNodeID &ID, AnalysisContext *ctx,
- LocationContext *parent, Stmt *s) {
+ const LocationContext *parent, const Stmt *s) {
LocationContext::Profile(ID, Scope, ctx, parent);
ID.AddPointer(s);
}
-StackFrameContext *LocationContextManager::getStackFrame(AnalysisContext *ctx,
- LocationContext *parent, Stmt *s) {
+StackFrameContext*
+LocationContextManager::getStackFrame(AnalysisContext *ctx,
+ const LocationContext *parent,
+ const Stmt *s) {
llvm::FoldingSetNodeID ID;
StackFrameContext::Profile(ID, ctx, parent, s);
void *InsertPos;
@@ -115,7 +118,8 @@
}
ScopeContext *LocationContextManager::getScope(AnalysisContext *ctx,
- LocationContext *parent, Stmt *s) {
+ const LocationContext *parent,
+ const Stmt *s) {
llvm::FoldingSetNodeID ID;
ScopeContext::Profile(ID, ctx, parent, s);
void *InsertPos;
More information about the cfe-commits
mailing list