1d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis//===-- ExprEngine.h - Path-Sensitive Expression-Level Dataflow ---*- C++ -*-=//
277349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek//
377349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek//                     The LLVM Compiler Infrastructure
477349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek//
577349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek// This file is distributed under the University of Illinois Open Source
677349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek// License. See LICENSE.TXT for details.
777349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek//
877349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek//===----------------------------------------------------------------------===//
977349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek//
10b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek//  This file defines a meta-engine for path-sensitive dataflow analysis that
11d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis//  is built on CoreEngine, but provides the boilerplate to execute transfer
12b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek//  functions and build the ExplodedGraph at the expression level.
1377349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek//
1477349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek//===----------------------------------------------------------------------===//
1577349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek
16d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis#ifndef LLVM_CLANG_GR_EXPRENGINE
17d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis#define LLVM_CLANG_GR_EXPRENGINE
18d065d6080f0620bb80b933f3f5d52d37bb2ea770Ted Kremenek
1930a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth#include "clang/AST/Expr.h"
2030a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth#include "clang/AST/Type.h"
214ef19205b6912316296db74a9073ad6fa60e4ccaTed Kremenek#include "clang/Analysis/DomainSpecific/ObjCNoReturn.h"
2230a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
239b663716449b618ba0390b1dbebc54fa8e971124Ted Kremenek#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
249b663716449b618ba0390b1dbebc54fa8e971124Ted Kremenek#include "clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h"
2518c66fdc3c4008d335885695fe36fb5353c5f672Ted Kremenek#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
265903a373db3d27794c90b25687e0dd6adb0e497dAnna Zaks#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
2730a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth#include "clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h"
2877349cb20bfd7069d081f84c91975bfa8ef60a32Ted Kremenek
291eb4433ac451dc16f4133a88af2d002ac26c58efMike Stumpnamespace clang {
305a4f98ff943e6a501b0fe47ade007c9bbf96cb88Argyrios Kyrtzidis
311d26f48dc2eea1c07431ca1519d7034a21b9bcffTed Kremenekclass AnalysisDeclContextManager;
32337e4dbc6859589b8878146a88bebf754e916702Ted Kremenekclass CXXCatchStmt;
33c35fb7d67d515659ad2325b4f6ec97c9fe64fb63Benjamin Kramerclass CXXConstructExpr;
34c35fb7d67d515659ad2325b4f6ec97c9fe64fb63Benjamin Kramerclass CXXDeleteExpr;
35c35fb7d67d515659ad2325b4f6ec97c9fe64fb63Benjamin Kramerclass CXXNewExpr;
36c35fb7d67d515659ad2325b4f6ec97c9fe64fb63Benjamin Kramerclass CXXTemporaryObjectExpr;
37c35fb7d67d515659ad2325b4f6ec97c9fe64fb63Benjamin Kramerclass CXXThisExpr;
38c35fb7d67d515659ad2325b4f6ec97c9fe64fb63Benjamin Kramerclass MaterializeTemporaryExpr;
39c35fb7d67d515659ad2325b4f6ec97c9fe64fb63Benjamin Kramerclass ObjCAtSynchronizedStmt;
405a4f98ff943e6a501b0fe47ade007c9bbf96cb88Argyrios Kyrtzidisclass ObjCForCollectionStmt;
41b1b5daf30d2597e066936772bd206500232d7d65Ted Kremenek
429ef6537a894c33003359b1f9b9676e9178e028b7Ted Kremeneknamespace ento {
435a4f98ff943e6a501b0fe47ade007c9bbf96cb88Argyrios Kyrtzidis
445e2d2c2ee3cf410643e0f9a5701708e51409d973Benjamin Kramerclass AnalysisManager;
45740d490593e0de8732a697c9f77b90ddd463863bJordan Roseclass CallEvent;
46bc403861bc4e6f7ad1371e9e129f0f25b38b3a9aJordan Roseclass CXXConstructorCall;
47f494b579b22f9950f5af021f0bf9879a91bb8b41Steve Naroff
48d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidisclass ExprEngine : public SubEngine {
4975f31c4862643ab09479c979fabf754e7ffe1460Anna Zakspublic:
508a660eb1084294a903f6dcc00bf2fa4e3bc92cfcAnna Zaks  /// The modes of inlining, which override the default analysis-wide settings.
5175f31c4862643ab09479c979fabf754e7ffe1460Anna Zaks  enum InliningModes {
528a660eb1084294a903f6dcc00bf2fa4e3bc92cfcAnna Zaks    /// Follow the default settings for inlining callees.
538a660eb1084294a903f6dcc00bf2fa4e3bc92cfcAnna Zaks    Inline_Regular = 0,
548a660eb1084294a903f6dcc00bf2fa4e3bc92cfcAnna Zaks    /// Do minimal inlining of callees.
558a660eb1084294a903f6dcc00bf2fa4e3bc92cfcAnna Zaks    Inline_Minimal = 0x1
568a660eb1084294a903f6dcc00bf2fa4e3bc92cfcAnna Zaks  };
5775f31c4862643ab09479c979fabf754e7ffe1460Anna Zaks
5875f31c4862643ab09479c979fabf754e7ffe1460Anna Zaksprivate:
5925e695b2d574d919cc1bbddf3a2efe073d449b1cZhongxing Xu  AnalysisManager &AMgr;
60b1b5daf30d2597e066936772bd206500232d7d65Ted Kremenek
611d26f48dc2eea1c07431ca1519d7034a21b9bcffTed Kremenek  AnalysisDeclContextManager &AnalysisDeclContexts;
6225e695b2d574d919cc1bbddf3a2efe073d449b1cZhongxing Xu
63d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis  CoreEngine Engine;
641eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
65b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// G - the simulation graph.
66031ccc0555a82afc2e8afe29e19dd57ff204e2deZhongxing Xu  ExplodedGraph& G;
671eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
68b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// StateMgr - Object that manages the data for all created states.
6918c66fdc3c4008d335885695fe36fb5353c5f672Ted Kremenek  ProgramStateManager StateMgr;
70cf118d41f7930a18dce97416ef7834a62642f587Ted Kremenek
71b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// SymMgr - Object that manages the symbol information.
72b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  SymbolManager& SymMgr;
731eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
74846eabd187be4bfe992e8bca131166b734d86e0dTed Kremenek  /// svalBuilder - SValBuilder object that creates SVals from expressions.
75846eabd187be4bfe992e8bca131166b734d86e0dTed Kremenek  SValBuilder &svalBuilder;
761eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
7766c486f275531df6362b3511fc3af6563561801bTed Kremenek  unsigned int currStmtIdx;
7866c486f275531df6362b3511fc3af6563561801bTed Kremenek  const NodeBuilderContext *currBldrCtx;
794ef19205b6912316296db74a9073ad6fa60e4ccaTed Kremenek
804ef19205b6912316296db74a9073ad6fa60e4ccaTed Kremenek  /// Helper object to determine if an Objective-C message expression
814ef19205b6912316296db74a9073ad6fa60e4ccaTed Kremenek  /// implicitly never returns.
824ef19205b6912316296db74a9073ad6fa60e4ccaTed Kremenek  ObjCNoReturn ObjCNoRet;
8317a38e2636a8b1ce473fc6504c4b16cb09db29f4Jordy Rose
8417a38e2636a8b1ce473fc6504c4b16cb09db29f4Jordy Rose  /// Whether or not GC is enabled in this analysis.
8517a38e2636a8b1ce473fc6504c4b16cb09db29f4Jordy Rose  bool ObjCGCEnabled;
861eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
879e9595b12e9b55586c4d50d370f429c7a3c92a90Ted Kremenek  /// The BugReporter associated with this engine.  It is important that
889e9595b12e9b55586c4d50d370f429c7a3c92a90Ted Kremenek  ///  this object be placed at the very end of member variables so that its
89d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis  ///  destructor is called before the rest of the ExprEngine is destroyed.
90cf118d41f7930a18dce97416ef7834a62642f587Ted Kremenek  GRBugReporter BR;
911eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
92fbcb3f11fc90e9f00e6074e9b118b8dc11ca604cAnna Zaks  /// The functions which have been analyzed through inlining. This is owned by
93fbcb3f11fc90e9f00e6074e9b118b8dc11ca604cAnna Zaks  /// AnalysisConsumer. It can be null.
94fbcb3f11fc90e9f00e6074e9b118b8dc11ca604cAnna Zaks  SetOfConstDecls *VisitedCallees;
95fbcb3f11fc90e9f00e6074e9b118b8dc11ca604cAnna Zaks
9675f31c4862643ab09479c979fabf754e7ffe1460Anna Zaks  /// The flag, which specifies the mode of inlining for the engine.
9775f31c4862643ab09479c979fabf754e7ffe1460Anna Zaks  InliningModes HowToInline;
9875f31c4862643ab09479c979fabf754e7ffe1460Anna Zaks
99b22d589e2ccd09cada0bcea136f0966883a8bb11Ted Kremenekpublic:
1006a86082f3a06a2dcceaaf63f78a0e52d64bcbaa3Anna Zaks  ExprEngine(AnalysisManager &mgr, bool gcEnabled,
101fbcb3f11fc90e9f00e6074e9b118b8dc11ca604cAnna Zaks             SetOfConstDecls *VisitedCalleesIn,
10275f31c4862643ab09479c979fabf754e7ffe1460Anna Zaks             FunctionSummariesTy *FS,
10375f31c4862643ab09479c979fabf754e7ffe1460Anna Zaks             InliningModes HowToInlineIn);
104cf118d41f7930a18dce97416ef7834a62642f587Ted Kremenek
105d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis  ~ExprEngine();
1061eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
107253955ca25c7e7049963b5db613c0cd15d66e4f8Anna Zaks  /// Returns true if there is still simulation state on the worklist.
108253955ca25c7e7049963b5db613c0cd15d66e4f8Anna Zaks  bool ExecuteWorkList(const LocationContext *L, unsigned Steps = 150000) {
1096bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines    return Engine.ExecuteWorkList(L, Steps, nullptr);
1102ce43c8f43254a9edea53a20dc0e69195bc82ae0Zhongxing Xu  }
1112ce43c8f43254a9edea53a20dc0e69195bc82ae0Zhongxing Xu
1122ce43c8f43254a9edea53a20dc0e69195bc82ae0Zhongxing Xu  /// Execute the work list with an initial state. Nodes that reaches the exit
1132ce43c8f43254a9edea53a20dc0e69195bc82ae0Zhongxing Xu  /// of the function are added into the Dst set, which represent the exit
114253955ca25c7e7049963b5db613c0cd15d66e4f8Anna Zaks  /// state of the function call. Returns true if there is still simulation
115253955ca25c7e7049963b5db613c0cd15d66e4f8Anna Zaks  /// state on the worklist.
116253955ca25c7e7049963b5db613c0cd15d66e4f8Anna Zaks  bool ExecuteWorkListWithInitialState(const LocationContext *L, unsigned Steps,
1178bef8238181a30e52dea380789a7e2d760eac532Ted Kremenek                                       ProgramStateRef InitState,
1182ce43c8f43254a9edea53a20dc0e69195bc82ae0Zhongxing Xu                                       ExplodedNodeSet &Dst) {
119253955ca25c7e7049963b5db613c0cd15d66e4f8Anna Zaks    return Engine.ExecuteWorkListWithInitialState(L, Steps, InitState, Dst);
120b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  }
1211eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
122b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// getContext - Return the ASTContext associated with this analysis.
1239c378f705405d37f49795d5e915989de774fe11fTed Kremenek  ASTContext &getContext() const { return AMgr.getASTContext(); }
1245032ffe4259e7d436f2eb19e5a29fdae559e7c12Zhongxing Xu
125651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  AnalysisManager &getAnalysisManager() override { return AMgr; }
1261eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
127769ce3e93ad35bd9ac28e4d8b8f035ae4fd9a5b5Argyrios Kyrtzidis  CheckerManager &getCheckerManager() const {
128769ce3e93ad35bd9ac28e4d8b8f035ae4fd9a5b5Argyrios Kyrtzidis    return *AMgr.getCheckerManager();
129769ce3e93ad35bd9ac28e4d8b8f035ae4fd9a5b5Argyrios Kyrtzidis  }
130769ce3e93ad35bd9ac28e4d8b8f035ae4fd9a5b5Argyrios Kyrtzidis
131846eabd187be4bfe992e8bca131166b734d86e0dTed Kremenek  SValBuilder &getSValBuilder() { return svalBuilder; }
1321eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
133cf118d41f7930a18dce97416ef7834a62642f587Ted Kremenek  BugReporter& getBugReporter() { return BR; }
1341eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1351aae01a8308d2f8e31adab3f4d7ac35543aac680Anna Zaks  const NodeBuilderContext &getBuilderContext() {
13666c486f275531df6362b3511fc3af6563561801bTed Kremenek    assert(currBldrCtx);
13766c486f275531df6362b3511fc3af6563561801bTed Kremenek    return *currBldrCtx;
1381aae01a8308d2f8e31adab3f4d7ac35543aac680Anna Zaks  }
139ec9227fea66c3439991fc84b0d33b0a8b4b8875eZhongxing Xu
14017a38e2636a8b1ce473fc6504c4b16cb09db29f4Jordy Rose  bool isObjCGCEnabled() { return ObjCGCEnabled; }
1411eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
142ebae6d0209e1ec3d5ea14f9e63bd0d740218ed14Anna Zaks  const Stmt *getStmt() const;
143ebae6d0209e1ec3d5ea14f9e63bd0d740218ed14Anna Zaks
144ebae6d0209e1ec3d5ea14f9e63bd0d740218ed14Anna Zaks  void GenerateAutoTransition(ExplodedNode *N);
145af498a28797c075c48d7e943df5f5a8e78ed8eb0Anna Zaks  void enqueueEndOfPath(ExplodedNodeSet &S);
146af498a28797c075c48d7e943df5f5a8e78ed8eb0Anna Zaks  void GenerateCallExitNode(ExplodedNode *N);
147ebae6d0209e1ec3d5ea14f9e63bd0d740218ed14Anna Zaks
148c9963132736782d0c9178c744b3e2307cfb98a08Jordan Rose  /// Visualize the ExplodedGraph created by executing the simulation.
149ffe0f43806d4823271c2406c1fccc2373115c36aTed Kremenek  void ViewGraph(bool trim = false);
1501eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
151c9963132736782d0c9178c744b3e2307cfb98a08Jordan Rose  /// Visualize a trimmed ExplodedGraph that only contains paths to the given
152c9963132736782d0c9178c744b3e2307cfb98a08Jordan Rose  /// nodes.
153c9963132736782d0c9178c744b3e2307cfb98a08Jordan Rose  void ViewGraph(ArrayRef<const ExplodedNode*> Nodes);
1541eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
155b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// getInitialState - Return the initial state used for the root vertex
156b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  ///  in the ExplodedGraph.
157651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  ProgramStateRef getInitialState(const LocationContext *InitLoc) override;
1581eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
159031ccc0555a82afc2e8afe29e19dd57ff204e2deZhongxing Xu  ExplodedGraph& getGraph() { return G; }
160031ccc0555a82afc2e8afe29e19dd57ff204e2deZhongxing Xu  const ExplodedGraph& getGraph() const { return G; }
16150a6d0ce344c02782e0207574005c3b2aaa5077cTed Kremenek
1620b3ade86a1c60cf0c7b56aa238aff458eb7f5974Anna Zaks  /// \brief Run the analyzer's garbage collection - remove dead symbols and
16384c484545c5906ba55143e212b4a5275ab55889fJordan Rose  /// bindings from the state.
1640b3ade86a1c60cf0c7b56aa238aff458eb7f5974Anna Zaks  ///
16584c484545c5906ba55143e212b4a5275ab55889fJordan Rose  /// Checkers can participate in this process with two callbacks:
16684c484545c5906ba55143e212b4a5275ab55889fJordan Rose  /// \c checkLiveSymbols and \c checkDeadSymbols. See the CheckerDocumentation
16784c484545c5906ba55143e212b4a5275ab55889fJordan Rose  /// class for more information.
16884c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///
16984c484545c5906ba55143e212b4a5275ab55889fJordan Rose  /// \param Node The predecessor node, from which the processing should start.
17084c484545c5906ba55143e212b4a5275ab55889fJordan Rose  /// \param Out The returned set of output nodes.
17184c484545c5906ba55143e212b4a5275ab55889fJordan Rose  /// \param ReferenceStmt The statement which is about to be processed.
17284c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        Everything needed for this statement should be considered live.
17384c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        A null statement means that everything in child LocationContexts
17484c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        is dead.
17584c484545c5906ba55143e212b4a5275ab55889fJordan Rose  /// \param LC The location context of the \p ReferenceStmt. A null location
17684c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        context means that we have reached the end of analysis and that
17784c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        all statements and local variables should be considered dead.
17884c484545c5906ba55143e212b4a5275ab55889fJordan Rose  /// \param DiagnosticStmt Used as a location for any warnings that should
17984c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        occur while removing the dead (e.g. leaks). By default, the
18084c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        \p ReferenceStmt is used.
18184c484545c5906ba55143e212b4a5275ab55889fJordan Rose  /// \param K Denotes whether this is a pre- or post-statement purge. This
18284c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        must only be ProgramPoint::PostStmtPurgeDeadSymbolsKind if an
18384c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        entire location context is being cleared, in which case the
18484c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        \p ReferenceStmt must either be a ReturnStmt or \c NULL. Otherwise,
18584c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        it must be ProgramPoint::PreStmtPurgeDeadSymbolsKind (the default)
18684c484545c5906ba55143e212b4a5275ab55889fJordan Rose  ///        and \p ReferenceStmt must be valid (non-null).
1870b3ade86a1c60cf0c7b56aa238aff458eb7f5974Anna Zaks  void removeDead(ExplodedNode *Node, ExplodedNodeSet &Out,
18884c484545c5906ba55143e212b4a5275ab55889fJordan Rose            const Stmt *ReferenceStmt, const LocationContext *LC,
1896bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines            const Stmt *DiagnosticStmt = nullptr,
1900b3ade86a1c60cf0c7b56aa238aff458eb7f5974Anna Zaks            ProgramPoint::Kind K = ProgramPoint::PreStmtPurgeDeadSymbolsKind);
1910b3ade86a1c60cf0c7b56aa238aff458eb7f5974Anna Zaks
192e36de1fe51c39d9161915dd3dbef880954af6476Ted Kremenek  /// processCFGElement - Called by CoreEngine. Used to generate new successor
1939c6cd67ea416bace666d614c84d5531124287653Zhongxing Xu  ///  nodes by processing the 'effects' of a CFG element.
194ebae6d0209e1ec3d5ea14f9e63bd0d740218ed14Anna Zaks  void processCFGElement(const CFGElement E, ExplodedNode *Pred,
195651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                         unsigned StmtIdx, NodeBuilderContext *Ctx) override;
1969c6cd67ea416bace666d614c84d5531124287653Zhongxing Xu
197ebae6d0209e1ec3d5ea14f9e63bd0d740218ed14Anna Zaks  void ProcessStmt(const CFGStmt S, ExplodedNode *Pred);
1989c6cd67ea416bace666d614c84d5531124287653Zhongxing Xu
199ebae6d0209e1ec3d5ea14f9e63bd0d740218ed14Anna Zaks  void ProcessInitializer(const CFGInitializer I, ExplodedNode *Pred);
2009c6cd67ea416bace666d614c84d5531124287653Zhongxing Xu
201ebae6d0209e1ec3d5ea14f9e63bd0d740218ed14Anna Zaks  void ProcessImplicitDtor(const CFGImplicitDtor D, ExplodedNode *Pred);
2021eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
203651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  void ProcessNewAllocator(const CXXNewExpr *NE, ExplodedNode *Pred);
204651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines
205651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  void ProcessAutomaticObjDtor(const CFGAutomaticObjDtor D,
206056c4b46335a3bd2612414735d5749ee159c0165Anna Zaks                               ExplodedNode *Pred, ExplodedNodeSet &Dst);
20736d558d85653315edb389677e995ec9ccdbfbf3dJordan Rose  void ProcessDeleteDtor(const CFGDeleteDtor D,
20836d558d85653315edb389677e995ec9ccdbfbf3dJordan Rose                         ExplodedNode *Pred, ExplodedNodeSet &Dst);
209056c4b46335a3bd2612414735d5749ee159c0165Anna Zaks  void ProcessBaseDtor(const CFGBaseDtor D,
210056c4b46335a3bd2612414735d5749ee159c0165Anna Zaks                       ExplodedNode *Pred, ExplodedNodeSet &Dst);
211056c4b46335a3bd2612414735d5749ee159c0165Anna Zaks  void ProcessMemberDtor(const CFGMemberDtor D,
212056c4b46335a3bd2612414735d5749ee159c0165Anna Zaks                         ExplodedNode *Pred, ExplodedNodeSet &Dst);
2134ffcb9974c6b7142c4a1483abfcb1f88b6371c45Zhongxing Xu  void ProcessTemporaryDtor(const CFGTemporaryDtor D,
214056c4b46335a3bd2612414735d5749ee159c0165Anna Zaks                            ExplodedNode *Pred, ExplodedNodeSet &Dst);
2154ffcb9974c6b7142c4a1483abfcb1f88b6371c45Zhongxing Xu
21627c54e57c4a012dcdf2b40cf985b70d0b9caa69eTed Kremenek  /// Called by CoreEngine when processing the entrance of a CFGBlock.
217651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  void processCFGBlockEntrance(const BlockEdge &L,
218651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                               NodeBuilderWithSinks &nodeBuilder,
219651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                               ExplodedNode *Pred) override;
220651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines
221d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis  /// ProcessBranch - Called by CoreEngine.  Used to generate successor
222b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  ///  nodes by processing the 'effects' of a branch condition.
2239c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void processBranch(const Stmt *Condition, const Stmt *Term,
224a19f4af7a94835ce4693bfe12d6270754e79eb56Anna Zaks                     NodeBuilderContext& BuilderCtx,
225ad62deeb70e97da6bd514dd390ea1ce6af6ad81dAnna Zaks                     ExplodedNode *Pred,
2261aae01a8308d2f8e31adab3f4d7ac35543aac680Anna Zaks                     ExplodedNodeSet &Dst,
227a19f4af7a94835ce4693bfe12d6270754e79eb56Anna Zaks                     const CFGBlock *DstT,
228651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                     const CFGBlock *DstF) override;
2291eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2300f5c5c60e9806d13f0907cd99d7204ffab0e08f7Ted Kremenek  /// Called by CoreEngine.  Used to processing branching behavior
2310f5c5c60e9806d13f0907cd99d7204ffab0e08f7Ted Kremenek  /// at static initalizers.
2320f5c5c60e9806d13f0907cd99d7204ffab0e08f7Ted Kremenek  void processStaticInitializer(const DeclStmt *DS,
2330f5c5c60e9806d13f0907cd99d7204ffab0e08f7Ted Kremenek                                NodeBuilderContext& BuilderCtx,
2340f5c5c60e9806d13f0907cd99d7204ffab0e08f7Ted Kremenek                                ExplodedNode *Pred,
2350f5c5c60e9806d13f0907cd99d7204ffab0e08f7Ted Kremenek                                ExplodedNodeSet &Dst,
2360f5c5c60e9806d13f0907cd99d7204ffab0e08f7Ted Kremenek                                const CFGBlock *DstT,
237651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                                const CFGBlock *DstF) override;
2380f5c5c60e9806d13f0907cd99d7204ffab0e08f7Ted Kremenek
239e36de1fe51c39d9161915dd3dbef880954af6476Ted Kremenek  /// processIndirectGoto - Called by CoreEngine.  Used to generate successor
240b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  ///  nodes by processing the 'effects' of a computed goto jump.
241651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  void processIndirectGoto(IndirectGotoNodeBuilder& builder) override;
2421eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
243d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis  /// ProcessSwitch - Called by CoreEngine.  Used to generate successor
244b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  ///  nodes by processing the 'effects' of a switch statement.
245651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  void processSwitch(SwitchNodeBuilder& builder) override;
2461eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
247344c77aac25e5d960aced3f45fbaa09853383f6dAnna Zaks  /// Called by CoreEngine.  Used to generate end-of-path
248344c77aac25e5d960aced3f45fbaa09853383f6dAnna Zaks  /// nodes when the control reaches the end of a function.
249b355be838a22a511d078504b2277f70aea52ca85Anna Zaks  void processEndOfFunction(NodeBuilderContext& BC,
250651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                            ExplodedNode *Pred) override;
251102acd5369bbb17c0d6ab868af376671acff7a93Douglas Gregor
2528501b7a1c4c4a9ba0ea6cb8e500e601ef3759debAnna Zaks  /// Remove dead bindings/symbols before exiting a function.
2538501b7a1c4c4a9ba0ea6cb8e500e601ef3759debAnna Zaks  void removeDeadOnEndOfFunction(NodeBuilderContext& BC,
2548501b7a1c4c4a9ba0ea6cb8e500e601ef3759debAnna Zaks                                 ExplodedNode *Pred,
2558501b7a1c4c4a9ba0ea6cb8e500e601ef3759debAnna Zaks                                 ExplodedNodeSet &Dst);
2568501b7a1c4c4a9ba0ea6cb8e500e601ef3759debAnna Zaks
257ccc263b44c62ce3a02f797a3ddb3d6017cf0e5e4Ted Kremenek  /// Generate the entry node of the callee.
258651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  void processCallEnter(CallEnter CE, ExplodedNode *Pred) override;
259102acd5369bbb17c0d6ab868af376671acff7a93Douglas Gregor
2600b3ade86a1c60cf0c7b56aa238aff458eb7f5974Anna Zaks  /// Generate the sequence of nodes that simulate the call exit and the post
2610b3ade86a1c60cf0c7b56aa238aff458eb7f5974Anna Zaks  /// visit for CallExpr.
262651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  void processCallExit(ExplodedNode *Pred) override;
263102acd5369bbb17c0d6ab868af376671acff7a93Douglas Gregor
264d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis  /// Called by CoreEngine when the analysis worklist has terminated.
265651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  void processEndWorklist(bool hasWorkRemaining) override;
266ccc263b44c62ce3a02f797a3ddb3d6017cf0e5e4Ted Kremenek
2679c14953d0c84f7cf5adfb4cd3c0f05a9b1723c1cTed Kremenek  /// evalAssume - Callback function invoked by the ConstraintManager when
26832a58084a4c53e6938dd81bfce224db25a5976d1Ted Kremenek  ///  making assumptions about state values.
269651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  ProgramStateRef processAssume(ProgramStateRef state, SVal cond,
270651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                                bool assumption) override;
2711eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
27218c66fdc3c4008d335885695fe36fb5353c5f672Ted Kremenek  /// wantsRegionChangeUpdate - Called by ProgramStateManager to determine if a
273e36de1fe51c39d9161915dd3dbef880954af6476Ted Kremenek  ///  region change should trigger a processRegionChanges update.
274651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  bool wantsRegionChangeUpdate(ProgramStateRef state) override;
275c2b7dfaad674587cfd220ff447b3710d252130c3Jordy Rose
27618c66fdc3c4008d335885695fe36fb5353c5f672Ted Kremenek  /// processRegionChanges - Called by ProgramStateManager whenever a change is made
277c2b7dfaad674587cfd220ff447b3710d252130c3Jordy Rose  ///  to the store. Used to update checkers that track region values.
2788bef8238181a30e52dea380789a7e2d760eac532Ted Kremenek  ProgramStateRef
2798bef8238181a30e52dea380789a7e2d760eac532Ted Kremenek  processRegionChanges(ProgramStateRef state,
280bf53dfac8195835028bd6347433f7dbebcc29fc1Anna Zaks                       const InvalidatedSymbols *invalidated,
281537716ad8dd10f984b6cfe6985afade1185c5e3cJordy Rose                       ArrayRef<const MemRegion *> ExplicitRegions,
28266c40400e7d6272b0cd675ada18dd62c1f0362c7Anna Zaks                       ArrayRef<const MemRegion *> Regions,
283651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                       const CallEvent *Call) override;
284c2b7dfaad674587cfd220ff447b3710d252130c3Jordy Rose
285dbd658e139b3e0bf084f75feaea8d844af9e319fJordy Rose  /// printState - Called by ProgramStateManager to print checker-specific data.
2868bef8238181a30e52dea380789a7e2d760eac532Ted Kremenek  void printState(raw_ostream &Out, ProgramStateRef State,
287651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                  const char *NL, const char *Sep) override;
288dbd658e139b3e0bf084f75feaea8d844af9e319fJordy Rose
289651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  ProgramStateManager& getStateManager() override { return StateMgr; }
29090e72e4106a0c3efa7575e9f9cba0c775bb54552Zhongxing Xu
29190e72e4106a0c3efa7575e9f9cba0c775bb54552Zhongxing Xu  StoreManager& getStoreManager() { return StateMgr.getStoreManager(); }
2921eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
293a516ce16b472e61924f5dd10d181c3e8330979afTed Kremenek  ConstraintManager& getConstraintManager() {
294a516ce16b472e61924f5dd10d181c3e8330979afTed Kremenek    return StateMgr.getConstraintManager();
295a516ce16b472e61924f5dd10d181c3e8330979afTed Kremenek  }
2961eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
297c8413fd03f73084a5c93028f8b4db619fc388087Ted Kremenek  // FIXME: Remove when we migrate over to just using SValBuilder.
2986297a8ec313c722db50f686fd190842b7ea91118Ted Kremenek  BasicValueFactory& getBasicVals() {
2996297a8ec313c722db50f686fd190842b7ea91118Ted Kremenek    return StateMgr.getBasicVals();
3006297a8ec313c722db50f686fd190842b7ea91118Ted Kremenek  }
3011eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
302044b6f0417cb98741f277602fabf5f07ec9a02c0Ted Kremenek  // FIXME: Remove when we migrate over to just using ValueManager.
30300a3a5f024ac54088ab887712b292171188064f0Ted Kremenek  SymbolManager& getSymbolManager() { return SymMgr; }
30400a3a5f024ac54088ab887712b292171188064f0Ted Kremenek  const SymbolManager& getSymbolManager() const { return SymMgr; }
3051eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
306bc42c533e7d3d946704a49e242939dd232f33072Tom Care  // Functions for external checking of whether we have unfinished work
307422ab7a49a9a4252dbc6350e49d7a5708337b9c7Ted Kremenek  bool wasBlocksExhausted() const { return Engine.wasBlocksExhausted(); }
308d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis  bool hasEmptyWorkList() const { return !Engine.getWorkList()->hasWork(); }
309422ab7a49a9a4252dbc6350e49d7a5708337b9c7Ted Kremenek  bool hasWorkRemaining() const { return Engine.hasWorkRemaining(); }
310bc42c533e7d3d946704a49e242939dd232f33072Tom Care
311d2592a34a059e7cbb2b11dc53649ac4912422909Argyrios Kyrtzidis  const CoreEngine &getCoreEngine() const { return Engine; }
312bc42c533e7d3d946704a49e242939dd232f33072Tom Care
3131670e403c48f3af4fceff3f6773a0e1cfc6c4eb3Ted Kremenekpublic:
314b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// Visit - Transfer function logic for all statements.  Dispatches to
315b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  ///  other functions that handle specific kinds of statements.
3169c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void Visit(const Stmt *S, ExplodedNode *Pred, ExplodedNodeSet &Dst);
3171eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
318c5b1bf10133a8ecbfe9e6b3ec92bae84e3d927e8Ted Kremenek  /// VisitArraySubscriptExpr - Transfer function for array accesses.
3199c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitLvalArraySubscriptExpr(const ArraySubscriptExpr *Ex,
3209c378f705405d37f49795d5e915989de774fe11fTed Kremenek                                   ExplodedNode *Pred,
3219c378f705405d37f49795d5e915989de774fe11fTed Kremenek                                   ExplodedNodeSet &Dst);
3221eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
323df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier  /// VisitGCCAsmStmt - Transfer function logic for inline asm.
324df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier  void VisitGCCAsmStmt(const GCCAsmStmt *A, ExplodedNode *Pred,
325df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier                       ExplodedNodeSet &Dst);
3268cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier
3278cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier  /// VisitMSAsmStmt - Transfer function logic for MS inline asm.
3288cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier  void VisitMSAsmStmt(const MSAsmStmt *A, ExplodedNode *Pred,
3298cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier                      ExplodedNodeSet &Dst);
330df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier
331c95ad9ff6e574aecdd759542d5578bc65d586d93Ted Kremenek  /// VisitBlockExpr - Transfer function logic for BlockExprs.
33203509aea098772644bf4662dc1c88634818ceeccZhongxing Xu  void VisitBlockExpr(const BlockExpr *BE, ExplodedNode *Pred,
33303509aea098772644bf4662dc1c88634818ceeccZhongxing Xu                      ExplodedNodeSet &Dst);
3341eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
335b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// VisitBinaryOperator - Transfer function logic for binary operators.
3369c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitBinaryOperator(const BinaryOperator* B, ExplodedNode *Pred,
3379c378f705405d37f49795d5e915989de774fe11fTed Kremenek                           ExplodedNodeSet &Dst);
338469ecbded3616416ef938ed94a67f86149faf226Ted Kremenek
3391eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
340de43424560f1a744de6214dab6bbee28ad8437f5Ted Kremenek  /// VisitCall - Transfer function for function calls.
3419c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitCallExpr(const CallExpr *CE, ExplodedNode *Pred,
3429c378f705405d37f49795d5e915989de774fe11fTed Kremenek                     ExplodedNodeSet &Dst);
3431eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
344b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// VisitCast - Transfer function logic for all casts (implicit and explicit).
34503509aea098772644bf4662dc1c88634818ceeccZhongxing Xu  void VisitCast(const CastExpr *CastE, const Expr *Ex, ExplodedNode *Pred,
346892697dd2287caf7c29aaaa82909b0e90b8b63feTed Kremenek                ExplodedNodeSet &Dst);
347e1c2a675e0c089e1f53cbd55d2197a8beaa852aeTed Kremenek
3484f09027385466f1f4c382c80ca77157e2aef97d9Ted Kremenek  /// VisitCompoundLiteralExpr - Transfer function logic for compound literals.
3499c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitCompoundLiteralExpr(const CompoundLiteralExpr *CL,
3509c378f705405d37f49795d5e915989de774fe11fTed Kremenek                                ExplodedNode *Pred, ExplodedNodeSet &Dst);
3511eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
352892697dd2287caf7c29aaaa82909b0e90b8b63feTed Kremenek  /// Transfer function logic for DeclRefExprs and BlockDeclRefExprs.
3539c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitCommonDeclRefExpr(const Expr *DR, const NamedDecl *D,
3549c378f705405d37f49795d5e915989de774fe11fTed Kremenek                              ExplodedNode *Pred, ExplodedNodeSet &Dst);
35567d1287035767f4f6c8ca0c2bb755990012a44caTed Kremenek
356b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// VisitDeclStmt - Transfer function logic for DeclStmts.
3579c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitDeclStmt(const DeclStmt *DS, ExplodedNode *Pred,
3589c378f705405d37f49795d5e915989de774fe11fTed Kremenek                     ExplodedNodeSet &Dst);
3591eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
360b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// VisitGuardedExpr - Transfer function logic for ?, __builtin_choose
3619c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitGuardedExpr(const Expr *Ex, const Expr *L, const Expr *R,
3629c378f705405d37f49795d5e915989de774fe11fTed Kremenek                        ExplodedNode *Pred, ExplodedNodeSet &Dst);
36361dfbecd8e6181b2ba42ffb5feede27a2bab3b8aTed Kremenek
3649c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitInitListExpr(const InitListExpr *E, ExplodedNode *Pred,
3659c378f705405d37f49795d5e915989de774fe11fTed Kremenek                         ExplodedNodeSet &Dst);
366c4f8706b6539e06a5de153bd72850bb2e0a71456Zhongxing Xu
367b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// VisitLogicalExpr - Transfer function logic for '&&', '||'
3689c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitLogicalExpr(const BinaryOperator* B, ExplodedNode *Pred,
3699c378f705405d37f49795d5e915989de774fe11fTed Kremenek                        ExplodedNodeSet &Dst);
3701eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
371469ecbded3616416ef938ed94a67f86149faf226Ted Kremenek  /// VisitMemberExpr - Transfer function for member expressions.
3729c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitMemberExpr(const MemberExpr *M, ExplodedNode *Pred,
3739c378f705405d37f49795d5e915989de774fe11fTed Kremenek                           ExplodedNodeSet &Dst);
3741eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
3754beaa9f51b2da57c64740cef2bd1c2fdb0c325d5Ted Kremenek  /// Transfer function logic for ObjCAtSynchronizedStmts.
3764beaa9f51b2da57c64740cef2bd1c2fdb0c325d5Ted Kremenek  void VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S,
3774beaa9f51b2da57c64740cef2bd1c2fdb0c325d5Ted Kremenek                                   ExplodedNode *Pred, ExplodedNodeSet &Dst);
3784beaa9f51b2da57c64740cef2bd1c2fdb0c325d5Ted Kremenek
379892697dd2287caf7c29aaaa82909b0e90b8b63feTed Kremenek  /// Transfer function logic for computing the lvalue of an Objective-C ivar.
3809c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr *DR, ExplodedNode *Pred,
3819c378f705405d37f49795d5e915989de774fe11fTed Kremenek                                ExplodedNodeSet &Dst);
382af3374187c47acea45706eab6744be6b1c66a856Ted Kremenek
383af3374187c47acea45706eab6744be6b1c66a856Ted Kremenek  /// VisitObjCForCollectionStmt - Transfer function logic for
384af3374187c47acea45706eab6744be6b1c66a856Ted Kremenek  ///  ObjCForCollectionStmt.
3859c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S,
3869c378f705405d37f49795d5e915989de774fe11fTed Kremenek                                  ExplodedNode *Pred, ExplodedNodeSet &Dst);
3871eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
388d563d3fb73879df7147b8a5302c3bf0e1402ba18Jordan Rose  void VisitObjCMessage(const ObjCMessageExpr *ME, ExplodedNode *Pred,
3899c378f705405d37f49795d5e915989de774fe11fTed Kremenek                        ExplodedNodeSet &Dst);
3901eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
39102737ed29d7fff2206f7c7ee958cdf0665e35542Ted Kremenek  /// VisitReturnStmt - Transfer function logic for return statements.
3929c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitReturnStmt(const ReturnStmt *R, ExplodedNode *Pred,
3939c378f705405d37f49795d5e915989de774fe11fTed Kremenek                       ExplodedNodeSet &Dst);
3948ecdb65716cd7914ffb2eeee993fa9039fcd31e8Douglas Gregor
3958ecdb65716cd7914ffb2eeee993fa9039fcd31e8Douglas Gregor  /// VisitOffsetOfExpr - Transfer function for offsetof.
3969c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitOffsetOfExpr(const OffsetOfExpr *Ex, ExplodedNode *Pred,
3979c378f705405d37f49795d5e915989de774fe11fTed Kremenek                         ExplodedNodeSet &Dst);
3981eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
399f4e3cfbe8abd124be6341ef5d714819b4fbd9082Peter Collingbourne  /// VisitUnaryExprOrTypeTraitExpr - Transfer function for sizeof.
4009c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Ex,
4019c378f705405d37f49795d5e915989de774fe11fTed Kremenek                              ExplodedNode *Pred, ExplodedNodeSet &Dst);
4021eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
403b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  /// VisitUnaryOperator - Transfer function logic for unary operators.
4049c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void VisitUnaryOperator(const UnaryOperator* B, ExplodedNode *Pred,
4059c378f705405d37f49795d5e915989de774fe11fTed Kremenek                          ExplodedNodeSet &Dst);
406bb141217871e93767aa3f2de1b9946fa6d37066aZhongxing Xu
4078ad8c546372fe602708cb7ceeaf0ebbb866735c6Anna Zaks  /// Handle ++ and -- (both pre- and post-increment).
4088ad8c546372fe602708cb7ceeaf0ebbb866735c6Anna Zaks  void VisitIncrementDecrementOperator(const UnaryOperator* U,
4098ad8c546372fe602708cb7ceeaf0ebbb866735c6Anna Zaks                                       ExplodedNode *Pred,
4108ad8c546372fe602708cb7ceeaf0ebbb866735c6Anna Zaks                                       ExplodedNodeSet &Dst);
411337e4dbc6859589b8878146a88bebf754e916702Ted Kremenek
412337e4dbc6859589b8878146a88bebf754e916702Ted Kremenek  void VisitCXXCatchStmt(const CXXCatchStmt *CS, ExplodedNode *Pred,
413337e4dbc6859589b8878146a88bebf754e916702Ted Kremenek                         ExplodedNodeSet &Dst);
4148ad8c546372fe602708cb7ceeaf0ebbb866735c6Anna Zaks
41503509aea098772644bf4662dc1c88634818ceeccZhongxing Xu  void VisitCXXThisExpr(const CXXThisExpr *TE, ExplodedNode *Pred,
416bb141217871e93767aa3f2de1b9946fa6d37066aZhongxing Xu                        ExplodedNodeSet & Dst);
417d706434b0231c76fd9acf30060646a7aa8f69aefZhongxing Xu
418888c90ac0ef6baf7d47e86cf5cc4715707d223b1Jordan Rose  void VisitCXXConstructExpr(const CXXConstructExpr *E, ExplodedNode *Pred,
419888c90ac0ef6baf7d47e86cf5cc4715707d223b1Jordan Rose                             ExplodedNodeSet &Dst);
420950db87e5efe2ff0c7234116929f8637aaf7ae7aZhongxing Xu
421200fa2e70d52ae6d620e81cd45536071fdde70c0Jordan Rose  void VisitCXXDestructor(QualType ObjectType, const MemRegion *Dest,
422200fa2e70d52ae6d620e81cd45536071fdde70c0Jordan Rose                          const Stmt *S, bool IsBaseDtor,
423b13453bd8a91f331d0910ca95ad52aa41b52f648Zhongxing Xu                          ExplodedNode *Pred, ExplodedNodeSet &Dst);
424b13453bd8a91f331d0910ca95ad52aa41b52f648Zhongxing Xu
425651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  void VisitCXXNewAllocatorCall(const CXXNewExpr *CNE,
426651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                                ExplodedNode *Pred,
427651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                                ExplodedNodeSet &Dst);
428651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines
42903509aea098772644bf4662dc1c88634818ceeccZhongxing Xu  void VisitCXXNewExpr(const CXXNewExpr *CNE, ExplodedNode *Pred,
430856c6bcaea56e05255e9f3997ddd56b5c18a14f0Zhongxing Xu                       ExplodedNodeSet &Dst);
431856c6bcaea56e05255e9f3997ddd56b5c18a14f0Zhongxing Xu
43203509aea098772644bf4662dc1c88634818ceeccZhongxing Xu  void VisitCXXDeleteExpr(const CXXDeleteExpr *CDE, ExplodedNode *Pred,
4336b8513829895e56a7b97e787ea74520bc626512eZhongxing Xu                          ExplodedNodeSet &Dst);
4346b8513829895e56a7b97e787ea74520bc626512eZhongxing Xu
435bc37b8dd9914e02580f531fa6e5e72be34d9675eZhongxing Xu  /// Create a C++ temporary object for an rvalue.
436eea72a925f294225391ecec876a342771c09b635Ted Kremenek  void CreateCXXTemporaryObject(const MaterializeTemporaryExpr *ME,
437eea72a925f294225391ecec876a342771c09b635Ted Kremenek                                ExplodedNode *Pred,
438bc37b8dd9914e02580f531fa6e5e72be34d9675eZhongxing Xu                                ExplodedNodeSet &Dst);
439b277159055933e610bbc80262b600d3ad7e0595cTed Kremenek
4400caa2d47b84337e942b3f6652adfafe4ae506cfeTed Kremenek  /// evalEagerlyAssumeBinOpBifurcation - Given the nodes in 'Src', eagerly assume symbolic
44148af2a9c1ed3259512f2d1431720add1fbe8fb5fTed Kremenek  ///  expressions of the form 'x != 0' and generate new nodes (stored in Dst)
44248af2a9c1ed3259512f2d1431720add1fbe8fb5fTed Kremenek  ///  with those assumptions.
4430caa2d47b84337e942b3f6652adfafe4ae506cfeTed Kremenek  void evalEagerlyAssumeBinOpBifurcation(ExplodedNodeSet &Dst, ExplodedNodeSet &Src,
44403509aea098772644bf4662dc1c88634818ceeccZhongxing Xu                         const Expr *Ex);
4456c7511db998817e64f2e124013e7d7c9a430c580Ted Kremenek
4466c7511db998817e64f2e124013e7d7c9a430c580Ted Kremenek  std::pair<const ProgramPointTag *, const ProgramPointTag*>
4470caa2d47b84337e942b3f6652adfafe4ae506cfeTed Kremenek    geteagerlyAssumeBinOpBifurcationTags();
4481eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
4499c14953d0c84f7cf5adfb4cd3c0f05a9b1723c1cTed Kremenek  SVal evalMinus(SVal X) {
4505251abea41b446c26e3239c8dd6c7edea6fc335dDavid Blaikie    return X.isValid() ? svalBuilder.evalMinus(X.castAs<NonLoc>()) : X;
451b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek  }
4521eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
4539c14953d0c84f7cf5adfb4cd3c0f05a9b1723c1cTed Kremenek  SVal evalComplement(SVal X) {
4545251abea41b446c26e3239c8dd6c7edea6fc335dDavid Blaikie    return X.isValid() ? svalBuilder.evalComplement(X.castAs<NonLoc>()) : X;
45590e420321f60860f4c4e7a68ca9f7567824b46ecTed Kremenek  }
456248072a8b9cd956c4ac63172fc2af09790f7c6a9Zhongxing Xu
4571670e403c48f3af4fceff3f6773a0e1cfc6c4eb3Ted Kremenekpublic:
4581eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
4598bef8238181a30e52dea380789a7e2d760eac532Ted Kremenek  SVal evalBinOp(ProgramStateRef state, BinaryOperator::Opcode op,
460cd8f6ac9b613e1fe962ebf9c87d822ce765275e6Ted Kremenek                 NonLoc L, NonLoc R, QualType T) {
4619c14953d0c84f7cf5adfb4cd3c0f05a9b1723c1cTed Kremenek    return svalBuilder.evalBinOpNN(state, op, L, R, T);
4626297a8ec313c722db50f686fd190842b7ea91118Ted Kremenek  }
46310c16657eec144def180ee53d1e0249c9ed2b3b5Ted Kremenek
4648bef8238181a30e52dea380789a7e2d760eac532Ted Kremenek  SVal evalBinOp(ProgramStateRef state, BinaryOperator::Opcode op,
465cd8f6ac9b613e1fe962ebf9c87d822ce765275e6Ted Kremenek                 NonLoc L, SVal R, QualType T) {
4665251abea41b446c26e3239c8dd6c7edea6fc335dDavid Blaikie    return R.isValid() ? svalBuilder.evalBinOpNN(state, op, L,
4675251abea41b446c26e3239c8dd6c7edea6fc335dDavid Blaikie                                                 R.castAs<NonLoc>(), T) : R;
468b640b3b5dfccaf259967cb2cb6755c9aa20d4423Ted Kremenek  }
4691eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
4708bef8238181a30e52dea380789a7e2d760eac532Ted Kremenek  SVal evalBinOp(ProgramStateRef ST, BinaryOperator::Opcode Op,
471ff4264dae31cf42807b64ecc114906b0b835690aTed Kremenek                 SVal LHS, SVal RHS, QualType T) {
4729c14953d0c84f7cf5adfb4cd3c0f05a9b1723c1cTed Kremenek    return svalBuilder.evalBinOp(ST, Op, LHS, RHS, T);
473ff4264dae31cf42807b64ecc114906b0b835690aTed Kremenek  }
4745b9bd2137ebef350af803c634e3fdf5d74678100Ted Kremenek
4751670e403c48f3af4fceff3f6773a0e1cfc6c4eb3Ted Kremenekprotected:
4769c14953d0c84f7cf5adfb4cd3c0f05a9b1723c1cTed Kremenek  /// evalBind - Handle the semantics of binding a value to a specific location.
4779c14953d0c84f7cf5adfb4cd3c0f05a9b1723c1cTed Kremenek  ///  This method is used by evalStore, VisitDeclStmt, and others.
4789c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void evalBind(ExplodedNodeSet &Dst, const Stmt *StoreE, ExplodedNode *Pred,
4793682f1ea9c7fddc7dcbc590891158ba40f7fca16Jordan Rose                SVal location, SVal Val, bool atDeclInit = false,
4806bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines                const ProgramPoint *PP = nullptr);
4811eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
4821655bcd052a67a3050fc55df8ecce57342352e68Anna Zaks  /// Call PointerEscape callback when a value escapes as a result of bind.
483bf53dfac8195835028bd6347433f7dbebcc29fc1Anna Zaks  ProgramStateRef processPointerEscapedOnBind(ProgramStateRef State,
484651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                                              SVal Loc, SVal Val) override;
4851655bcd052a67a3050fc55df8ecce57342352e68Anna Zaks  /// Call PointerEscape callback when a value escapes as a result of
4861655bcd052a67a3050fc55df8ecce57342352e68Anna Zaks  /// region invalidation.
487da8d37ce42d2db4e1e76ee6f7f38f10f6b0ef0f8Anton Yartsev  /// \param[in] ITraits Specifies invalidation traits for regions/symbols.
48841988f331a74a72cf243a2a68ffb56418e9a174eAnna Zaks  ProgramStateRef notifyCheckersOfPointerEscape(
489651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                           ProgramStateRef State,
490651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                           const InvalidatedSymbols *Invalidated,
491651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                           ArrayRef<const MemRegion *> ExplicitRegions,
492651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                           ArrayRef<const MemRegion *> Regions,
493651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                           const CallEvent *Call,
494651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                           RegionAndSymbolInvalidationTraits &ITraits) override;
495bf53dfac8195835028bd6347433f7dbebcc29fc1Anna Zaks
4961670e403c48f3af4fceff3f6773a0e1cfc6c4eb3Ted Kremenekpublic:
497b4b817d704287836b52b34369009e682f208aa2bTed Kremenek  // FIXME: 'tag' should be removed, and a LocationContext should be used
498b4b817d704287836b52b34369009e682f208aa2bTed Kremenek  // instead.
499834f9de3d3d76986d09f41725a70ba45a3e2aecdZhanyong Wan  // FIXME: Comment on the meaning of the arguments, when 'St' may not
500834f9de3d3d76986d09f41725a70ba45a3e2aecdZhanyong Wan  // be the same as Pred->state, and when 'location' may not be the
501834f9de3d3d76986d09f41725a70ba45a3e2aecdZhanyong Wan  // same as state->getLValue(Ex).
502834f9de3d3d76986d09f41725a70ba45a3e2aecdZhanyong Wan  /// Simulate a read of the result of Ex.
503bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek  void evalLoad(ExplodedNodeSet &Dst,
504bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                const Expr *NodeEx,  /* Eventually will be a CFGStmt */
505bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                const Expr *BoundExpr,
506bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                ExplodedNode *Pred,
507bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                ProgramStateRef St,
508bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                SVal location,
5096bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines                const ProgramPointTag *tag = nullptr,
510652be346f74feba027bcbdeb6a3e3f4755a0e62cZhongxing Xu                QualType LoadTy = QualType());
5111eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
512b4b817d704287836b52b34369009e682f208aa2bTed Kremenek  // FIXME: 'tag' should be removed, and a LocationContext should be used
513b4b817d704287836b52b34369009e682f208aa2bTed Kremenek  // instead.
5149c378f705405d37f49795d5e915989de774fe11fTed Kremenek  void evalStore(ExplodedNodeSet &Dst, const Expr *AssignE, const Expr *StoreE,
5158bef8238181a30e52dea380789a7e2d760eac532Ted Kremenek                 ExplodedNode *Pred, ProgramStateRef St, SVal TargetLV, SVal Val,
5166bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines                 const ProgramPointTag *tag = nullptr);
51769f87c956b3ac2b80124fd9604af012e1061473aJordan Rose
518e81ce256b62717dd846bd19aecc4115a0dcd4995Anna Zaks  /// \brief Create a new state in which the call return value is binded to the
519e81ce256b62717dd846bd19aecc4115a0dcd4995Anna Zaks  /// call origin expression.
520e81ce256b62717dd846bd19aecc4115a0dcd4995Anna Zaks  ProgramStateRef bindReturnValue(const CallEvent &Call,
521e81ce256b62717dd846bd19aecc4115a0dcd4995Anna Zaks                                  const LocationContext *LCtx,
522e81ce256b62717dd846bd19aecc4115a0dcd4995Anna Zaks                                  ProgramStateRef State);
523e81ce256b62717dd846bd19aecc4115a0dcd4995Anna Zaks
524645baeed6800f952e9ad1d5666e01080385531a2Jordan Rose  /// Evaluate a call, running pre- and post-call checks and allowing checkers
525645baeed6800f952e9ad1d5666e01080385531a2Jordan Rose  /// to be responsible for handling the evaluation of the call itself.
52669f87c956b3ac2b80124fd9604af012e1061473aJordan Rose  void evalCall(ExplodedNodeSet &Dst, ExplodedNode *Pred,
527645baeed6800f952e9ad1d5666e01080385531a2Jordan Rose                const CallEvent &Call);
528e81ce256b62717dd846bd19aecc4115a0dcd4995Anna Zaks
5299dc5167e4017ef4c8b327abb6f72225eec2e0f19Anna Zaks  /// \brief Default implementation of call evaluation.
530e81ce256b62717dd846bd19aecc4115a0dcd4995Anna Zaks  void defaultEvalCall(NodeBuilder &B, ExplodedNode *Pred,
53169f87c956b3ac2b80124fd9604af012e1061473aJordan Rose                       const CallEvent &Call);
532834f9de3d3d76986d09f41725a70ba45a3e2aecdZhanyong Wanprivate:
533bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek  void evalLoadCommon(ExplodedNodeSet &Dst,
534bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                      const Expr *NodeEx,  /* Eventually will be a CFGStmt */
535bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                      const Expr *BoundEx,
536bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                      ExplodedNode *Pred,
537bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                      ProgramStateRef St,
538bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                      SVal location,
539bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                      const ProgramPointTag *tag,
540852274d4257134906995cb252fb3dfd2d71deae8Ted Kremenek                      QualType LoadTy);
541852274d4257134906995cb252fb3dfd2d71deae8Ted Kremenek
542852274d4257134906995cb252fb3dfd2d71deae8Ted Kremenek  // FIXME: 'tag' should be removed, and a LocationContext should be used
543852274d4257134906995cb252fb3dfd2d71deae8Ted Kremenek  // instead.
544bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek  void evalLocation(ExplodedNodeSet &Dst,
545bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                    const Stmt *NodeEx, /* This will eventually be a CFGStmt */
546bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                    const Stmt *BoundEx,
547bd613137499b1d4c3b63dccd0aa21f6add243f4fTed Kremenek                    ExplodedNode *Pred,
5488bef8238181a30e52dea380789a7e2d760eac532Ted Kremenek                    ProgramStateRef St, SVal location,
549ca804539d908d3a0e8c72a0df5f1f571d29490bbTed Kremenek                    const ProgramPointTag *tag, bool isLoad);
5501c625f25055331bf76ab5479a8060d2b0f61e8b8Zhongxing Xu
5514ea9b89ff6dc50d5404eb56cad5e5870bce49ef2Anna Zaks  /// Count the stack depth and determine if the call is recursive.
5524ea9b89ff6dc50d5404eb56cad5e5870bce49ef2Anna Zaks  void examineStackFrames(const Decl *D, const LocationContext *LCtx,
5534ea9b89ff6dc50d5404eb56cad5e5870bce49ef2Anna Zaks                          bool &IsRecursive, unsigned &StackDepth);
5544ea9b89ff6dc50d5404eb56cad5e5870bce49ef2Anna Zaks
5558dadf15224f1a8df96793e5fc4e0b0e38a5ffbe4Anna Zaks  /// Checks our policies and decides weither the given call should be inlined.
5568dadf15224f1a8df96793e5fc4e0b0e38a5ffbe4Anna Zaks  bool shouldInlineCall(const CallEvent &Call, const Decl *D,
5578dadf15224f1a8df96793e5fc4e0b0e38a5ffbe4Anna Zaks                        const ExplodedNode *Pred);
5588dadf15224f1a8df96793e5fc4e0b0e38a5ffbe4Anna Zaks
559e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks  bool inlineCall(const CallEvent &Call, const Decl *D, NodeBuilder &Bldr,
560e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks                  ExplodedNode *Pred, ProgramStateRef State);
561e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks
562e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks  /// \brief Conservatively evaluate call by invalidating regions and binding
563e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks  /// a conjured return value.
564e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks  void conservativeEvalCall(const CallEvent &Call, NodeBuilder &Bldr,
565e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks                            ExplodedNode *Pred, ProgramStateRef State);
566e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks
567e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks  /// \brief Either inline or process the call conservatively (or both), based
568e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks  /// on DynamicDispatchBifurcation data.
569e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks  void BifurcateCall(const MemRegion *BifurReg,
570e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks                     const CallEvent &Call, const Decl *D, NodeBuilder &Bldr,
571e90d3f847dcce76237078b67db8895eb7a24189eAnna Zaks                     ExplodedNode *Pred);
5725903a373db3d27794c90b25687e0dd6adb0e497dAnna Zaks
5735903a373db3d27794c90b25687e0dd6adb0e497dAnna Zaks  bool replayWithoutInlining(ExplodedNode *P, const LocationContext *CalleeLC);
574bc403861bc4e6f7ad1371e9e129f0f25b38b3a9aJordan Rose
575a8d937e4bdd39cdf503f77454e9dc4c9c730a9f7Jordan Rose  /// Models a trivial copy or move constructor or trivial assignment operator
576a8d937e4bdd39cdf503f77454e9dc4c9c730a9f7Jordan Rose  /// call with a simple bind.
577bc403861bc4e6f7ad1371e9e129f0f25b38b3a9aJordan Rose  void performTrivialCopy(NodeBuilder &Bldr, ExplodedNode *Pred,
578a8d937e4bdd39cdf503f77454e9dc4c9c730a9f7Jordan Rose                          const CallEvent &Call);
5795e5440ba9c135f523f72e7e7c5da59d390d697c5Jordan Rose
5805e5440ba9c135f523f72e7e7c5da59d390d697c5Jordan Rose  /// If the value of the given expression is a NonLoc, copy it into a new
5815e5440ba9c135f523f72e7e7c5da59d390d697c5Jordan Rose  /// temporary object region, and replace the value of the expression with
5825e5440ba9c135f523f72e7e7c5da59d390d697c5Jordan Rose  /// that.
5835e5440ba9c135f523f72e7e7c5da59d390d697c5Jordan Rose  ///
5845e5440ba9c135f523f72e7e7c5da59d390d697c5Jordan Rose  /// If \p ResultE is provided, the new region will be bound to this expression
5855e5440ba9c135f523f72e7e7c5da59d390d697c5Jordan Rose  /// instead of \p E.
5865e5440ba9c135f523f72e7e7c5da59d390d697c5Jordan Rose  ProgramStateRef createTemporaryRegionIfNeeded(ProgramStateRef State,
5875e5440ba9c135f523f72e7e7c5da59d390d697c5Jordan Rose                                                const LocationContext *LC,
5885e5440ba9c135f523f72e7e7c5da59d390d697c5Jordan Rose                                                const Expr *E,
5896bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines                                                const Expr *ResultE = nullptr);
5905903a373db3d27794c90b25687e0dd6adb0e497dAnna Zaks};
5915903a373db3d27794c90b25687e0dd6adb0e497dAnna Zaks
5925903a373db3d27794c90b25687e0dd6adb0e497dAnna Zaks/// Traits for storing the call processing policy inside GDM.
5935903a373db3d27794c90b25687e0dd6adb0e497dAnna Zaks/// The GDM stores the corresponding CallExpr pointer.
594466224fd068a0a0084968a7f521a690a51c3b226Jordan Rose// FIXME: This does not use the nice trait macros because it must be accessible
595466224fd068a0a0084968a7f521a690a51c3b226Jordan Rose// from multiple translation units.
5965903a373db3d27794c90b25687e0dd6adb0e497dAnna Zaksstruct ReplayWithoutInlining{};
5975903a373db3d27794c90b25687e0dd6adb0e497dAnna Zakstemplate <>
5985903a373db3d27794c90b25687e0dd6adb0e497dAnna Zaksstruct ProgramStateTrait<ReplayWithoutInlining> :
599bdc691f1d61765dd806d5ae3b75ae004f676a7c9Jordan Rose  public ProgramStatePartialTrait<const void*> {
6005903a373db3d27794c90b25687e0dd6adb0e497dAnna Zaks  static void *GDMIndex() { static int index = 0; return &index; }
601b387a3f23e423d62c053be86294b703da1d1a222Ted Kremenek};
6021eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
60365423aeb996a296cf2964f136ce4a4a937bd1687Zhongxing Xu} // end ento namespace
6045a4f98ff943e6a501b0fe47ade007c9bbf96cb88Argyrios Kyrtzidis
605c0c3f5dbc9e78aa53a86c7d5e3eeda23ddad93d6Ted Kremenek} // end clang namespace
606c0c3f5dbc9e78aa53a86c7d5e3eeda23ddad93d6Ted Kremenek
607d065d6080f0620bb80b933f3f5d52d37bb2ea770Ted Kremenek#endif
608