summaryrefslogtreecommitdiffstats
path: root/clang/include
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/Analysis/LocalCheckers.h10
-rw-r--r--clang/include/clang/Analysis/PathSensitive/AnalysisContext.h20
-rw-r--r--clang/include/clang/Analysis/PathSensitive/AnalysisManager.h2
-rw-r--r--clang/include/clang/Analysis/PathSensitive/ExplodedGraph.h7
-rw-r--r--clang/include/clang/Analysis/PathSensitive/GRCoreEngine.h5
-rw-r--r--clang/include/clang/Analysis/PathSensitive/GRExprEngine.h2
6 files changed, 24 insertions, 22 deletions
diff --git a/clang/include/clang/Analysis/LocalCheckers.h b/clang/include/clang/Analysis/LocalCheckers.h
index 2322f5ebb7a..c6d53e60ef6 100644
--- a/clang/include/clang/Analysis/LocalCheckers.h
+++ b/clang/include/clang/Analysis/LocalCheckers.h
@@ -40,15 +40,17 @@ void CheckUninitializedValues(CFG& cfg, ASTContext& Ctx, Diagnostic& Diags,
GRTransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
const LangOptions& lopts);
-void CheckObjCDealloc(ObjCImplementationDecl* D, const LangOptions& L,
+void CheckObjCDealloc(const ObjCImplementationDecl* D, const LangOptions& L,
BugReporter& BR);
-void CheckObjCInstMethSignature(ObjCImplementationDecl* ID, BugReporter& BR);
-void CheckObjCUnusedIvar(ObjCImplementationDecl* D, BugReporter& BR);
+void CheckObjCInstMethSignature(const ObjCImplementationDecl *ID,
+ BugReporter& BR);
+
+void CheckObjCUnusedIvar(const ObjCImplementationDecl *D, BugReporter& BR);
void RegisterAppleChecks(GRExprEngine& Eng, const Decl &D);
-void CheckSecuritySyntaxOnly(Decl *D, BugReporter &BR);
+void CheckSecuritySyntaxOnly(const Decl *D, BugReporter &BR);
} // end namespace clang
diff --git a/clang/include/clang/Analysis/PathSensitive/AnalysisContext.h b/clang/include/clang/Analysis/PathSensitive/AnalysisContext.h
index db281fec58e..e69b4f529fe 100644
--- a/clang/include/clang/Analysis/PathSensitive/AnalysisContext.h
+++ b/clang/include/clang/Analysis/PathSensitive/AnalysisContext.h
@@ -17,7 +17,7 @@
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/FoldingSet.h"
-#include <map>
+#include "llvm/ADT/DenseMap.h"
namespace clang {
@@ -31,8 +31,7 @@ class ImplicitParamDecl;
/// AnalysisContext contains the context data for the function or method under
/// analysis.
class AnalysisContext {
- Decl *D;
- Stmt *Body;
+ const Decl *D;
// AnalysisContext owns the following data.
CFG *cfg;
@@ -40,11 +39,10 @@ class AnalysisContext {
ParentMap *PM;
public:
- AnalysisContext() : D(0), Body(0), cfg(0), liveness(0), PM(0) {}
+ AnalysisContext(const Decl *d) : D(d), cfg(0), liveness(0), PM(0) {}
~AnalysisContext();
- void setDecl(Decl* d) { D = d; }
- Decl *getDecl() { return D; }
+ const Decl *getDecl() { return D; }
Stmt *getBody();
CFG *getCFG();
ParentMap &getParentMap();
@@ -56,12 +54,12 @@ public:
};
class AnalysisContextManager {
- std::map<Decl*, AnalysisContext> Contexts;
-
+ typedef llvm::DenseMap<const Decl*, AnalysisContext*> ContextMap;
+ ContextMap Contexts;
public:
- typedef std::map<Decl*, AnalysisContext>::iterator iterator;
-
- AnalysisContext *getContext(Decl *D);
+ ~AnalysisContextManager();
+
+ AnalysisContext *getContext(const Decl *D);
};
class LocationContext : public llvm::FoldingSetNode {
diff --git a/clang/include/clang/Analysis/PathSensitive/AnalysisManager.h b/clang/include/clang/Analysis/PathSensitive/AnalysisManager.h
index deff4818ce7..78d77b58a19 100644
--- a/clang/include/clang/Analysis/PathSensitive/AnalysisManager.h
+++ b/clang/include/clang/Analysis/PathSensitive/AnalysisManager.h
@@ -83,7 +83,7 @@ public:
DisplayedFunction = false;
}
- Decl *getCodeDecl() const {
+ const Decl *getCodeDecl() const {
assert (AScope == ScopeDecl);
return EntryContext->getDecl();
}
diff --git a/clang/include/clang/Analysis/PathSensitive/ExplodedGraph.h b/clang/include/clang/Analysis/PathSensitive/ExplodedGraph.h
index 1a25565c294..79df895d6c6 100644
--- a/clang/include/clang/Analysis/PathSensitive/ExplodedGraph.h
+++ b/clang/include/clang/Analysis/PathSensitive/ExplodedGraph.h
@@ -226,9 +226,10 @@ protected:
/// cfg - The CFG associated with this analysis graph.
CFG& cfg;
+ // FIXME: Remove.
/// CodeDecl - The declaration containing the code being analyzed. This
/// can be a FunctionDecl or and ObjCMethodDecl.
- Decl& CodeDecl;
+ const Decl& CodeDecl;
/// Ctx - The ASTContext used to "interpret" CodeDecl.
ASTContext& Ctx;
@@ -261,7 +262,7 @@ public:
return V;
}
- ExplodedGraph(CFG& c, Decl& cd, ASTContext& ctx)
+ ExplodedGraph(CFG& c, const Decl &cd, ASTContext& ctx)
: cfg(c), CodeDecl(cd), Ctx(ctx), NumNodes(0) {}
virtual ~ExplodedGraph() {}
@@ -310,7 +311,7 @@ public:
CFG& getCFG() { return cfg; }
ASTContext& getContext() { return Ctx; }
- Decl& getCodeDecl() { return CodeDecl; }
+ // FIXME: Remove.
const Decl& getCodeDecl() const { return CodeDecl; }
const FunctionDecl* getFunctionDecl() const {
diff --git a/clang/include/clang/Analysis/PathSensitive/GRCoreEngine.h b/clang/include/clang/Analysis/PathSensitive/GRCoreEngine.h
index 8d93963e751..ee7a095748f 100644
--- a/clang/include/clang/Analysis/PathSensitive/GRCoreEngine.h
+++ b/clang/include/clang/Analysis/PathSensitive/GRCoreEngine.h
@@ -98,7 +98,8 @@ private:
public:
/// Construct a GRCoreEngine object to analyze the provided CFG using
/// a DFS exploration of the exploded graph.
- GRCoreEngine(CFG& cfg, Decl& cd, ASTContext& ctx, GRSubEngine& subengine)
+ GRCoreEngine(CFG& cfg, const Decl &cd, ASTContext& ctx,
+ GRSubEngine& subengine)
: SubEngine(subengine), G(new ExplodedGraph(cfg, cd, ctx)),
WList(GRWorkList::MakeBFS()),
BCounterFactory(G->getAllocator()) {}
@@ -106,7 +107,7 @@ public:
/// Construct a GRCoreEngine object to analyze the provided CFG and to
/// use the provided worklist object to execute the worklist algorithm.
/// The GRCoreEngine object assumes ownership of 'wlist'.
- GRCoreEngine(CFG& cfg, Decl& cd, ASTContext& ctx, GRWorkList* wlist,
+ GRCoreEngine(CFG& cfg, const Decl &cd, ASTContext& ctx, GRWorkList* wlist,
GRSubEngine& subengine)
: SubEngine(subengine), G(new ExplodedGraph(cfg, cd, ctx)), WList(wlist),
BCounterFactory(G->getAllocator()) {}
diff --git a/clang/include/clang/Analysis/PathSensitive/GRExprEngine.h b/clang/include/clang/Analysis/PathSensitive/GRExprEngine.h
index a651f95b90f..6ca8cf4b7fb 100644
--- a/clang/include/clang/Analysis/PathSensitive/GRExprEngine.h
+++ b/clang/include/clang/Analysis/PathSensitive/GRExprEngine.h
@@ -202,7 +202,7 @@ public:
ErrorNodes ExplicitOOBMemAccesses;
public:
- GRExprEngine(CFG& cfg, Decl& CD, ASTContext& Ctx, LiveVariables& L,
+ GRExprEngine(CFG& cfg, const Decl &CD, ASTContext& Ctx, LiveVariables& L,
AnalysisManager &mgr,
bool purgeDead, bool eagerlyAssume = true,
StoreManagerCreator SMC = CreateBasicStoreManager,
OpenPOWER on IntegriCloud