Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 1 | //=== AnalysisContext.h - Analysis context for Path Sens analysis --*- C++ -*-// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines AnalysisContext, a class that manages the analysis context |
| 11 | // data for path sensitive analysis. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_CLANG_ANALYSIS_ANALYSISCONTEXT_H |
| 16 | #define LLVM_CLANG_ANALYSIS_ANALYSISCONTEXT_H |
| 17 | |
| 18 | #include "clang/AST/Decl.h" |
Ted Kremenek | 892697d | 2010-12-16 07:46:53 +0000 | [diff] [blame] | 19 | #include "clang/AST/Expr.h" |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 20 | #include "llvm/ADT/OwningPtr.h" |
| 21 | #include "llvm/ADT/FoldingSet.h" |
| 22 | #include "llvm/ADT/PointerUnion.h" |
| 23 | #include "llvm/ADT/DenseMap.h" |
| 24 | #include "llvm/Support/Allocator.h" |
| 25 | |
| 26 | namespace clang { |
| 27 | |
| 28 | class Decl; |
| 29 | class Stmt; |
| 30 | class CFG; |
| 31 | class CFGBlock; |
Ted Kremenek | 283a358 | 2011-02-23 01:51:53 +0000 | [diff] [blame^] | 32 | class CFGStmtMap; |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 33 | class LiveVariables; |
| 34 | class ParentMap; |
Tom Care | db34ab7 | 2010-08-23 19:51:57 +0000 | [diff] [blame] | 35 | class PseudoConstantAnalysis; |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 36 | class ImplicitParamDecl; |
| 37 | class LocationContextManager; |
| 38 | class StackFrameContext; |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 39 | |
Zhongxing Xu | c6238d2 | 2010-07-19 01:31:21 +0000 | [diff] [blame] | 40 | namespace idx { class TranslationUnit; } |
| 41 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 42 | /// AnalysisContext contains the context data for the function or method under |
| 43 | /// analysis. |
| 44 | class AnalysisContext { |
| 45 | const Decl *D; |
| 46 | |
Zhongxing Xu | c6238d2 | 2010-07-19 01:31:21 +0000 | [diff] [blame] | 47 | // TranslationUnit is NULL if we don't have multiple translation units. |
Zhongxing Xu | 2ce43c8 | 2010-07-22 13:52:13 +0000 | [diff] [blame] | 48 | idx::TranslationUnit *TU; |
Zhongxing Xu | c6238d2 | 2010-07-19 01:31:21 +0000 | [diff] [blame] | 49 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 50 | // AnalysisContext owns the following data. |
Ted Kremenek | ad5a894 | 2010-08-02 23:46:59 +0000 | [diff] [blame] | 51 | CFG *cfg, *completeCFG; |
Ted Kremenek | 283a358 | 2011-02-23 01:51:53 +0000 | [diff] [blame^] | 52 | CFGStmtMap *cfgStmtMap; |
Ted Kremenek | ad5a894 | 2010-08-02 23:46:59 +0000 | [diff] [blame] | 53 | bool builtCFG, builtCompleteCFG; |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 54 | LiveVariables *liveness; |
Tom Care | ec49bf4 | 2010-08-27 22:30:10 +0000 | [diff] [blame] | 55 | LiveVariables *relaxedLiveness; |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 56 | ParentMap *PM; |
Tom Care | db34ab7 | 2010-08-23 19:51:57 +0000 | [diff] [blame] | 57 | PseudoConstantAnalysis *PCA; |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 58 | llvm::DenseMap<const BlockDecl*,void*> *ReferencedBlockVars; |
| 59 | llvm::BumpPtrAllocator A; |
Ted Kremenek | 9b823e8 | 2010-08-03 00:09:51 +0000 | [diff] [blame] | 60 | bool UseUnoptimizedCFG; |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 61 | bool AddEHEdges; |
Marcin Swiderski | 9121ba2 | 2010-09-30 07:41:24 +0000 | [diff] [blame] | 62 | bool AddImplicitDtors; |
| 63 | bool AddInitializers; |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 64 | public: |
Zhongxing Xu | 2ce43c8 | 2010-07-22 13:52:13 +0000 | [diff] [blame] | 65 | AnalysisContext(const Decl *d, idx::TranslationUnit *tu, |
Ted Kremenek | 9b823e8 | 2010-08-03 00:09:51 +0000 | [diff] [blame] | 66 | bool useUnoptimizedCFG = false, |
Marcin Swiderski | 9121ba2 | 2010-09-30 07:41:24 +0000 | [diff] [blame] | 67 | bool addehedges = false, |
| 68 | bool addImplicitDtors = false, |
| 69 | bool addInitializers = false) |
Ted Kremenek | 283a358 | 2011-02-23 01:51:53 +0000 | [diff] [blame^] | 70 | : D(d), TU(tu), cfg(0), completeCFG(0), cfgStmtMap(0), |
Ted Kremenek | ad5a894 | 2010-08-02 23:46:59 +0000 | [diff] [blame] | 71 | builtCFG(false), builtCompleteCFG(false), |
Tom Care | ec49bf4 | 2010-08-27 22:30:10 +0000 | [diff] [blame] | 72 | liveness(0), relaxedLiveness(0), PM(0), PCA(0), |
Ted Kremenek | 9b823e8 | 2010-08-03 00:09:51 +0000 | [diff] [blame] | 73 | ReferencedBlockVars(0), UseUnoptimizedCFG(useUnoptimizedCFG), |
Marcin Swiderski | 9121ba2 | 2010-09-30 07:41:24 +0000 | [diff] [blame] | 74 | AddEHEdges(addehedges), AddImplicitDtors(addImplicitDtors), |
| 75 | AddInitializers(addInitializers) {} |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 76 | |
| 77 | ~AnalysisContext(); |
| 78 | |
| 79 | ASTContext &getASTContext() { return D->getASTContext(); } |
Zhongxing Xu | c6238d2 | 2010-07-19 01:31:21 +0000 | [diff] [blame] | 80 | const Decl *getDecl() const { return D; } |
| 81 | |
Zhongxing Xu | 2ce43c8 | 2010-07-22 13:52:13 +0000 | [diff] [blame] | 82 | idx::TranslationUnit *getTranslationUnit() const { return TU; } |
Zhongxing Xu | c6238d2 | 2010-07-19 01:31:21 +0000 | [diff] [blame] | 83 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 84 | /// getAddEHEdges - Return true iff we are adding exceptional edges from |
| 85 | /// callExprs. If this is false, then try/catch statements and blocks |
| 86 | /// reachable from them can appear to be dead in the CFG, analysis passes must |
| 87 | /// cope with that. |
| 88 | bool getAddEHEdges() const { return AddEHEdges; } |
Ted Kremenek | 9b823e8 | 2010-08-03 00:09:51 +0000 | [diff] [blame] | 89 | |
| 90 | bool getUseUnoptimizedCFG() const { return UseUnoptimizedCFG; } |
Marcin Swiderski | 9121ba2 | 2010-09-30 07:41:24 +0000 | [diff] [blame] | 91 | bool getAddImplicitDtors() const { return AddImplicitDtors; } |
| 92 | bool getAddInitializers() const { return AddInitializers; } |
Ted Kremenek | 9b823e8 | 2010-08-03 00:09:51 +0000 | [diff] [blame] | 93 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 94 | Stmt *getBody(); |
| 95 | CFG *getCFG(); |
Ted Kremenek | 283a358 | 2011-02-23 01:51:53 +0000 | [diff] [blame^] | 96 | |
| 97 | CFGStmtMap *getCFGStmtMap(); |
Anders Carlsson | 04eeba4 | 2011-01-16 22:05:23 +0000 | [diff] [blame] | 98 | |
Ted Kremenek | ad5a894 | 2010-08-02 23:46:59 +0000 | [diff] [blame] | 99 | /// Return a version of the CFG without any edges pruned. |
| 100 | CFG *getUnoptimizedCFG(); |
| 101 | |
Anders Carlsson | 04eeba4 | 2011-01-16 22:05:23 +0000 | [diff] [blame] | 102 | void dumpCFG(); |
| 103 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 104 | ParentMap &getParentMap(); |
Tom Care | db34ab7 | 2010-08-23 19:51:57 +0000 | [diff] [blame] | 105 | PseudoConstantAnalysis *getPseudoConstantAnalysis(); |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 106 | LiveVariables *getLiveVariables(); |
Tom Care | ec49bf4 | 2010-08-27 22:30:10 +0000 | [diff] [blame] | 107 | LiveVariables *getRelaxedLiveVariables(); |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 108 | |
| 109 | typedef const VarDecl * const * referenced_decls_iterator; |
| 110 | |
| 111 | std::pair<referenced_decls_iterator, referenced_decls_iterator> |
| 112 | getReferencedBlockVars(const BlockDecl *BD); |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 113 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 114 | /// Return the ImplicitParamDecl* associated with 'self' if this |
| 115 | /// AnalysisContext wraps an ObjCMethodDecl. Returns NULL otherwise. |
| 116 | const ImplicitParamDecl *getSelfDecl() const; |
| 117 | }; |
| 118 | |
| 119 | class AnalysisContextManager { |
| 120 | typedef llvm::DenseMap<const Decl*, AnalysisContext*> ContextMap; |
| 121 | ContextMap Contexts; |
Ted Kremenek | 9b823e8 | 2010-08-03 00:09:51 +0000 | [diff] [blame] | 122 | bool UseUnoptimizedCFG; |
Marcin Swiderski | 9121ba2 | 2010-09-30 07:41:24 +0000 | [diff] [blame] | 123 | bool AddImplicitDtors; |
| 124 | bool AddInitializers; |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 125 | public: |
Marcin Swiderski | 9121ba2 | 2010-09-30 07:41:24 +0000 | [diff] [blame] | 126 | AnalysisContextManager(bool useUnoptimizedCFG = false, |
| 127 | bool addImplicitDtors = false, bool addInitializers = false) |
| 128 | : UseUnoptimizedCFG(useUnoptimizedCFG), AddImplicitDtors(addImplicitDtors), |
| 129 | AddInitializers(addInitializers) {} |
Ted Kremenek | 9b823e8 | 2010-08-03 00:09:51 +0000 | [diff] [blame] | 130 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 131 | ~AnalysisContextManager(); |
| 132 | |
Zhongxing Xu | 2ce43c8 | 2010-07-22 13:52:13 +0000 | [diff] [blame] | 133 | AnalysisContext *getContext(const Decl *D, idx::TranslationUnit *TU = 0); |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 134 | |
Ted Kremenek | 9b823e8 | 2010-08-03 00:09:51 +0000 | [diff] [blame] | 135 | bool getUseUnoptimizedCFG() const { return UseUnoptimizedCFG; } |
Marcin Swiderski | 9121ba2 | 2010-09-30 07:41:24 +0000 | [diff] [blame] | 136 | bool getAddImplicitDtors() const { return AddImplicitDtors; } |
| 137 | bool getAddInitializers() const { return AddInitializers; } |
Ted Kremenek | 9b823e8 | 2010-08-03 00:09:51 +0000 | [diff] [blame] | 138 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 139 | // Discard all previously created AnalysisContexts. |
| 140 | void clear(); |
| 141 | }; |
| 142 | |
| 143 | class LocationContext : public llvm::FoldingSetNode { |
| 144 | public: |
| 145 | enum ContextKind { StackFrame, Scope, Block }; |
| 146 | |
| 147 | private: |
| 148 | ContextKind Kind; |
Zhongxing Xu | a02d893 | 2010-07-20 02:14:22 +0000 | [diff] [blame] | 149 | |
| 150 | // AnalysisContext can't be const since some methods may modify its member. |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 151 | AnalysisContext *Ctx; |
Zhongxing Xu | a02d893 | 2010-07-20 02:14:22 +0000 | [diff] [blame] | 152 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 153 | const LocationContext *Parent; |
| 154 | |
| 155 | protected: |
| 156 | LocationContext(ContextKind k, AnalysisContext *ctx, |
| 157 | const LocationContext *parent) |
| 158 | : Kind(k), Ctx(ctx), Parent(parent) {} |
| 159 | |
| 160 | public: |
| 161 | virtual ~LocationContext(); |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 162 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 163 | ContextKind getKind() const { return Kind; } |
| 164 | |
| 165 | AnalysisContext *getAnalysisContext() const { return Ctx; } |
| 166 | |
Zhongxing Xu | 2ce43c8 | 2010-07-22 13:52:13 +0000 | [diff] [blame] | 167 | idx::TranslationUnit *getTranslationUnit() const { |
Zhongxing Xu | c6238d2 | 2010-07-19 01:31:21 +0000 | [diff] [blame] | 168 | return Ctx->getTranslationUnit(); |
| 169 | } |
| 170 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 171 | const LocationContext *getParent() const { return Parent; } |
| 172 | |
Zhongxing Xu | 8ddf7ce | 2010-02-17 08:45:06 +0000 | [diff] [blame] | 173 | bool isParentOf(const LocationContext *LC) const; |
| 174 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 175 | const Decl *getDecl() const { return getAnalysisContext()->getDecl(); } |
| 176 | |
| 177 | CFG *getCFG() const { return getAnalysisContext()->getCFG(); } |
| 178 | |
| 179 | LiveVariables *getLiveVariables() const { |
| 180 | return getAnalysisContext()->getLiveVariables(); |
| 181 | } |
| 182 | |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 183 | ParentMap &getParentMap() const { |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 184 | return getAnalysisContext()->getParentMap(); |
| 185 | } |
| 186 | |
| 187 | const ImplicitParamDecl *getSelfDecl() const { |
| 188 | return Ctx->getSelfDecl(); |
| 189 | } |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 190 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 191 | const StackFrameContext *getCurrentStackFrame() const; |
| 192 | const StackFrameContext * |
| 193 | getStackFrameForDeclContext(const DeclContext *DC) const; |
| 194 | |
| 195 | virtual void Profile(llvm::FoldingSetNodeID &ID) = 0; |
| 196 | |
| 197 | static bool classof(const LocationContext*) { return true; } |
| 198 | |
| 199 | public: |
| 200 | static void ProfileCommon(llvm::FoldingSetNodeID &ID, |
| 201 | ContextKind ck, |
| 202 | AnalysisContext *ctx, |
| 203 | const LocationContext *parent, |
| 204 | const void* data); |
| 205 | }; |
| 206 | |
| 207 | class StackFrameContext : public LocationContext { |
Zhongxing Xu | 26c9cb5 | 2011-01-10 11:28:29 +0000 | [diff] [blame] | 208 | // The callsite where this stack frame is established. |
Ted Kremenek | 892697d | 2010-12-16 07:46:53 +0000 | [diff] [blame] | 209 | const Stmt *CallSite; |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 210 | |
| 211 | // The parent block of the callsite. |
| 212 | const CFGBlock *Block; |
| 213 | |
| 214 | // The index of the callsite in the CFGBlock. |
| 215 | unsigned Index; |
| 216 | |
| 217 | friend class LocationContextManager; |
| 218 | StackFrameContext(AnalysisContext *ctx, const LocationContext *parent, |
Ted Kremenek | 892697d | 2010-12-16 07:46:53 +0000 | [diff] [blame] | 219 | const Stmt *s, const CFGBlock *blk, |
Zhongxing Xu | d706434 | 2010-11-24 13:08:51 +0000 | [diff] [blame] | 220 | unsigned idx) |
Ted Kremenek | 892697d | 2010-12-16 07:46:53 +0000 | [diff] [blame] | 221 | : LocationContext(StackFrame, ctx, parent), CallSite(s), |
Zhongxing Xu | d706434 | 2010-11-24 13:08:51 +0000 | [diff] [blame] | 222 | Block(blk), Index(idx) {} |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 223 | |
| 224 | public: |
| 225 | ~StackFrameContext() {} |
| 226 | |
Ted Kremenek | 892697d | 2010-12-16 07:46:53 +0000 | [diff] [blame] | 227 | const Stmt *getCallSite() const { return CallSite; } |
Zhongxing Xu | d706434 | 2010-11-24 13:08:51 +0000 | [diff] [blame] | 228 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 229 | const CFGBlock *getCallSiteBlock() const { return Block; } |
| 230 | |
| 231 | unsigned getIndex() const { return Index; } |
| 232 | |
| 233 | void Profile(llvm::FoldingSetNodeID &ID); |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 234 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 235 | static void Profile(llvm::FoldingSetNodeID &ID, AnalysisContext *ctx, |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 236 | const LocationContext *parent, const Stmt *s, |
Ted Kremenek | 892697d | 2010-12-16 07:46:53 +0000 | [diff] [blame] | 237 | const CFGBlock *blk, unsigned idx) { |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 238 | ProfileCommon(ID, StackFrame, ctx, parent, s); |
| 239 | ID.AddPointer(blk); |
| 240 | ID.AddInteger(idx); |
| 241 | } |
| 242 | |
| 243 | static bool classof(const LocationContext* Ctx) { |
| 244 | return Ctx->getKind() == StackFrame; |
| 245 | } |
| 246 | }; |
| 247 | |
| 248 | class ScopeContext : public LocationContext { |
| 249 | const Stmt *Enter; |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 250 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 251 | friend class LocationContextManager; |
| 252 | ScopeContext(AnalysisContext *ctx, const LocationContext *parent, |
| 253 | const Stmt *s) |
| 254 | : LocationContext(Scope, ctx, parent), Enter(s) {} |
| 255 | |
| 256 | public: |
| 257 | ~ScopeContext() {} |
| 258 | |
| 259 | void Profile(llvm::FoldingSetNodeID &ID); |
| 260 | |
| 261 | static void Profile(llvm::FoldingSetNodeID &ID, AnalysisContext *ctx, |
| 262 | const LocationContext *parent, const Stmt *s) { |
| 263 | ProfileCommon(ID, Scope, ctx, parent, s); |
| 264 | } |
| 265 | |
| 266 | static bool classof(const LocationContext* Ctx) { |
| 267 | return Ctx->getKind() == Scope; |
| 268 | } |
| 269 | }; |
| 270 | |
| 271 | class BlockInvocationContext : public LocationContext { |
| 272 | // FIXME: Add back context-sensivity (we don't want libAnalysis to know |
| 273 | // about MemRegion). |
| 274 | const BlockDecl *BD; |
| 275 | |
| 276 | friend class LocationContextManager; |
| 277 | |
| 278 | BlockInvocationContext(AnalysisContext *ctx, const LocationContext *parent, |
| 279 | const BlockDecl *bd) |
| 280 | : LocationContext(Block, ctx, parent), BD(bd) {} |
| 281 | |
| 282 | public: |
| 283 | ~BlockInvocationContext() {} |
| 284 | |
| 285 | const BlockDecl *getBlockDecl() const { return BD; } |
| 286 | |
| 287 | void Profile(llvm::FoldingSetNodeID &ID); |
| 288 | |
| 289 | static void Profile(llvm::FoldingSetNodeID &ID, AnalysisContext *ctx, |
| 290 | const LocationContext *parent, const BlockDecl *bd) { |
| 291 | ProfileCommon(ID, Block, ctx, parent, bd); |
| 292 | } |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 293 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 294 | static bool classof(const LocationContext* Ctx) { |
| 295 | return Ctx->getKind() == Block; |
| 296 | } |
| 297 | }; |
| 298 | |
| 299 | class LocationContextManager { |
| 300 | llvm::FoldingSet<LocationContext> Contexts; |
| 301 | public: |
| 302 | ~LocationContextManager(); |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 303 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 304 | const StackFrameContext *getStackFrame(AnalysisContext *ctx, |
| 305 | const LocationContext *parent, |
Ted Kremenek | 892697d | 2010-12-16 07:46:53 +0000 | [diff] [blame] | 306 | const Stmt *s, |
Zhongxing Xu | d706434 | 2010-11-24 13:08:51 +0000 | [diff] [blame] | 307 | const CFGBlock *blk, unsigned idx); |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 308 | |
| 309 | const ScopeContext *getScope(AnalysisContext *ctx, |
| 310 | const LocationContext *parent, |
| 311 | const Stmt *s); |
Ted Kremenek | d064fdc | 2010-03-23 00:13:23 +0000 | [diff] [blame] | 312 | |
Ted Kremenek | 326be56 | 2010-01-25 05:19:37 +0000 | [diff] [blame] | 313 | /// Discard all previously created LocationContext objects. |
| 314 | void clear(); |
| 315 | private: |
| 316 | template <typename LOC, typename DATA> |
| 317 | const LOC *getLocationContext(AnalysisContext *ctx, |
| 318 | const LocationContext *parent, |
| 319 | const DATA *d); |
| 320 | }; |
| 321 | |
| 322 | } // end clang namespace |
| 323 | #endif |