mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 09:13:38 +08:00
Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at.
llvm-svn: 137537
This commit is contained in:
@@ -57,13 +57,13 @@ public:
|
||||
|
||||
/// A callback invoked right before invoking the
|
||||
/// liveness transfer function on the given statement.
|
||||
virtual void observeStmt(const Stmt* S,
|
||||
virtual void observeStmt(const Stmt *S,
|
||||
const CFGBlock *currentBlock,
|
||||
const LivenessValues& V) {}
|
||||
|
||||
/// Called when the live variables analysis registers
|
||||
/// that a variable is killed.
|
||||
virtual void observerKill(const DeclRefExpr* DR) {}
|
||||
virtual void observerKill(const DeclRefExpr *DR) {}
|
||||
};
|
||||
|
||||
|
||||
@@ -75,17 +75,17 @@ public:
|
||||
|
||||
/// Return true if a variable is live at the end of a
|
||||
/// specified block.
|
||||
bool isLive(const CFGBlock* B, const VarDecl* D);
|
||||
bool isLive(const CFGBlock *B, const VarDecl *D);
|
||||
|
||||
/// Returns true if a variable is live at the beginning of the
|
||||
/// the statement. This query only works if liveness information
|
||||
/// has been recorded at the statement level (see runOnAllBlocks), and
|
||||
/// only returns liveness information for block-level expressions.
|
||||
bool isLive(const Stmt* S, const VarDecl* D);
|
||||
bool isLive(const Stmt *S, const VarDecl *D);
|
||||
|
||||
/// Returns true the block-level expression "value" is live
|
||||
/// before the given block-level expression (see runOnAllBlocks).
|
||||
bool isLive(const Stmt* Loc, const Stmt* StmtVal);
|
||||
bool isLive(const Stmt *Loc, const Stmt *StmtVal);
|
||||
|
||||
/// Print to stderr the liveness information associated with
|
||||
/// each basic block.
|
||||
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
ContextKind ck,
|
||||
AnalysisContext *ctx,
|
||||
const LocationContext *parent,
|
||||
const void* data);
|
||||
const void *data);
|
||||
};
|
||||
|
||||
class StackFrameContext : public LocationContext {
|
||||
@@ -260,7 +260,7 @@ public:
|
||||
ID.AddInteger(idx);
|
||||
}
|
||||
|
||||
static bool classof(const LocationContext* Ctx) {
|
||||
static bool classof(const LocationContext *Ctx) {
|
||||
return Ctx->getKind() == StackFrame;
|
||||
}
|
||||
};
|
||||
@@ -283,7 +283,7 @@ public:
|
||||
ProfileCommon(ID, Scope, ctx, parent, s);
|
||||
}
|
||||
|
||||
static bool classof(const LocationContext* Ctx) {
|
||||
static bool classof(const LocationContext *Ctx) {
|
||||
return Ctx->getKind() == Scope;
|
||||
}
|
||||
};
|
||||
@@ -311,7 +311,7 @@ public:
|
||||
ProfileCommon(ID, Block, ctx, parent, bd);
|
||||
}
|
||||
|
||||
static bool classof(const LocationContext* Ctx) {
|
||||
static bool classof(const LocationContext *Ctx) {
|
||||
return Ctx->getKind() == Block;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -278,7 +278,7 @@ class CFGBlock {
|
||||
|
||||
void push_back(CFGElement e, BumpVectorContext &C) { Impl.push_back(e, C); }
|
||||
reverse_iterator insert(reverse_iterator I, size_t Cnt, CFGElement E,
|
||||
BumpVectorContext& C) {
|
||||
BumpVectorContext &C) {
|
||||
return Impl.insert(I, Cnt, E, C);
|
||||
}
|
||||
|
||||
@@ -453,23 +453,23 @@ public:
|
||||
|
||||
// Manipulation of block contents
|
||||
|
||||
void setTerminator(Stmt* Statement) { Terminator = Statement; }
|
||||
void setLabel(Stmt* Statement) { Label = Statement; }
|
||||
void setTerminator(Stmt *Statement) { Terminator = Statement; }
|
||||
void setLabel(Stmt *Statement) { Label = Statement; }
|
||||
void setLoopTarget(const Stmt *loopTarget) { LoopTarget = loopTarget; }
|
||||
|
||||
CFGTerminator getTerminator() { return Terminator; }
|
||||
const CFGTerminator getTerminator() const { return Terminator; }
|
||||
|
||||
Stmt* getTerminatorCondition();
|
||||
Stmt *getTerminatorCondition();
|
||||
|
||||
const Stmt* getTerminatorCondition() const {
|
||||
const Stmt *getTerminatorCondition() const {
|
||||
return const_cast<CFGBlock*>(this)->getTerminatorCondition();
|
||||
}
|
||||
|
||||
const Stmt *getLoopTarget() const { return LoopTarget; }
|
||||
|
||||
Stmt* getLabel() { return Label; }
|
||||
const Stmt* getLabel() const { return Label; }
|
||||
Stmt *getLabel() { return Label; }
|
||||
const Stmt *getLabel() const { return Label; }
|
||||
|
||||
unsigned getBlockID() const { return BlockID; }
|
||||
|
||||
@@ -477,18 +477,18 @@ public:
|
||||
void print(raw_ostream &OS, const CFG* cfg, const LangOptions &LO) const;
|
||||
void printTerminator(raw_ostream &OS, const LangOptions &LO) const;
|
||||
|
||||
void addSuccessor(CFGBlock* Block, BumpVectorContext &C) {
|
||||
void addSuccessor(CFGBlock *Block, BumpVectorContext &C) {
|
||||
if (Block)
|
||||
Block->Preds.push_back(this, C);
|
||||
Succs.push_back(Block, C);
|
||||
}
|
||||
|
||||
void appendStmt(Stmt* statement, BumpVectorContext &C) {
|
||||
void appendStmt(Stmt *statement, BumpVectorContext &C) {
|
||||
Elements.push_back(CFGStmt(statement), C);
|
||||
}
|
||||
|
||||
void appendInitializer(CXXCtorInitializer *initializer,
|
||||
BumpVectorContext& C) {
|
||||
BumpVectorContext &C) {
|
||||
Elements.push_back(CFGInitializer(initializer), C);
|
||||
}
|
||||
|
||||
@@ -508,10 +508,10 @@ public:
|
||||
// steps. First we prepare space for some number of elements, then we insert
|
||||
// the elements beginning at the last position in prepared space.
|
||||
iterator beginAutomaticObjDtorsInsert(iterator I, size_t Cnt,
|
||||
BumpVectorContext& C) {
|
||||
BumpVectorContext &C) {
|
||||
return iterator(Elements.insert(I.base(), Cnt, CFGElement(), C));
|
||||
}
|
||||
iterator insertAutomaticObjDtor(iterator I, VarDecl* VD, Stmt* S) {
|
||||
iterator insertAutomaticObjDtor(iterator I, VarDecl *VD, Stmt *S) {
|
||||
*I = CFGAutomaticObjDtor(VD, S);
|
||||
return ++I;
|
||||
}
|
||||
@@ -565,12 +565,12 @@ public:
|
||||
|
||||
/// buildCFG - Builds a CFG from an AST. The responsibility to free the
|
||||
/// constructed CFG belongs to the caller.
|
||||
static CFG* buildCFG(const Decl *D, Stmt* AST, ASTContext *C,
|
||||
static CFG* buildCFG(const Decl *D, Stmt *AST, ASTContext *C,
|
||||
const BuildOptions &BO);
|
||||
|
||||
/// createBlock - Create a new block in the CFG. The CFG owns the block;
|
||||
/// the caller should not directly free it.
|
||||
CFGBlock* createBlock();
|
||||
CFGBlock *createBlock();
|
||||
|
||||
/// setEntry - Set the entry block of the CFG. This is typically used
|
||||
/// only during CFG construction. Most CFG clients expect that the
|
||||
@@ -579,7 +579,7 @@ public:
|
||||
|
||||
/// setIndirectGotoBlock - Set the block used for indirect goto jumps.
|
||||
/// This is typically used only during CFG construction.
|
||||
void setIndirectGotoBlock(CFGBlock* B) { IndirectGotoBlock = B; }
|
||||
void setIndirectGotoBlock(CFGBlock *B) { IndirectGotoBlock = B; }
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Block Iterators
|
||||
@@ -591,8 +591,8 @@ public:
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
CFGBlock& front() { return *Blocks.front(); }
|
||||
CFGBlock& back() { return *Blocks.back(); }
|
||||
CFGBlock & front() { return *Blocks.front(); }
|
||||
CFGBlock & back() { return *Blocks.back(); }
|
||||
|
||||
iterator begin() { return Blocks.begin(); }
|
||||
iterator end() { return Blocks.end(); }
|
||||
@@ -604,13 +604,13 @@ public:
|
||||
const_reverse_iterator rbegin() const { return Blocks.rbegin(); }
|
||||
const_reverse_iterator rend() const { return Blocks.rend(); }
|
||||
|
||||
CFGBlock& getEntry() { return *Entry; }
|
||||
const CFGBlock& getEntry() const { return *Entry; }
|
||||
CFGBlock& getExit() { return *Exit; }
|
||||
const CFGBlock& getExit() const { return *Exit; }
|
||||
CFGBlock & getEntry() { return *Entry; }
|
||||
const CFGBlock & getEntry() const { return *Entry; }
|
||||
CFGBlock & getExit() { return *Exit; }
|
||||
const CFGBlock & getExit() const { return *Exit; }
|
||||
|
||||
CFGBlock* getIndirectGotoBlock() { return IndirectGotoBlock; }
|
||||
const CFGBlock* getIndirectGotoBlock() const { return IndirectGotoBlock; }
|
||||
CFGBlock * getIndirectGotoBlock() { return IndirectGotoBlock; }
|
||||
const CFGBlock * getIndirectGotoBlock() const { return IndirectGotoBlock; }
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Member templates useful for various batch operations over CFGs.
|
||||
@@ -638,11 +638,11 @@ public:
|
||||
operator unsigned() const { assert(Idx >=0); return (unsigned) Idx; }
|
||||
};
|
||||
|
||||
bool isBlkExpr(const Stmt* S) { return getBlkExprNum(S); }
|
||||
bool isBlkExpr(const Stmt *S) { return getBlkExprNum(S); }
|
||||
bool isBlkExpr(const Stmt *S) const {
|
||||
return const_cast<CFG*>(this)->isBlkExpr(S);
|
||||
}
|
||||
BlkExprNumTy getBlkExprNum(const Stmt* S);
|
||||
BlkExprNumTy getBlkExprNum(const Stmt *S);
|
||||
unsigned getNumBlkExprs();
|
||||
|
||||
/// getNumBlockIDs - Returns the total number of BlockIDs allocated (which
|
||||
@@ -654,7 +654,7 @@ public:
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
void viewCFG(const LangOptions &LO) const;
|
||||
void print(raw_ostream& OS, const LangOptions &LO) const;
|
||||
void print(raw_ostream &OS, const LangOptions &LO) const;
|
||||
void dump(const LangOptions &LO) const;
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
@@ -675,8 +675,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
CFGBlock* Entry;
|
||||
CFGBlock* Exit;
|
||||
CFGBlock *Entry;
|
||||
CFGBlock *Exit;
|
||||
CFGBlock* IndirectGotoBlock; // Special block to contain collective dispatch
|
||||
// for indirect gotos
|
||||
unsigned NumBlockIDs;
|
||||
@@ -684,7 +684,7 @@ private:
|
||||
// BlkExprMap - An opaque pointer to prevent inclusion of DenseMap.h.
|
||||
// It represents a map from Expr* to integers to record the set of
|
||||
// block-level expressions and their "statement number" in the CFG.
|
||||
void* BlkExprMap;
|
||||
void * BlkExprMap;
|
||||
|
||||
BumpVectorContext BlkBVC;
|
||||
|
||||
@@ -717,11 +717,11 @@ template <> struct simplify_type< ::clang::CFGTerminator> {
|
||||
|
||||
// Traits for: CFGBlock
|
||||
|
||||
template <> struct GraphTraits< ::clang::CFGBlock* > {
|
||||
template <> struct GraphTraits< ::clang::CFGBlock *> {
|
||||
typedef ::clang::CFGBlock NodeType;
|
||||
typedef ::clang::CFGBlock::succ_iterator ChildIteratorType;
|
||||
|
||||
static NodeType* getEntryNode(::clang::CFGBlock* BB)
|
||||
static NodeType* getEntryNode(::clang::CFGBlock *BB)
|
||||
{ return BB; }
|
||||
|
||||
static inline ChildIteratorType child_begin(NodeType* N)
|
||||
@@ -731,11 +731,11 @@ template <> struct GraphTraits< ::clang::CFGBlock* > {
|
||||
{ return N->succ_end(); }
|
||||
};
|
||||
|
||||
template <> struct GraphTraits< const ::clang::CFGBlock* > {
|
||||
template <> struct GraphTraits< const ::clang::CFGBlock *> {
|
||||
typedef const ::clang::CFGBlock NodeType;
|
||||
typedef ::clang::CFGBlock::const_succ_iterator ChildIteratorType;
|
||||
|
||||
static NodeType* getEntryNode(const clang::CFGBlock* BB)
|
||||
static NodeType* getEntryNode(const clang::CFGBlock *BB)
|
||||
{ return BB; }
|
||||
|
||||
static inline ChildIteratorType child_begin(NodeType* N)
|
||||
@@ -762,7 +762,7 @@ template <> struct GraphTraits<Inverse<const ::clang::CFGBlock*> > {
|
||||
// Traits for: CFG
|
||||
|
||||
template <> struct GraphTraits< ::clang::CFG* >
|
||||
: public GraphTraits< ::clang::CFGBlock* > {
|
||||
: public GraphTraits< ::clang::CFGBlock *> {
|
||||
|
||||
typedef ::clang::CFG::iterator nodes_iterator;
|
||||
|
||||
@@ -772,7 +772,7 @@ template <> struct GraphTraits< ::clang::CFG* >
|
||||
};
|
||||
|
||||
template <> struct GraphTraits<const ::clang::CFG* >
|
||||
: public GraphTraits<const ::clang::CFGBlock* > {
|
||||
: public GraphTraits<const ::clang::CFGBlock *> {
|
||||
|
||||
typedef ::clang::CFG::const_iterator nodes_iterator;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class DataflowWorkListTy {
|
||||
public:
|
||||
/// enqueue - Add a block to the worklist. Blocks already on the
|
||||
/// worklist are not added a second time.
|
||||
void enqueue(const CFGBlock* B) {
|
||||
void enqueue(const CFGBlock *B) {
|
||||
unsigned char &x = BlockSet[B];
|
||||
if (x == 1)
|
||||
return;
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
}
|
||||
|
||||
/// dequeue - Remove a block from the worklist.
|
||||
const CFGBlock* dequeue() {
|
||||
const CFGBlock *dequeue() {
|
||||
assert(!BlockQueue.empty());
|
||||
const CFGBlock *B = BlockQueue.back();
|
||||
BlockQueue.pop_back();
|
||||
@@ -69,20 +69,20 @@ template <> struct ItrTraits<forward_analysis_tag> {
|
||||
typedef CFGBlock::const_succ_iterator NextBItr;
|
||||
typedef CFGBlock::const_iterator StmtItr;
|
||||
|
||||
static PrevBItr PrevBegin(const CFGBlock* B) { return B->pred_begin(); }
|
||||
static PrevBItr PrevEnd(const CFGBlock* B) { return B->pred_end(); }
|
||||
static PrevBItr PrevBegin(const CFGBlock *B) { return B->pred_begin(); }
|
||||
static PrevBItr PrevEnd(const CFGBlock *B) { return B->pred_end(); }
|
||||
|
||||
static NextBItr NextBegin(const CFGBlock* B) { return B->succ_begin(); }
|
||||
static NextBItr NextEnd(const CFGBlock* B) { return B->succ_end(); }
|
||||
static NextBItr NextBegin(const CFGBlock *B) { return B->succ_begin(); }
|
||||
static NextBItr NextEnd(const CFGBlock *B) { return B->succ_end(); }
|
||||
|
||||
static StmtItr StmtBegin(const CFGBlock* B) { return B->begin(); }
|
||||
static StmtItr StmtEnd(const CFGBlock* B) { return B->end(); }
|
||||
static StmtItr StmtBegin(const CFGBlock *B) { return B->begin(); }
|
||||
static StmtItr StmtEnd(const CFGBlock *B) { return B->end(); }
|
||||
|
||||
static BlockEdge PrevEdge(const CFGBlock* B, const CFGBlock* Prev) {
|
||||
static BlockEdge PrevEdge(const CFGBlock *B, const CFGBlock *Prev) {
|
||||
return BlockEdge(Prev, B, 0);
|
||||
}
|
||||
|
||||
static BlockEdge NextEdge(const CFGBlock* B, const CFGBlock* Next) {
|
||||
static BlockEdge NextEdge(const CFGBlock *B, const CFGBlock *Next) {
|
||||
return BlockEdge(B, Next, 0);
|
||||
}
|
||||
};
|
||||
@@ -92,20 +92,20 @@ template <> struct ItrTraits<backward_analysis_tag> {
|
||||
typedef CFGBlock::const_pred_iterator NextBItr;
|
||||
typedef CFGBlock::const_reverse_iterator StmtItr;
|
||||
|
||||
static PrevBItr PrevBegin(const CFGBlock* B) { return B->succ_begin(); }
|
||||
static PrevBItr PrevEnd(const CFGBlock* B) { return B->succ_end(); }
|
||||
static PrevBItr PrevBegin(const CFGBlock *B) { return B->succ_begin(); }
|
||||
static PrevBItr PrevEnd(const CFGBlock *B) { return B->succ_end(); }
|
||||
|
||||
static NextBItr NextBegin(const CFGBlock* B) { return B->pred_begin(); }
|
||||
static NextBItr NextEnd(const CFGBlock* B) { return B->pred_end(); }
|
||||
static NextBItr NextBegin(const CFGBlock *B) { return B->pred_begin(); }
|
||||
static NextBItr NextEnd(const CFGBlock *B) { return B->pred_end(); }
|
||||
|
||||
static StmtItr StmtBegin(const CFGBlock* B) { return B->rbegin(); }
|
||||
static StmtItr StmtEnd(const CFGBlock* B) { return B->rend(); }
|
||||
static StmtItr StmtBegin(const CFGBlock *B) { return B->rbegin(); }
|
||||
static StmtItr StmtEnd(const CFGBlock *B) { return B->rend(); }
|
||||
|
||||
static BlockEdge PrevEdge(const CFGBlock* B, const CFGBlock* Prev) {
|
||||
static BlockEdge PrevEdge(const CFGBlock *B, const CFGBlock *Prev) {
|
||||
return BlockEdge(B, Prev, 0);
|
||||
}
|
||||
|
||||
static BlockEdge NextEdge(const CFGBlock* B, const CFGBlock* Next) {
|
||||
static BlockEdge NextEdge(const CFGBlock *B, const CFGBlock *Next) {
|
||||
return BlockEdge(Next, B, 0);
|
||||
}
|
||||
};
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
/// dataflow values using runOnCFG, as runOnBlock is intended to
|
||||
/// only be used for querying the dataflow values within a block
|
||||
/// with and Observer object.
|
||||
void runOnBlock(const CFGBlock* B, bool recordStmtValues) {
|
||||
void runOnBlock(const CFGBlock *B, bool recordStmtValues) {
|
||||
BlockDataMapTy& M = D.getBlockDataMap();
|
||||
typename BlockDataMapTy::iterator I = M.find(B);
|
||||
|
||||
@@ -172,13 +172,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void runOnBlock(const CFGBlock& B, bool recordStmtValues) {
|
||||
void runOnBlock(const CFGBlock &B, bool recordStmtValues) {
|
||||
runOnBlock(&B, recordStmtValues);
|
||||
}
|
||||
void runOnBlock(CFG::iterator& I, bool recordStmtValues) {
|
||||
void runOnBlock(CFG::iterator &I, bool recordStmtValues) {
|
||||
runOnBlock(*I, recordStmtValues);
|
||||
}
|
||||
void runOnBlock(CFG::const_iterator& I, bool recordStmtValues) {
|
||||
void runOnBlock(CFG::const_iterator &I, bool recordStmtValues) {
|
||||
runOnBlock(*I, recordStmtValues);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ private:
|
||||
EnqueueBlocksOnWorklist(cfg, AnalysisDirTag());
|
||||
|
||||
while (!WorkList.isEmpty()) {
|
||||
const CFGBlock* B = WorkList.dequeue();
|
||||
const CFGBlock *B = WorkList.dequeue();
|
||||
ProcessMerge(cfg, B);
|
||||
ProcessBlock(B, recordStmtValues, AnalysisDirTag());
|
||||
UpdateEdges(cfg, B, TF.getVal());
|
||||
@@ -222,7 +222,7 @@ private:
|
||||
WorkList.enqueue(&**I);
|
||||
}
|
||||
|
||||
void ProcessMerge(CFG& cfg, const CFGBlock* B) {
|
||||
void ProcessMerge(CFG& cfg, const CFGBlock *B) {
|
||||
ValTy& V = TF.getVal();
|
||||
TF.SetTopValue(V);
|
||||
|
||||
@@ -270,7 +270,7 @@ private:
|
||||
}
|
||||
|
||||
/// ProcessBlock - Process the transfer functions for a given block.
|
||||
void ProcessBlock(const CFGBlock* B, bool recordStmtValues,
|
||||
void ProcessBlock(const CFGBlock *B, bool recordStmtValues,
|
||||
dataflow::forward_analysis_tag) {
|
||||
|
||||
TF.setCurrentBlock(B);
|
||||
@@ -284,7 +284,7 @@ private:
|
||||
TF.VisitTerminator(const_cast<CFGBlock*>(B));
|
||||
}
|
||||
|
||||
void ProcessBlock(const CFGBlock* B, bool recordStmtValues,
|
||||
void ProcessBlock(const CFGBlock *B, bool recordStmtValues,
|
||||
dataflow::backward_analysis_tag) {
|
||||
|
||||
TF.setCurrentBlock(B);
|
||||
@@ -298,12 +298,12 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessStmt(const Stmt* S, bool record, dataflow::forward_analysis_tag) {
|
||||
void ProcessStmt(const Stmt *S, bool record, dataflow::forward_analysis_tag) {
|
||||
if (record) D.getStmtDataMap()[S] = TF.getVal();
|
||||
TF.BlockStmt_Visit(const_cast<Stmt*>(S));
|
||||
}
|
||||
|
||||
void ProcessStmt(const Stmt* S, bool record, dataflow::backward_analysis_tag){
|
||||
void ProcessStmt(const Stmt *S, bool record, dataflow::backward_analysis_tag){
|
||||
TF.BlockStmt_Visit(const_cast<Stmt*>(S));
|
||||
if (record) D.getStmtDataMap()[S] = TF.getVal();
|
||||
}
|
||||
@@ -312,14 +312,14 @@ private:
|
||||
/// block, update the dataflow value associated with the block's
|
||||
/// outgoing/incoming edges (depending on whether we do a
|
||||
// forward/backward analysis respectively)
|
||||
void UpdateEdges(CFG& cfg, const CFGBlock* B, ValTy& V) {
|
||||
void UpdateEdges(CFG& cfg, const CFGBlock *B, ValTy& V) {
|
||||
for (NextBItr I=ItrTraits::NextBegin(B), E=ItrTraits::NextEnd(B); I!=E; ++I)
|
||||
if (CFGBlock *NextBlk = *I)
|
||||
UpdateEdgeValue(ItrTraits::NextEdge(B, NextBlk),V, NextBlk);
|
||||
}
|
||||
|
||||
/// UpdateEdgeValue - Update the value associated with a given edge.
|
||||
void UpdateEdgeValue(BlockEdge E, ValTy& V, const CFGBlock* TargetBlock) {
|
||||
void UpdateEdgeValue(BlockEdge E, ValTy& V, const CFGBlock *TargetBlock) {
|
||||
EdgeDataMapTy& M = D.getEdgeDataMap();
|
||||
typename EdgeDataMapTy::iterator I = M.find(E);
|
||||
|
||||
|
||||
@@ -84,13 +84,13 @@ public:
|
||||
|
||||
/// getEdgeData - Retrieves the dataflow values associated with a
|
||||
/// CFG edge.
|
||||
ValTy& getEdgeData(const BlockEdge& E) {
|
||||
ValTy& getEdgeData(const BlockEdge &E) {
|
||||
typename EdgeDataMapTy::iterator I = EdgeDataMap.find(E);
|
||||
assert (I != EdgeDataMap.end() && "No data associated with Edge.");
|
||||
return I->second;
|
||||
}
|
||||
|
||||
const ValTy& getEdgeData(const BlockEdge& E) const {
|
||||
const ValTy& getEdgeData(const BlockEdge &E) const {
|
||||
return reinterpret_cast<DataflowValues*>(this)->getEdgeData(E);
|
||||
}
|
||||
|
||||
@@ -98,13 +98,13 @@ public:
|
||||
/// specified CFGBlock. If the dataflow analysis is a forward analysis,
|
||||
/// this data is associated with the END of the block. If the analysis
|
||||
/// is a backwards analysis, it is associated with the ENTRY of the block.
|
||||
ValTy& getBlockData(const CFGBlock* B) {
|
||||
ValTy& getBlockData(const CFGBlock *B) {
|
||||
typename BlockDataMapTy::iterator I = BlockDataMap.find(B);
|
||||
assert (I != BlockDataMap.end() && "No data associated with block.");
|
||||
return I->second;
|
||||
}
|
||||
|
||||
const ValTy& getBlockData(const CFGBlock* B) const {
|
||||
const ValTy& getBlockData(const CFGBlock *B) const {
|
||||
return const_cast<DataflowValues*>(this)->getBlockData(B);
|
||||
}
|
||||
|
||||
@@ -114,14 +114,14 @@ public:
|
||||
/// If the analysis is a backwards analysis, it is associated with
|
||||
/// the point after a Stmt. This data is only computed for block-level
|
||||
/// expressions, and only when requested when the analysis is executed.
|
||||
ValTy& getStmtData(const Stmt* S) {
|
||||
ValTy& getStmtData(const Stmt *S) {
|
||||
assert (StmtDataMap && "Dataflow values were not computed for statements.");
|
||||
typename StmtDataMapTy::iterator I = StmtDataMap->find(S);
|
||||
assert (I != StmtDataMap->end() && "No data associated with statement.");
|
||||
return I->second;
|
||||
}
|
||||
|
||||
const ValTy& getStmtData(const Stmt* S) const {
|
||||
const ValTy& getStmtData(const Stmt *S) const {
|
||||
return const_cast<DataflowValues*>(this)->getStmtData(S);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,17 +66,17 @@ private:
|
||||
ProgramPoint();
|
||||
|
||||
protected:
|
||||
ProgramPoint(const void* P, Kind k, const LocationContext *l,
|
||||
ProgramPoint(const void *P, Kind k, const LocationContext *l,
|
||||
const ProgramPointTag *tag = 0)
|
||||
: Data(P, static_cast<const void*>(NULL)), K(k), L(l), Tag(tag) {}
|
||||
|
||||
ProgramPoint(const void* P1, const void* P2, Kind k, const LocationContext *l,
|
||||
ProgramPoint(const void *P1, const void *P2, Kind k, const LocationContext *l,
|
||||
const ProgramPointTag *tag = 0)
|
||||
: Data(P1, P2), K(k), L(l), Tag(tag) {}
|
||||
|
||||
protected:
|
||||
const void* getData1() const { return Data.first; }
|
||||
const void* getData2() const { return Data.second; }
|
||||
const void *getData1() const { return Data.first; }
|
||||
const void *getData2() const { return Data.second; }
|
||||
|
||||
public:
|
||||
Kind getKind() const { return K; }
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
return K == RHS.K && Data == RHS.Data && L == RHS.L && Tag == RHS.Tag;
|
||||
}
|
||||
|
||||
bool operator!=(const ProgramPoint& RHS) const {
|
||||
bool operator!=(const ProgramPoint &RHS) const {
|
||||
return K != RHS.K || Data != RHS.Data || L != RHS.L || Tag != RHS.Tag;
|
||||
}
|
||||
|
||||
@@ -113,16 +113,16 @@ public:
|
||||
|
||||
class BlockEntrance : public ProgramPoint {
|
||||
public:
|
||||
BlockEntrance(const CFGBlock* B, const LocationContext *L,
|
||||
BlockEntrance(const CFGBlock *B, const LocationContext *L,
|
||||
const ProgramPointTag *tag = 0)
|
||||
: ProgramPoint(B, BlockEntranceKind, L, tag) {}
|
||||
|
||||
const CFGBlock* getBlock() const {
|
||||
const CFGBlock *getBlock() const {
|
||||
return reinterpret_cast<const CFGBlock*>(getData1());
|
||||
}
|
||||
|
||||
const CFGElement getFirstElement() const {
|
||||
const CFGBlock* B = getBlock();
|
||||
const CFGBlock *B = getBlock();
|
||||
return B->empty() ? CFGElement() : B->front();
|
||||
}
|
||||
|
||||
@@ -139,14 +139,14 @@ public:
|
||||
|
||||
class BlockExit : public ProgramPoint {
|
||||
public:
|
||||
BlockExit(const CFGBlock* B, const LocationContext *L)
|
||||
BlockExit(const CFGBlock *B, const LocationContext *L)
|
||||
: ProgramPoint(B, BlockExitKind, L) {}
|
||||
|
||||
const CFGBlock* getBlock() const {
|
||||
const CFGBlock *getBlock() const {
|
||||
return reinterpret_cast<const CFGBlock*>(getData1());
|
||||
}
|
||||
|
||||
const Stmt* getTerminator() const {
|
||||
const Stmt *getTerminator() const {
|
||||
return getBlock()->getTerminator();
|
||||
}
|
||||
|
||||
@@ -188,16 +188,16 @@ public:
|
||||
|
||||
class PostStmt : public StmtPoint {
|
||||
protected:
|
||||
PostStmt(const Stmt* S, const void* data, Kind k, const LocationContext *L,
|
||||
PostStmt(const Stmt *S, const void *data, Kind k, const LocationContext *L,
|
||||
const ProgramPointTag *tag =0)
|
||||
: StmtPoint(S, data, k, L, tag) {}
|
||||
|
||||
public:
|
||||
explicit PostStmt(const Stmt* S, Kind k,
|
||||
explicit PostStmt(const Stmt *S, Kind k,
|
||||
const LocationContext *L, const ProgramPointTag *tag = 0)
|
||||
: StmtPoint(S, NULL, k, L, tag) {}
|
||||
|
||||
explicit PostStmt(const Stmt* S, const LocationContext *L,
|
||||
explicit PostStmt(const Stmt *S, const LocationContext *L,
|
||||
const ProgramPointTag *tag = 0)
|
||||
: StmtPoint(S, NULL, PostStmtKind, L, tag) {}
|
||||
|
||||
@@ -209,7 +209,7 @@ public:
|
||||
|
||||
class PostStmtCustom : public PostStmt {
|
||||
public:
|
||||
PostStmtCustom(const Stmt* S,
|
||||
PostStmtCustom(const Stmt *S,
|
||||
const std::pair<const void*, const void*>* TaggedData,\
|
||||
const LocationContext *L)
|
||||
: PostStmt(S, TaggedData, PostStmtCustomKind, L) {}
|
||||
@@ -219,9 +219,9 @@ public:
|
||||
*reinterpret_cast<const std::pair<const void*, const void*>*>(getData2());
|
||||
}
|
||||
|
||||
const void* getTag() const { return getTaggedPair().first; }
|
||||
const void *getTag() const { return getTaggedPair().first; }
|
||||
|
||||
const void* getTaggedData() const { return getTaggedPair().second; }
|
||||
const void *getTaggedData() const { return getTaggedPair().second; }
|
||||
|
||||
static bool classof(const ProgramPoint* Location) {
|
||||
return Location->getKind() == PostStmtCustomKind;
|
||||
@@ -231,7 +231,7 @@ public:
|
||||
// PostCondition represents the post program point of a branch condition.
|
||||
class PostCondition : public PostStmt {
|
||||
public:
|
||||
PostCondition(const Stmt* S, const LocationContext *L,
|
||||
PostCondition(const Stmt *S, const LocationContext *L,
|
||||
const ProgramPointTag *tag = 0)
|
||||
: PostStmt(S, PostConditionKind, L, tag) {}
|
||||
|
||||
@@ -276,7 +276,7 @@ public:
|
||||
|
||||
class PostLoad : public PostStmt {
|
||||
public:
|
||||
PostLoad(const Stmt* S, const LocationContext *L,
|
||||
PostLoad(const Stmt *S, const LocationContext *L,
|
||||
const ProgramPointTag *tag = 0)
|
||||
: PostStmt(S, PostLoadKind, L, tag) {}
|
||||
|
||||
@@ -287,7 +287,7 @@ public:
|
||||
|
||||
class PostStore : public PostStmt {
|
||||
public:
|
||||
PostStore(const Stmt* S, const LocationContext *L,
|
||||
PostStore(const Stmt *S, const LocationContext *L,
|
||||
const ProgramPointTag *tag = 0)
|
||||
: PostStmt(S, PostStoreKind, L, tag) {}
|
||||
|
||||
@@ -298,7 +298,7 @@ public:
|
||||
|
||||
class PostLValue : public PostStmt {
|
||||
public:
|
||||
PostLValue(const Stmt* S, const LocationContext *L,
|
||||
PostLValue(const Stmt *S, const LocationContext *L,
|
||||
const ProgramPointTag *tag = 0)
|
||||
: PostStmt(S, PostLValueKind, L, tag) {}
|
||||
|
||||
@@ -309,7 +309,7 @@ public:
|
||||
|
||||
class PostPurgeDeadSymbols : public PostStmt {
|
||||
public:
|
||||
PostPurgeDeadSymbols(const Stmt* S, const LocationContext *L,
|
||||
PostPurgeDeadSymbols(const Stmt *S, const LocationContext *L,
|
||||
const ProgramPointTag *tag = 0)
|
||||
: PostStmt(S, PostPurgeDeadSymbolsKind, L, tag) {}
|
||||
|
||||
@@ -320,14 +320,14 @@ public:
|
||||
|
||||
class BlockEdge : public ProgramPoint {
|
||||
public:
|
||||
BlockEdge(const CFGBlock* B1, const CFGBlock* B2, const LocationContext *L)
|
||||
BlockEdge(const CFGBlock *B1, const CFGBlock *B2, const LocationContext *L)
|
||||
: ProgramPoint(B1, B2, BlockEdgeKind, L) {}
|
||||
|
||||
const CFGBlock* getSrc() const {
|
||||
const CFGBlock *getSrc() const {
|
||||
return static_cast<const CFGBlock*>(getData1());
|
||||
}
|
||||
|
||||
const CFGBlock* getDst() const {
|
||||
const CFGBlock *getDst() const {
|
||||
return static_cast<const CFGBlock*>(getData2());
|
||||
}
|
||||
|
||||
@@ -420,12 +420,12 @@ static inline clang::ProgramPoint getTombstoneKey() {
|
||||
return clang::BlockEntrance(reinterpret_cast<clang::CFGBlock*>(x), 0);
|
||||
}
|
||||
|
||||
static unsigned getHashValue(const clang::ProgramPoint& Loc) {
|
||||
static unsigned getHashValue(const clang::ProgramPoint &Loc) {
|
||||
return Loc.getHashValue();
|
||||
}
|
||||
|
||||
static bool isEqual(const clang::ProgramPoint& L,
|
||||
const clang::ProgramPoint& R) {
|
||||
static bool isEqual(const clang::ProgramPoint &L,
|
||||
const clang::ProgramPoint &R) {
|
||||
return L == R;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,16 +62,16 @@ struct DeclBitVector_Types {
|
||||
AnalysisDataTy() : NDecls(0) {}
|
||||
virtual ~AnalysisDataTy() {}
|
||||
|
||||
bool isTracked(const NamedDecl* SD) { return DMap.find(SD) != DMap.end(); }
|
||||
bool isTracked(const NamedDecl *SD) { return DMap.find(SD) != DMap.end(); }
|
||||
|
||||
Idx getIdx(const NamedDecl* SD) const {
|
||||
Idx getIdx(const NamedDecl *SD) const {
|
||||
DMapTy::const_iterator I = DMap.find(SD);
|
||||
return I == DMap.end() ? Idx() : Idx(I->second);
|
||||
}
|
||||
|
||||
unsigned getNumDecls() const { return NDecls; }
|
||||
|
||||
void Register(const NamedDecl* SD) {
|
||||
void Register(const NamedDecl *SD) {
|
||||
if (!isTracked(SD)) DMap[SD] = NDecls++;
|
||||
}
|
||||
|
||||
@@ -117,11 +117,11 @@ struct DeclBitVector_Types {
|
||||
}
|
||||
|
||||
llvm::BitVector::reference
|
||||
operator()(const NamedDecl* ND, const AnalysisDataTy& AD) {
|
||||
operator()(const NamedDecl *ND, const AnalysisDataTy& AD) {
|
||||
return getBit(AD.getIdx(ND));
|
||||
}
|
||||
|
||||
bool operator()(const NamedDecl* ND, const AnalysisDataTy& AD) const {
|
||||
bool operator()(const NamedDecl *ND, const AnalysisDataTy& AD) const {
|
||||
return getBit(AD.getIdx(ND));
|
||||
}
|
||||
|
||||
@@ -171,14 +171,14 @@ struct StmtDeclBitVector_Types {
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
class AnalysisDataTy : public DeclBitVector_Types::AnalysisDataTy {
|
||||
ASTContext* ctx;
|
||||
ASTContext *ctx;
|
||||
CFG* cfg;
|
||||
public:
|
||||
AnalysisDataTy() : ctx(0), cfg(0) {}
|
||||
virtual ~AnalysisDataTy() {}
|
||||
|
||||
void setContext(ASTContext& c) { ctx = &c; }
|
||||
ASTContext& getContext() {
|
||||
void setContext(ASTContext &c) { ctx = &c; }
|
||||
ASTContext &getContext() {
|
||||
assert(ctx && "ASTContext should not be NULL.");
|
||||
return *ctx;
|
||||
}
|
||||
@@ -186,10 +186,10 @@ struct StmtDeclBitVector_Types {
|
||||
void setCFG(CFG& c) { cfg = &c; }
|
||||
CFG& getCFG() { assert(cfg && "CFG should not be NULL."); return *cfg; }
|
||||
|
||||
bool isTracked(const Stmt* S) { return cfg->isBlkExpr(S); }
|
||||
bool isTracked(const Stmt *S) { return cfg->isBlkExpr(S); }
|
||||
using DeclBitVector_Types::AnalysisDataTy::isTracked;
|
||||
|
||||
unsigned getIdx(const Stmt* S) const {
|
||||
unsigned getIdx(const Stmt *S) const {
|
||||
CFG::BlkExprNumTy I = cfg->getBlkExprNum(S);
|
||||
assert(I && "Stmtession not tracked for bitvector.");
|
||||
return I;
|
||||
@@ -248,11 +248,11 @@ struct StmtDeclBitVector_Types {
|
||||
}
|
||||
|
||||
llvm::BitVector::reference
|
||||
operator()(const Stmt* S, const AnalysisDataTy& AD) {
|
||||
operator()(const Stmt *S, const AnalysisDataTy& AD) {
|
||||
return BlkExprBV[AD.getIdx(S)];
|
||||
}
|
||||
const llvm::BitVector::reference
|
||||
operator()(const Stmt* S, const AnalysisDataTy& AD) const {
|
||||
operator()(const Stmt *S, const AnalysisDataTy& AD) const {
|
||||
return const_cast<ValTy&>(*this)(S,AD);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ static_cast<ImplClass*>(this)->Visit##CLASS##Decl( \
|
||||
static_cast<CLASS##Decl*>(D)); \
|
||||
break;
|
||||
|
||||
#define DEFAULT_DISPATCH(CLASS) void Visit##CLASS##Decl(CLASS##Decl* D) {}
|
||||
#define DEFAULT_DISPATCH_VARDECL(CLASS) void Visit##CLASS##Decl(CLASS##Decl* D)\
|
||||
#define DEFAULT_DISPATCH(CLASS) void Visit##CLASS##Decl(CLASS##Decl *D) {}
|
||||
#define DEFAULT_DISPATCH_VARDECL(CLASS) void Visit##CLASS##Decl(CLASS##Decl *D)\
|
||||
{ static_cast<ImplClass*>(this)->VisitVarDecl(D); }
|
||||
|
||||
|
||||
@@ -38,23 +38,23 @@ template <typename ImplClass>
|
||||
class CFGRecStmtDeclVisitor : public CFGRecStmtVisitor<ImplClass> {
|
||||
public:
|
||||
|
||||
void VisitDeclRefExpr(DeclRefExpr* DR) {
|
||||
void VisitDeclRefExpr(DeclRefExpr *DR) {
|
||||
static_cast<ImplClass*>(this)->VisitDecl(DR->getDecl());
|
||||
}
|
||||
|
||||
void VisitDeclStmt(DeclStmt* DS) {
|
||||
void VisitDeclStmt(DeclStmt *DS) {
|
||||
for (DeclStmt::decl_iterator DI = DS->decl_begin(), DE = DS->decl_end();
|
||||
DI != DE; ++DI) {
|
||||
Decl* D = *DI;
|
||||
Decl *D = *DI;
|
||||
static_cast<ImplClass*>(this)->VisitDecl(D);
|
||||
// Visit the initializer.
|
||||
if (VarDecl* VD = dyn_cast<VarDecl>(D))
|
||||
if (Expr* I = VD->getInit())
|
||||
if (VarDecl *VD = dyn_cast<VarDecl>(D))
|
||||
if (Expr *I = VD->getInit())
|
||||
static_cast<ImplClass*>(this)->Visit(I);
|
||||
}
|
||||
}
|
||||
|
||||
void VisitDecl(Decl* D) {
|
||||
void VisitDecl(Decl *D) {
|
||||
switch (D->getKind()) {
|
||||
DISPATCH_CASE(Function)
|
||||
DISPATCH_CASE(CXXMethod)
|
||||
|
||||
@@ -22,7 +22,7 @@ template <typename ImplClass>
|
||||
class CFGRecStmtVisitor : public CFGStmtVisitor<ImplClass,void> {
|
||||
public:
|
||||
|
||||
void VisitStmt(Stmt* S) {
|
||||
void VisitStmt(Stmt *S) {
|
||||
static_cast< ImplClass* >(this)->VisitChildren(S);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ break;
|
||||
}
|
||||
|
||||
// Defining operator() allows the visitor to be used as a C++ style functor.
|
||||
void operator()(Stmt* S) { static_cast<ImplClass*>(this)->BlockStmt_Visit(S);}
|
||||
void operator()(Stmt *S) { static_cast<ImplClass*>(this)->BlockStmt_Visit(S);}
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
@@ -33,7 +33,7 @@ static_cast<ImplClass*>(this)->BlockStmt_Visit ## CLASS(static_cast<CLASS*>(S));
|
||||
|
||||
template <typename ImplClass, typename RetTy=void>
|
||||
class CFGStmtVisitor : public StmtVisitor<ImplClass,RetTy> {
|
||||
Stmt* CurrentBlkStmt;
|
||||
Stmt *CurrentBlkStmt;
|
||||
|
||||
struct NullifyStmt {
|
||||
Stmt*& S;
|
||||
@@ -45,9 +45,9 @@ class CFGStmtVisitor : public StmtVisitor<ImplClass,RetTy> {
|
||||
public:
|
||||
CFGStmtVisitor() : CurrentBlkStmt(NULL) {}
|
||||
|
||||
Stmt* getCurrentBlkStmt() const { return CurrentBlkStmt; }
|
||||
Stmt *getCurrentBlkStmt() const { return CurrentBlkStmt; }
|
||||
|
||||
RetTy Visit(Stmt* S) {
|
||||
RetTy Visit(Stmt *S) {
|
||||
if (S == CurrentBlkStmt ||
|
||||
!static_cast<ImplClass*>(this)->getCFG().isBlkExpr(S))
|
||||
return StmtVisitor<ImplClass,RetTy>::Visit(S);
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
/// the list of statements in a CFGBlock. For substatements, or when there
|
||||
/// is no implementation provided for a BlockStmt_XXX method, we default
|
||||
/// to using StmtVisitor's Visit method.
|
||||
RetTy BlockStmt_Visit(Stmt* S) {
|
||||
RetTy BlockStmt_Visit(Stmt *S) {
|
||||
CurrentBlkStmt = S;
|
||||
NullifyStmt cleanup(CurrentBlkStmt);
|
||||
|
||||
@@ -106,23 +106,23 @@ public:
|
||||
DEFAULT_BLOCKSTMT_VISIT(ConditionalOperator)
|
||||
DEFAULT_BLOCKSTMT_VISIT(BinaryConditionalOperator)
|
||||
|
||||
RetTy BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
|
||||
RetTy BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
|
||||
return static_cast<ImplClass*>(this)->BlockStmt_VisitStmt(S);
|
||||
}
|
||||
|
||||
RetTy BlockStmt_VisitCXXForRangeStmt(CXXForRangeStmt* S) {
|
||||
RetTy BlockStmt_VisitCXXForRangeStmt(CXXForRangeStmt *S) {
|
||||
return static_cast<ImplClass*>(this)->BlockStmt_VisitStmt(S);
|
||||
}
|
||||
|
||||
RetTy BlockStmt_VisitImplicitControlFlowExpr(Expr* E) {
|
||||
RetTy BlockStmt_VisitImplicitControlFlowExpr(Expr *E) {
|
||||
return static_cast<ImplClass*>(this)->BlockStmt_VisitExpr(E);
|
||||
}
|
||||
|
||||
RetTy BlockStmt_VisitExpr(Expr* E) {
|
||||
RetTy BlockStmt_VisitExpr(Expr *E) {
|
||||
return static_cast<ImplClass*>(this)->BlockStmt_VisitStmt(E);
|
||||
}
|
||||
|
||||
RetTy BlockStmt_VisitStmt(Stmt* S) {
|
||||
RetTy BlockStmt_VisitStmt(Stmt *S) {
|
||||
return static_cast<ImplClass*>(this)->Visit(S);
|
||||
}
|
||||
|
||||
@@ -141,14 +141,14 @@ public:
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
/// VisitChildren: Call "Visit" on each child of S.
|
||||
void VisitChildren(Stmt* S) {
|
||||
void VisitChildren(Stmt *S) {
|
||||
|
||||
switch (S->getStmtClass()) {
|
||||
default:
|
||||
break;
|
||||
|
||||
case Stmt::StmtExprClass: {
|
||||
CompoundStmt* CS = cast<StmtExpr>(S)->getSubStmt();
|
||||
CompoundStmt *CS = cast<StmtExpr>(S)->getSubStmt();
|
||||
if (CS->body_empty()) return;
|
||||
static_cast<ImplClass*>(this)->Visit(CS->body_back());
|
||||
return;
|
||||
|
||||
@@ -36,7 +36,7 @@ class BugType;
|
||||
class BugReporter;
|
||||
class ExprEngine;
|
||||
|
||||
TransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
|
||||
TransferFuncs* MakeCFRefCountTF(ASTContext &Ctx, bool GCEnabled,
|
||||
const LangOptions& lopts);
|
||||
|
||||
void RegisterCallInliner(ExprEngine &Eng);
|
||||
|
||||
@@ -50,9 +50,9 @@ class BugType;
|
||||
class BugReporterVisitor : public llvm::FoldingSetNode {
|
||||
public:
|
||||
virtual ~BugReporterVisitor();
|
||||
virtual PathDiagnosticPiece* VisitNode(const ExplodedNode* N,
|
||||
const ExplodedNode* PrevN,
|
||||
BugReporterContext& BRC) = 0;
|
||||
virtual PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
|
||||
const ExplodedNode *PrevN,
|
||||
BugReporterContext &BRC) = 0;
|
||||
|
||||
virtual bool isOwnedByReporterContext() { return true; }
|
||||
virtual void Profile(llvm::FoldingSetNodeID &ID) const = 0;
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
public:
|
||||
virtual ~NodeResolver() {}
|
||||
virtual const ExplodedNode*
|
||||
getOriginalNode(const ExplodedNode* N) = 0;
|
||||
getOriginalNode(const ExplodedNode *N) = 0;
|
||||
};
|
||||
|
||||
BugReport(BugType& bt, StringRef desc, const ExplodedNode *errornode)
|
||||
@@ -101,13 +101,13 @@ public:
|
||||
BugType& getBugType() { return BT; }
|
||||
|
||||
// FIXME: Perhaps this should be moved into a subclass?
|
||||
const ExplodedNode* getErrorNode() const { return ErrorNode; }
|
||||
const ExplodedNode *getErrorNode() const { return ErrorNode; }
|
||||
|
||||
// FIXME: Do we need this? Maybe getLocation() should return a ProgramPoint
|
||||
// object.
|
||||
// FIXME: If we do need it, we can probably just make it private to
|
||||
// BugReporter.
|
||||
const Stmt* getStmt() const;
|
||||
const Stmt *getStmt() const;
|
||||
|
||||
const StringRef getDescription() const { return Description; }
|
||||
|
||||
@@ -121,8 +121,8 @@ public:
|
||||
}
|
||||
|
||||
// FIXME: Perhaps move this into a subclass.
|
||||
virtual PathDiagnosticPiece* getEndPath(BugReporterContext& BRC,
|
||||
const ExplodedNode* N);
|
||||
virtual PathDiagnosticPiece *getEndPath(BugReporterContext &BRC,
|
||||
const ExplodedNode *N);
|
||||
|
||||
/// getLocation - Return the "definitive" location of the reported bug.
|
||||
/// While a bug can span an entire path, usually there is a specific
|
||||
@@ -135,12 +135,12 @@ public:
|
||||
/// getRanges - Returns the source ranges associated with this bug.
|
||||
virtual std::pair<ranges_iterator, ranges_iterator> getRanges() const;
|
||||
|
||||
virtual PathDiagnosticPiece* VisitNode(const ExplodedNode* N,
|
||||
const ExplodedNode* PrevN,
|
||||
BugReporterContext& BR);
|
||||
virtual PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
|
||||
const ExplodedNode *PrevN,
|
||||
BugReporterContext &BR);
|
||||
|
||||
virtual void registerInitialVisitors(BugReporterContext& BRC,
|
||||
const ExplodedNode* N) {}
|
||||
virtual void registerInitialVisitors(BugReporterContext &BRC,
|
||||
const ExplodedNode *N) {}
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@@ -166,9 +166,9 @@ public:
|
||||
std::list<BugReport*>::iterator impl;
|
||||
public:
|
||||
iterator(std::list<BugReport*>::iterator i) : impl(i) {}
|
||||
iterator& operator++() { ++impl; return *this; }
|
||||
bool operator==(const iterator& I) const { return I.impl == impl; }
|
||||
bool operator!=(const iterator& I) const { return I.impl != impl; }
|
||||
iterator &operator++() { ++impl; return *this; }
|
||||
bool operator==(const iterator &I) const { return I.impl == impl; }
|
||||
bool operator!=(const iterator &I) const { return I.impl != impl; }
|
||||
BugReport* operator*() const { return *impl; }
|
||||
BugReport* operator->() const { return *impl; }
|
||||
};
|
||||
@@ -177,9 +177,9 @@ public:
|
||||
std::list<BugReport*>::const_iterator impl;
|
||||
public:
|
||||
const_iterator(std::list<BugReport*>::const_iterator i) : impl(i) {}
|
||||
const_iterator& operator++() { ++impl; return *this; }
|
||||
bool operator==(const const_iterator& I) const { return I.impl == impl; }
|
||||
bool operator!=(const const_iterator& I) const { return I.impl != impl; }
|
||||
const_iterator &operator++() { ++impl; return *this; }
|
||||
bool operator==(const const_iterator &I) const { return I.impl == impl; }
|
||||
bool operator!=(const const_iterator &I) const { return I.impl != impl; }
|
||||
const BugReport* operator*() const { return *impl; }
|
||||
const BugReport* operator->() const { return *impl; }
|
||||
};
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
|
||||
~EnhancedBugReport() {}
|
||||
|
||||
void registerInitialVisitors(BugReporterContext& BRC, const ExplodedNode* N) {
|
||||
void registerInitialVisitors(BugReporterContext &BRC, const ExplodedNode *N) {
|
||||
for (Creators::iterator I = creators.begin(), E = creators.end(); I!=E; ++I)
|
||||
I->first(BRC, I->second, N);
|
||||
}
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
virtual ~BugReporterData();
|
||||
virtual Diagnostic& getDiagnostic() = 0;
|
||||
virtual PathDiagnosticClient* getPathDiagnosticClient() = 0;
|
||||
virtual ASTContext& getASTContext() = 0;
|
||||
virtual ASTContext &getASTContext() = 0;
|
||||
virtual SourceManager& getSourceManager() = 0;
|
||||
};
|
||||
|
||||
@@ -321,7 +321,7 @@ public:
|
||||
EQClasses_iterator EQClasses_begin() { return EQClasses.begin(); }
|
||||
EQClasses_iterator EQClasses_end() { return EQClasses.end(); }
|
||||
|
||||
ASTContext& getContext() { return D.getASTContext(); }
|
||||
ASTContext &getContext() { return D.getASTContext(); }
|
||||
|
||||
SourceManager& getSourceManager() { return D.getSourceManager(); }
|
||||
|
||||
@@ -450,7 +450,7 @@ public:
|
||||
return getStateManager().getSValBuilder();
|
||||
}
|
||||
|
||||
ASTContext& getASTContext() {
|
||||
ASTContext &getASTContext() {
|
||||
return BR.getContext();
|
||||
}
|
||||
|
||||
@@ -492,10 +492,10 @@ const Stmt *GetRetValExpr(const ExplodedNode *N);
|
||||
|
||||
void registerConditionVisitor(BugReporterContext &BRC);
|
||||
|
||||
void registerTrackNullOrUndefValue(BugReporterContext& BRC, const void *stmt,
|
||||
const ExplodedNode* N);
|
||||
void registerTrackNullOrUndefValue(BugReporterContext &BRC, const void *stmt,
|
||||
const ExplodedNode *N);
|
||||
|
||||
void registerFindLastStore(BugReporterContext& BRC, const void *memregion,
|
||||
void registerFindLastStore(BugReporterContext &BRC, const void *memregion,
|
||||
const ExplodedNode *N);
|
||||
|
||||
void registerNilReceiverVisitor(BugReporterContext &BRC);
|
||||
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
: &FixItHints[0] + FixItHints.size();
|
||||
}
|
||||
|
||||
static inline bool classof(const PathDiagnosticPiece* P) {
|
||||
static inline bool classof(const PathDiagnosticPiece *P) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ public:
|
||||
|
||||
~PathDiagnosticEventPiece();
|
||||
|
||||
static inline bool classof(const PathDiagnosticPiece* P) {
|
||||
static inline bool classof(const PathDiagnosticPiece *P) {
|
||||
return P->getKind() == Event;
|
||||
}
|
||||
};
|
||||
@@ -320,7 +320,7 @@ public:
|
||||
const_iterator begin() const { return LPairs.begin(); }
|
||||
const_iterator end() const { return LPairs.end(); }
|
||||
|
||||
static inline bool classof(const PathDiagnosticPiece* P) {
|
||||
static inline bool classof(const PathDiagnosticPiece *P) {
|
||||
return P->getKind() == ControlFlow;
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ public:
|
||||
|
||||
bool containsEvent() const;
|
||||
|
||||
void push_back(PathDiagnosticPiece* P) { SubPieces.push_back(P); }
|
||||
void push_back(PathDiagnosticPiece *P) { SubPieces.push_back(P); }
|
||||
|
||||
typedef std::vector<PathDiagnosticPiece*>::iterator iterator;
|
||||
iterator begin() { return SubPieces.begin(); }
|
||||
@@ -352,7 +352,7 @@ public:
|
||||
const_iterator begin() const { return SubPieces.begin(); }
|
||||
const_iterator end() const { return SubPieces.end(); }
|
||||
|
||||
static inline bool classof(const PathDiagnosticPiece* P) {
|
||||
static inline bool classof(const PathDiagnosticPiece *P) {
|
||||
return P->getKind() == Macro;
|
||||
}
|
||||
|
||||
@@ -392,23 +392,23 @@ public:
|
||||
return rbegin()->getLocation();
|
||||
}
|
||||
|
||||
void push_front(PathDiagnosticPiece* piece) {
|
||||
void push_front(PathDiagnosticPiece *piece) {
|
||||
assert(piece);
|
||||
path.push_front(piece);
|
||||
++Size;
|
||||
}
|
||||
|
||||
void push_back(PathDiagnosticPiece* piece) {
|
||||
void push_back(PathDiagnosticPiece *piece) {
|
||||
assert(piece);
|
||||
path.push_back(piece);
|
||||
++Size;
|
||||
}
|
||||
|
||||
PathDiagnosticPiece* back() {
|
||||
PathDiagnosticPiece *back() {
|
||||
return path.back();
|
||||
}
|
||||
|
||||
const PathDiagnosticPiece* back() const {
|
||||
const PathDiagnosticPiece *back() const {
|
||||
return path.back();
|
||||
}
|
||||
|
||||
@@ -433,14 +433,14 @@ public:
|
||||
public:
|
||||
iterator(const ImplTy& i) : I(i) {}
|
||||
|
||||
bool operator==(const iterator& X) const { return I == X.I; }
|
||||
bool operator!=(const iterator& X) const { return I != X.I; }
|
||||
bool operator==(const iterator &X) const { return I == X.I; }
|
||||
bool operator!=(const iterator &X) const { return I != X.I; }
|
||||
|
||||
PathDiagnosticPiece& operator*() const { return **I; }
|
||||
PathDiagnosticPiece* operator->() const { return *I; }
|
||||
PathDiagnosticPiece *operator->() const { return *I; }
|
||||
|
||||
iterator& operator++() { ++I; return *this; }
|
||||
iterator& operator--() { --I; return *this; }
|
||||
iterator &operator++() { ++I; return *this; }
|
||||
iterator &operator--() { --I; return *this; }
|
||||
};
|
||||
|
||||
class const_iterator {
|
||||
@@ -459,14 +459,14 @@ public:
|
||||
public:
|
||||
const_iterator(const ImplTy& i) : I(i) {}
|
||||
|
||||
bool operator==(const const_iterator& X) const { return I == X.I; }
|
||||
bool operator!=(const const_iterator& X) const { return I != X.I; }
|
||||
bool operator==(const const_iterator &X) const { return I == X.I; }
|
||||
bool operator!=(const const_iterator &X) const { return I != X.I; }
|
||||
|
||||
reference operator*() const { return **I; }
|
||||
pointer operator->() const { return *I; }
|
||||
|
||||
const_iterator& operator++() { ++I; return *this; }
|
||||
const_iterator& operator--() { --I; return *this; }
|
||||
const_iterator &operator++() { ++I; return *this; }
|
||||
const_iterator &operator--() { --I; return *this; }
|
||||
};
|
||||
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
GraphExpander *defaultEval = 0);
|
||||
|
||||
/// \brief Run checkers for the entire Translation Unit.
|
||||
void runCheckersOnEndOfTranslationUnit(const TranslationUnitDecl* TU,
|
||||
void runCheckersOnEndOfTranslationUnit(const TranslationUnitDecl *TU,
|
||||
AnalysisManager &mgr,
|
||||
BugReporter &BR);
|
||||
|
||||
|
||||
@@ -68,25 +68,25 @@ class BasicValueFactory {
|
||||
typedef llvm::FoldingSet<llvm::FoldingSetNodeWrapper<llvm::APSInt> >
|
||||
APSIntSetTy;
|
||||
|
||||
ASTContext& Ctx;
|
||||
ASTContext &Ctx;
|
||||
llvm::BumpPtrAllocator& BPAlloc;
|
||||
|
||||
APSIntSetTy APSIntSet;
|
||||
void* PersistentSVals;
|
||||
void* PersistentSValPairs;
|
||||
void * PersistentSVals;
|
||||
void * PersistentSValPairs;
|
||||
|
||||
llvm::ImmutableList<SVal>::Factory SValListFactory;
|
||||
llvm::FoldingSet<CompoundValData> CompoundValDataSet;
|
||||
llvm::FoldingSet<LazyCompoundValData> LazyCompoundValDataSet;
|
||||
|
||||
public:
|
||||
BasicValueFactory(ASTContext& ctx, llvm::BumpPtrAllocator& Alloc)
|
||||
BasicValueFactory(ASTContext &ctx, llvm::BumpPtrAllocator& Alloc)
|
||||
: Ctx(ctx), BPAlloc(Alloc), PersistentSVals(0), PersistentSValPairs(0),
|
||||
SValListFactory(Alloc) {}
|
||||
|
||||
~BasicValueFactory();
|
||||
|
||||
ASTContext& getContext() const { return Ctx; }
|
||||
ASTContext &getContext() const { return Ctx; }
|
||||
|
||||
const llvm::APSInt& getValue(const llvm::APSInt& X);
|
||||
const llvm::APSInt& getValue(const llvm::APInt& X, bool isUnsigned);
|
||||
|
||||
@@ -27,9 +27,9 @@ class StackFrameContext;
|
||||
namespace ento {
|
||||
|
||||
class BlockCounter {
|
||||
void* Data;
|
||||
void *Data;
|
||||
|
||||
BlockCounter(void* D) : Data(D) {}
|
||||
BlockCounter(void *D) : Data(D) {}
|
||||
|
||||
public:
|
||||
BlockCounter() : Data(0) {}
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
unsigned BlockID) const;
|
||||
|
||||
class Factory {
|
||||
void* F;
|
||||
void *F;
|
||||
public:
|
||||
Factory(llvm::BumpPtrAllocator& Alloc);
|
||||
~Factory();
|
||||
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
ExplodedNode *generateNodeImpl(const Stmt* stmt, const GRState *state,
|
||||
ExplodedNode *generateNodeImpl(const Stmt *stmt, const GRState *state,
|
||||
bool markAsSink, const ProgramPointTag *tag) {
|
||||
ExplodedNode *node = B.generateNode(stmt, state, Pred, tag);
|
||||
if (markAsSink && node)
|
||||
@@ -175,7 +175,7 @@ private:
|
||||
return node;
|
||||
}
|
||||
|
||||
ExplodedNode *generateNodeImpl(const Stmt* stmt, const GRState *state,
|
||||
ExplodedNode *generateNodeImpl(const Stmt *stmt, const GRState *state,
|
||||
ExplodedNode *pred, bool markAsSink) {
|
||||
ExplodedNode *node = B.generateNode(stmt, state, pred, checkerTag);
|
||||
if (markAsSink && node)
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
virtual const GRState *removeDeadBindings(const GRState *state,
|
||||
SymbolReaper& SymReaper) = 0;
|
||||
|
||||
virtual void print(const GRState *state, raw_ostream& Out,
|
||||
virtual void print(const GRState *state, raw_ostream &Out,
|
||||
const char* nl, const char *sep) = 0;
|
||||
|
||||
virtual void EndPath(const GRState *state) {}
|
||||
|
||||
@@ -79,16 +79,16 @@ private:
|
||||
/// usually because it could not reason about something.
|
||||
BlocksAborted blocksAborted;
|
||||
|
||||
void generateNode(const ProgramPoint& Loc, const GRState* State,
|
||||
ExplodedNode* Pred);
|
||||
void generateNode(const ProgramPoint &Loc, const GRState *State,
|
||||
ExplodedNode *Pred);
|
||||
|
||||
void HandleBlockEdge(const BlockEdge& E, ExplodedNode* Pred);
|
||||
void HandleBlockEntrance(const BlockEntrance& E, ExplodedNode* Pred);
|
||||
void HandleBlockExit(const CFGBlock* B, ExplodedNode* Pred);
|
||||
void HandlePostStmt(const CFGBlock* B, unsigned StmtIdx, ExplodedNode *Pred);
|
||||
void HandleBlockEdge(const BlockEdge &E, ExplodedNode *Pred);
|
||||
void HandleBlockEntrance(const BlockEntrance &E, ExplodedNode *Pred);
|
||||
void HandleBlockExit(const CFGBlock *B, ExplodedNode *Pred);
|
||||
void HandlePostStmt(const CFGBlock *B, unsigned StmtIdx, ExplodedNode *Pred);
|
||||
|
||||
void HandleBranch(const Stmt* Cond, const Stmt* Term, const CFGBlock* B,
|
||||
ExplodedNode* Pred);
|
||||
void HandleBranch(const Stmt *Cond, const Stmt *Term, const CFGBlock *B,
|
||||
ExplodedNode *Pred);
|
||||
void HandleCallEnter(const CallEnter &L, const CFGBlock *Block,
|
||||
unsigned Index, ExplodedNode *Pred);
|
||||
void HandleCallExit(const CallExit &L, ExplodedNode *Pred);
|
||||
@@ -162,9 +162,9 @@ public:
|
||||
|
||||
class StmtNodeBuilder {
|
||||
CoreEngine& Eng;
|
||||
const CFGBlock& B;
|
||||
const CFGBlock &B;
|
||||
const unsigned Idx;
|
||||
ExplodedNode* Pred;
|
||||
ExplodedNode *Pred;
|
||||
GRStateManager& Mgr;
|
||||
|
||||
public:
|
||||
@@ -177,15 +177,15 @@ public:
|
||||
typedef llvm::SmallPtrSet<ExplodedNode*,5> DeferredTy;
|
||||
DeferredTy Deferred;
|
||||
|
||||
void GenerateAutoTransition(ExplodedNode* N);
|
||||
void GenerateAutoTransition(ExplodedNode *N);
|
||||
|
||||
public:
|
||||
StmtNodeBuilder(const CFGBlock* b, unsigned idx, ExplodedNode* N,
|
||||
StmtNodeBuilder(const CFGBlock *b, unsigned idx, ExplodedNode *N,
|
||||
CoreEngine* e, GRStateManager &mgr);
|
||||
|
||||
~StmtNodeBuilder();
|
||||
|
||||
ExplodedNode* getPredecessor() const { return Pred; }
|
||||
ExplodedNode *getPredecessor() const { return Pred; }
|
||||
|
||||
// FIXME: This should not be exposed.
|
||||
WorkList *getWorkList() { return Eng.WList; }
|
||||
@@ -198,12 +198,12 @@ public:
|
||||
B.getBlockID());
|
||||
}
|
||||
|
||||
ExplodedNode* generateNode(PostStmt PP,const GRState* St,ExplodedNode* Pred) {
|
||||
ExplodedNode *generateNode(PostStmt PP,const GRState *St,ExplodedNode *Pred) {
|
||||
hasGeneratedNode = true;
|
||||
return generateNodeInternal(PP, St, Pred);
|
||||
}
|
||||
|
||||
ExplodedNode* generateNode(const Stmt *S, const GRState *St,
|
||||
ExplodedNode *generateNode(const Stmt *S, const GRState *St,
|
||||
ExplodedNode *Pred, ProgramPoint::Kind K,
|
||||
const ProgramPointTag *tag = 0) {
|
||||
hasGeneratedNode = true;
|
||||
@@ -214,53 +214,53 @@ public:
|
||||
return generateNodeInternal(S, St, Pred, K, tag ? tag : Tag);
|
||||
}
|
||||
|
||||
ExplodedNode* generateNode(const Stmt *S, const GRState *St,
|
||||
ExplodedNode *generateNode(const Stmt *S, const GRState *St,
|
||||
ExplodedNode *Pred,
|
||||
const ProgramPointTag *tag = 0) {
|
||||
return generateNode(S, St, Pred, PointKind, tag);
|
||||
}
|
||||
|
||||
ExplodedNode *generateNode(const ProgramPoint &PP, const GRState* State,
|
||||
ExplodedNode* Pred) {
|
||||
ExplodedNode *generateNode(const ProgramPoint &PP, const GRState *State,
|
||||
ExplodedNode *Pred) {
|
||||
hasGeneratedNode = true;
|
||||
return generateNodeInternal(PP, State, Pred);
|
||||
}
|
||||
|
||||
ExplodedNode*
|
||||
generateNodeInternal(const ProgramPoint &PP, const GRState* State,
|
||||
ExplodedNode* Pred);
|
||||
generateNodeInternal(const ProgramPoint &PP, const GRState *State,
|
||||
ExplodedNode *Pred);
|
||||
|
||||
ExplodedNode*
|
||||
generateNodeInternal(const Stmt* S, const GRState* State, ExplodedNode* Pred,
|
||||
generateNodeInternal(const Stmt *S, const GRState *State, ExplodedNode *Pred,
|
||||
ProgramPoint::Kind K = ProgramPoint::PostStmtKind,
|
||||
const ProgramPointTag *tag = 0);
|
||||
|
||||
/// getStmt - Return the current block-level expression associated with
|
||||
/// this builder.
|
||||
const Stmt* getStmt() const {
|
||||
const Stmt *getStmt() const {
|
||||
const CFGStmt *CS = B[Idx].getAs<CFGStmt>();
|
||||
return CS ? CS->getStmt() : 0;
|
||||
}
|
||||
|
||||
/// getBlock - Return the CFGBlock associated with the block-level expression
|
||||
/// of this builder.
|
||||
const CFGBlock* getBlock() const { return &B; }
|
||||
const CFGBlock *getBlock() const { return &B; }
|
||||
|
||||
unsigned getIndex() const { return Idx; }
|
||||
|
||||
ExplodedNode* MakeNode(ExplodedNodeSet& Dst, const Stmt* S,
|
||||
ExplodedNode* Pred, const GRState* St) {
|
||||
ExplodedNode *MakeNode(ExplodedNodeSet &Dst, const Stmt *S,
|
||||
ExplodedNode *Pred, const GRState *St) {
|
||||
return MakeNode(Dst, S, Pred, St, PointKind);
|
||||
}
|
||||
|
||||
ExplodedNode* MakeNode(ExplodedNodeSet& Dst, const Stmt* S,ExplodedNode* Pred,
|
||||
const GRState* St, ProgramPoint::Kind K);
|
||||
ExplodedNode *MakeNode(ExplodedNodeSet &Dst, const Stmt *S,ExplodedNode *Pred,
|
||||
const GRState *St, ProgramPoint::Kind K);
|
||||
|
||||
ExplodedNode* MakeSinkNode(ExplodedNodeSet& Dst, const Stmt* S,
|
||||
ExplodedNode* Pred, const GRState* St) {
|
||||
ExplodedNode *MakeSinkNode(ExplodedNodeSet &Dst, const Stmt *S,
|
||||
ExplodedNode *Pred, const GRState *St) {
|
||||
bool Tmp = BuildSinks;
|
||||
BuildSinks = true;
|
||||
ExplodedNode* N = MakeNode(Dst, S, Pred, St);
|
||||
ExplodedNode *N = MakeNode(Dst, S, Pred, St);
|
||||
BuildSinks = Tmp;
|
||||
return N;
|
||||
}
|
||||
@@ -268,10 +268,10 @@ public:
|
||||
|
||||
class BranchNodeBuilder {
|
||||
CoreEngine& Eng;
|
||||
const CFGBlock* Src;
|
||||
const CFGBlock* DstT;
|
||||
const CFGBlock* DstF;
|
||||
ExplodedNode* Pred;
|
||||
const CFGBlock *Src;
|
||||
const CFGBlock *DstT;
|
||||
const CFGBlock *DstF;
|
||||
ExplodedNode *Pred;
|
||||
|
||||
typedef SmallVector<ExplodedNode*,3> DeferredTy;
|
||||
DeferredTy Deferred;
|
||||
@@ -282,25 +282,25 @@ class BranchNodeBuilder {
|
||||
bool InFeasibleFalse;
|
||||
|
||||
public:
|
||||
BranchNodeBuilder(const CFGBlock* src, const CFGBlock* dstT,
|
||||
const CFGBlock* dstF, ExplodedNode* pred, CoreEngine* e)
|
||||
BranchNodeBuilder(const CFGBlock *src, const CFGBlock *dstT,
|
||||
const CFGBlock *dstF, ExplodedNode *pred, CoreEngine* e)
|
||||
: Eng(*e), Src(src), DstT(dstT), DstF(dstF), Pred(pred),
|
||||
GeneratedTrue(false), GeneratedFalse(false),
|
||||
InFeasibleTrue(!DstT), InFeasibleFalse(!DstF) {}
|
||||
|
||||
~BranchNodeBuilder();
|
||||
|
||||
ExplodedNode* getPredecessor() const { return Pred; }
|
||||
ExplodedNode *getPredecessor() const { return Pred; }
|
||||
|
||||
const ExplodedGraph& getGraph() const { return *Eng.G; }
|
||||
|
||||
BlockCounter getBlockCounter() const { return Eng.WList->getBlockCounter();}
|
||||
|
||||
ExplodedNode* generateNode(const Stmt *Condition, const GRState* State);
|
||||
ExplodedNode *generateNode(const Stmt *Condition, const GRState *State);
|
||||
|
||||
ExplodedNode* generateNode(const GRState* State, bool branch);
|
||||
ExplodedNode *generateNode(const GRState *State, bool branch);
|
||||
|
||||
const CFGBlock* getTargetBlock(bool branch) const {
|
||||
const CFGBlock *getTargetBlock(bool branch) const {
|
||||
return branch ? DstT : DstF;
|
||||
}
|
||||
|
||||
@@ -315,21 +315,21 @@ public:
|
||||
return branch ? !InFeasibleTrue : !InFeasibleFalse;
|
||||
}
|
||||
|
||||
const GRState* getState() const {
|
||||
const GRState *getState() const {
|
||||
return getPredecessor()->getState();
|
||||
}
|
||||
};
|
||||
|
||||
class IndirectGotoNodeBuilder {
|
||||
CoreEngine& Eng;
|
||||
const CFGBlock* Src;
|
||||
const CFGBlock& DispatchBlock;
|
||||
const Expr* E;
|
||||
ExplodedNode* Pred;
|
||||
const CFGBlock *Src;
|
||||
const CFGBlock &DispatchBlock;
|
||||
const Expr *E;
|
||||
ExplodedNode *Pred;
|
||||
|
||||
public:
|
||||
IndirectGotoNodeBuilder(ExplodedNode* pred, const CFGBlock* src,
|
||||
const Expr* e, const CFGBlock* dispatch, CoreEngine* eng)
|
||||
IndirectGotoNodeBuilder(ExplodedNode *pred, const CFGBlock *src,
|
||||
const Expr *e, const CFGBlock *dispatch, CoreEngine* eng)
|
||||
: Eng(*eng), Src(src), DispatchBlock(*dispatch), E(e), Pred(pred) {}
|
||||
|
||||
class iterator {
|
||||
@@ -339,8 +339,8 @@ public:
|
||||
iterator(CFGBlock::const_succ_iterator i) : I(i) {}
|
||||
public:
|
||||
|
||||
iterator& operator++() { ++I; return *this; }
|
||||
bool operator!=(const iterator& X) const { return I != X.I; }
|
||||
iterator &operator++() { ++I; return *this; }
|
||||
bool operator!=(const iterator &X) const { return I != X.I; }
|
||||
|
||||
const LabelDecl *getLabel() const {
|
||||
return llvm::cast<LabelStmt>((*I)->getLabel())->getDecl();
|
||||
@@ -354,23 +354,23 @@ public:
|
||||
iterator begin() { return iterator(DispatchBlock.succ_begin()); }
|
||||
iterator end() { return iterator(DispatchBlock.succ_end()); }
|
||||
|
||||
ExplodedNode* generateNode(const iterator& I, const GRState* State,
|
||||
ExplodedNode *generateNode(const iterator &I, const GRState *State,
|
||||
bool isSink = false);
|
||||
|
||||
const Expr* getTarget() const { return E; }
|
||||
const Expr *getTarget() const { return E; }
|
||||
|
||||
const GRState* getState() const { return Pred->State; }
|
||||
const GRState *getState() const { return Pred->State; }
|
||||
};
|
||||
|
||||
class SwitchNodeBuilder {
|
||||
CoreEngine& Eng;
|
||||
const CFGBlock* Src;
|
||||
const Expr* Condition;
|
||||
ExplodedNode* Pred;
|
||||
const CFGBlock *Src;
|
||||
const Expr *Condition;
|
||||
ExplodedNode *Pred;
|
||||
|
||||
public:
|
||||
SwitchNodeBuilder(ExplodedNode* pred, const CFGBlock* src,
|
||||
const Expr* condition, CoreEngine* eng)
|
||||
SwitchNodeBuilder(ExplodedNode *pred, const CFGBlock *src,
|
||||
const Expr *condition, CoreEngine* eng)
|
||||
: Eng(*eng), Src(src), Condition(condition), Pred(pred) {}
|
||||
|
||||
class iterator {
|
||||
@@ -380,15 +380,15 @@ public:
|
||||
iterator(CFGBlock::const_succ_reverse_iterator i) : I(i) {}
|
||||
|
||||
public:
|
||||
iterator& operator++() { ++I; return *this; }
|
||||
iterator &operator++() { ++I; return *this; }
|
||||
bool operator!=(const iterator &X) const { return I != X.I; }
|
||||
bool operator==(const iterator &X) const { return I == X.I; }
|
||||
|
||||
const CaseStmt* getCase() const {
|
||||
const CaseStmt *getCase() const {
|
||||
return llvm::cast<CaseStmt>((*I)->getLabel());
|
||||
}
|
||||
|
||||
const CFGBlock* getBlock() const {
|
||||
const CFGBlock *getBlock() const {
|
||||
return *I;
|
||||
}
|
||||
};
|
||||
@@ -400,14 +400,14 @@ public:
|
||||
return llvm::cast<SwitchStmt>(Src->getTerminator());
|
||||
}
|
||||
|
||||
ExplodedNode* generateCaseStmtNode(const iterator& I, const GRState* State);
|
||||
ExplodedNode *generateCaseStmtNode(const iterator &I, const GRState *State);
|
||||
|
||||
ExplodedNode* generateDefaultCaseNode(const GRState* State,
|
||||
ExplodedNode *generateDefaultCaseNode(const GRState *State,
|
||||
bool isSink = false);
|
||||
|
||||
const Expr* getCondition() const { return Condition; }
|
||||
const Expr *getCondition() const { return Condition; }
|
||||
|
||||
const GRState* getState() const { return Pred->State; }
|
||||
const GRState *getState() const { return Pred->State; }
|
||||
};
|
||||
|
||||
class GenericNodeBuilderImpl {
|
||||
@@ -428,7 +428,7 @@ public:
|
||||
|
||||
WorkList &getWorkList() { return *engine.WList; }
|
||||
|
||||
ExplodedNode* getPredecessor() const { return pred; }
|
||||
ExplodedNode *getPredecessor() const { return pred; }
|
||||
|
||||
BlockCounter getBlockCounter() const {
|
||||
return engine.WList->getBlockCounter();
|
||||
@@ -456,15 +456,15 @@ public:
|
||||
|
||||
class EndOfFunctionNodeBuilder {
|
||||
CoreEngine &Eng;
|
||||
const CFGBlock& B;
|
||||
ExplodedNode* Pred;
|
||||
const CFGBlock &B;
|
||||
ExplodedNode *Pred;
|
||||
const ProgramPointTag *Tag;
|
||||
|
||||
public:
|
||||
bool hasGeneratedNode;
|
||||
|
||||
public:
|
||||
EndOfFunctionNodeBuilder(const CFGBlock* b, ExplodedNode* N, CoreEngine* e,
|
||||
EndOfFunctionNodeBuilder(const CFGBlock *b, ExplodedNode *N, CoreEngine* e,
|
||||
const ProgramPointTag *tag = 0)
|
||||
: Eng(*e), B(*b), Pred(N), Tag(tag), hasGeneratedNode(false) {}
|
||||
|
||||
@@ -476,7 +476,7 @@ public:
|
||||
|
||||
WorkList &getWorkList() { return *Eng.WList; }
|
||||
|
||||
ExplodedNode* getPredecessor() const { return Pred; }
|
||||
ExplodedNode *getPredecessor() const { return Pred; }
|
||||
|
||||
BlockCounter getBlockCounter() const {
|
||||
return Eng.WList->getBlockCounter();
|
||||
@@ -488,14 +488,14 @@ public:
|
||||
B.getBlockID());
|
||||
}
|
||||
|
||||
ExplodedNode* generateNode(const GRState* State, ExplodedNode *P = 0,
|
||||
ExplodedNode *generateNode(const GRState *State, ExplodedNode *P = 0,
|
||||
const ProgramPointTag *tag = 0);
|
||||
|
||||
void GenerateCallExitNode(const GRState *state);
|
||||
|
||||
const CFGBlock* getBlock() const { return &B; }
|
||||
const CFGBlock *getBlock() const { return &B; }
|
||||
|
||||
const GRState* getState() const {
|
||||
const GRState *getState() const {
|
||||
return getPredecessor()->getState();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ private:
|
||||
Environment(BindingsTy eb)
|
||||
: ExprBindings(eb) {}
|
||||
|
||||
SVal lookupExpr(const Stmt* E) const;
|
||||
SVal lookupExpr(const Stmt *E) const;
|
||||
|
||||
public:
|
||||
typedef BindingsTy::iterator iterator;
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
/// getSVal - Fetches the current binding of the expression in the
|
||||
/// Environment.
|
||||
SVal getSVal(const Stmt* Ex, SValBuilder& svalBuilder,
|
||||
SVal getSVal(const Stmt *Ex, SValBuilder& svalBuilder,
|
||||
bool useOnlyDirectBindings = false) const;
|
||||
|
||||
/// Profile - Profile the contents of an Environment object for use
|
||||
|
||||
@@ -67,7 +67,7 @@ class ExplodedNode : public llvm::FoldingSetNode {
|
||||
return P & 0x1;
|
||||
}
|
||||
|
||||
void* getPtr() const {
|
||||
void *getPtr() const {
|
||||
assert (!getFlag());
|
||||
return reinterpret_cast<void*>(P & ~Mask);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ class ExplodedNode : public llvm::FoldingSetNode {
|
||||
|
||||
bool empty() const { return (P & ~Mask) == 0; }
|
||||
|
||||
void addNode(ExplodedNode* N, ExplodedGraph &G);
|
||||
void addNode(ExplodedNode *N, ExplodedGraph &G);
|
||||
|
||||
void replaceNode(ExplodedNode *node);
|
||||
|
||||
@@ -106,7 +106,7 @@ class ExplodedNode : public llvm::FoldingSetNode {
|
||||
const ProgramPoint Location;
|
||||
|
||||
/// State - The state associated with this node.
|
||||
const GRState* State;
|
||||
const GRState *State;
|
||||
|
||||
/// Preds - The predecessors of this node.
|
||||
NodeGroup Preds;
|
||||
@@ -116,7 +116,7 @@ class ExplodedNode : public llvm::FoldingSetNode {
|
||||
|
||||
public:
|
||||
|
||||
explicit ExplodedNode(const ProgramPoint& loc, const GRState* state)
|
||||
explicit ExplodedNode(const ProgramPoint &loc, const GRState *state)
|
||||
: Location(loc), State(state) {
|
||||
const_cast<GRState*>(State)->incrementReferenceCount();
|
||||
}
|
||||
@@ -142,13 +142,13 @@ public:
|
||||
return *getLocationContext()->getLiveVariables();
|
||||
}
|
||||
|
||||
const GRState* getState() const { return State; }
|
||||
const GRState *getState() const { return State; }
|
||||
|
||||
template <typename T>
|
||||
const T* getLocationAs() const { return llvm::dyn_cast<T>(&Location); }
|
||||
|
||||
static void Profile(llvm::FoldingSetNodeID &ID,
|
||||
const ProgramPoint& Loc, const GRState* state) {
|
||||
const ProgramPoint &Loc, const GRState *state) {
|
||||
ID.Add(Loc);
|
||||
ID.AddPointer(state);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
|
||||
/// addPredeccessor - Adds a predecessor to the current node, and
|
||||
/// in tandem add this node as a successor of the other node.
|
||||
void addPredecessor(ExplodedNode* V, ExplodedGraph &G);
|
||||
void addPredecessor(ExplodedNode *V, ExplodedGraph &G);
|
||||
|
||||
unsigned succ_size() const { return Succs.size(); }
|
||||
unsigned pred_size() const { return Preds.size(); }
|
||||
@@ -169,11 +169,11 @@ public:
|
||||
bool isSink() const { return Succs.getFlag(); }
|
||||
void markAsSink() { Succs.setFlag(); }
|
||||
|
||||
ExplodedNode* getFirstPred() {
|
||||
ExplodedNode *getFirstPred() {
|
||||
return pred_empty() ? NULL : *(pred_begin());
|
||||
}
|
||||
|
||||
const ExplodedNode* getFirstPred() const {
|
||||
const ExplodedNode *getFirstPred() const {
|
||||
return const_cast<ExplodedNode*>(this)->getFirstPred();
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
class Auditor {
|
||||
public:
|
||||
virtual ~Auditor();
|
||||
virtual void AddEdge(ExplodedNode* Src, ExplodedNode* Dst) = 0;
|
||||
virtual void AddEdge(ExplodedNode *Src, ExplodedNode *Dst) = 0;
|
||||
};
|
||||
|
||||
static void SetAuditor(Auditor* A);
|
||||
@@ -226,7 +226,7 @@ class InterExplodedGraphMap {
|
||||
friend class ExplodedGraph;
|
||||
|
||||
public:
|
||||
ExplodedNode* getMappedNode(const ExplodedNode* N) const;
|
||||
ExplodedNode *getMappedNode(const ExplodedNode *N) const;
|
||||
|
||||
InterExplodedGraphMap() {}
|
||||
virtual ~InterExplodedGraphMap() {}
|
||||
@@ -275,7 +275,7 @@ public:
|
||||
/// this pair exists, it is created. IsNew is set to true if
|
||||
/// the node was freshly created.
|
||||
|
||||
ExplodedNode* getNode(const ProgramPoint& L, const GRState *State,
|
||||
ExplodedNode *getNode(const ProgramPoint &L, const GRState *State,
|
||||
bool* IsNew = 0);
|
||||
|
||||
ExplodedGraph* MakeEmptyGraph() const {
|
||||
@@ -283,13 +283,13 @@ public:
|
||||
}
|
||||
|
||||
/// addRoot - Add an untyped node to the set of roots.
|
||||
ExplodedNode* addRoot(ExplodedNode* V) {
|
||||
ExplodedNode *addRoot(ExplodedNode *V) {
|
||||
Roots.push_back(V);
|
||||
return V;
|
||||
}
|
||||
|
||||
/// addEndOfPath - Add an untyped node to the set of EOP nodes.
|
||||
ExplodedNode* addEndOfPath(ExplodedNode* V) {
|
||||
ExplodedNode *addEndOfPath(ExplodedNode *V) {
|
||||
EndNodes.push_back(V);
|
||||
return V;
|
||||
}
|
||||
@@ -368,18 +368,18 @@ class ExplodedNodeSet {
|
||||
ImplTy Impl;
|
||||
|
||||
public:
|
||||
ExplodedNodeSet(ExplodedNode* N) {
|
||||
ExplodedNodeSet(ExplodedNode *N) {
|
||||
assert (N && !static_cast<ExplodedNode*>(N)->isSink());
|
||||
Impl.insert(N);
|
||||
}
|
||||
|
||||
ExplodedNodeSet() {}
|
||||
|
||||
inline void Add(ExplodedNode* N) {
|
||||
inline void Add(ExplodedNode *N) {
|
||||
if (N && !static_cast<ExplodedNode*>(N)->isSink()) Impl.insert(N);
|
||||
}
|
||||
|
||||
ExplodedNodeSet& operator=(const ExplodedNodeSet &X) {
|
||||
ExplodedNodeSet &operator=(const ExplodedNodeSet &X) {
|
||||
Impl = X.Impl;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -58,14 +58,14 @@ class ExprEngine : public SubEngine {
|
||||
SValBuilder &svalBuilder;
|
||||
|
||||
/// EntryNode - The immediate predecessor node.
|
||||
ExplodedNode* EntryNode;
|
||||
ExplodedNode *EntryNode;
|
||||
|
||||
/// CleanedState - The state for EntryNode "cleaned" of all dead
|
||||
/// variables and symbols (as determined by a liveness analysis).
|
||||
const GRState* CleanedState;
|
||||
const GRState *CleanedState;
|
||||
|
||||
/// currentStmt - The current block-level statement.
|
||||
const Stmt* currentStmt;
|
||||
const Stmt *currentStmt;
|
||||
|
||||
// Obj-C Class Identifiers.
|
||||
IdentifierInfo* NSExceptionII;
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
}
|
||||
|
||||
/// getContext - Return the ASTContext associated with this analysis.
|
||||
ASTContext& getContext() const { return AMgr.getASTContext(); }
|
||||
ASTContext &getContext() const { return AMgr.getASTContext(); }
|
||||
|
||||
virtual AnalysisManager &getAnalysisManager() { return AMgr; }
|
||||
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
|
||||
/// getInitialState - Return the initial state used for the root vertex
|
||||
/// in the ExplodedGraph.
|
||||
const GRState* getInitialState(const LocationContext *InitLoc);
|
||||
const GRState *getInitialState(const LocationContext *InitLoc);
|
||||
|
||||
ExplodedGraph& getGraph() { return G; }
|
||||
const ExplodedGraph& getGraph() const { return G; }
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
|
||||
/// ProcessBranch - Called by CoreEngine. Used to generate successor
|
||||
/// nodes by processing the 'effects' of a branch condition.
|
||||
void processBranch(const Stmt* Condition, const Stmt* Term,
|
||||
void processBranch(const Stmt *Condition, const Stmt *Term,
|
||||
BranchNodeBuilder& builder);
|
||||
|
||||
/// processIndirectGoto - Called by CoreEngine. Used to generate successor
|
||||
@@ -185,7 +185,7 @@ public:
|
||||
|
||||
/// wantsRegionChangeUpdate - Called by GRStateManager to determine if a
|
||||
/// region change should trigger a processRegionChanges update.
|
||||
bool wantsRegionChangeUpdate(const GRState* state);
|
||||
bool wantsRegionChangeUpdate(const GRState *state);
|
||||
|
||||
/// processRegionChanges - Called by GRStateManager whenever a change is made
|
||||
/// to the store. Used to update checkers that track region values.
|
||||
@@ -223,76 +223,76 @@ public:
|
||||
const CoreEngine &getCoreEngine() const { return Engine; }
|
||||
|
||||
public:
|
||||
ExplodedNode* MakeNode(ExplodedNodeSet& Dst, const Stmt* S,
|
||||
ExplodedNode* Pred, const GRState* St,
|
||||
ExplodedNode *MakeNode(ExplodedNodeSet &Dst, const Stmt *S,
|
||||
ExplodedNode *Pred, const GRState *St,
|
||||
ProgramPoint::Kind K = ProgramPoint::PostStmtKind,
|
||||
const ProgramPointTag *tag = 0);
|
||||
|
||||
/// Visit - Transfer function logic for all statements. Dispatches to
|
||||
/// other functions that handle specific kinds of statements.
|
||||
void Visit(const Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst);
|
||||
void Visit(const Stmt *S, ExplodedNode *Pred, ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitArraySubscriptExpr - Transfer function for array accesses.
|
||||
void VisitLvalArraySubscriptExpr(const ArraySubscriptExpr* Ex,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
void VisitLvalArraySubscriptExpr(const ArraySubscriptExpr *Ex,
|
||||
ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitAsmStmt - Transfer function logic for inline asm.
|
||||
void VisitAsmStmt(const AsmStmt* A, ExplodedNode* Pred, ExplodedNodeSet& Dst);
|
||||
void VisitAsmStmt(const AsmStmt *A, ExplodedNode *Pred, ExplodedNodeSet &Dst);
|
||||
|
||||
void VisitAsmStmtHelperOutputs(const AsmStmt* A,
|
||||
void VisitAsmStmtHelperOutputs(const AsmStmt *A,
|
||||
AsmStmt::const_outputs_iterator I,
|
||||
AsmStmt::const_outputs_iterator E,
|
||||
ExplodedNode* Pred, ExplodedNodeSet& Dst);
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst);
|
||||
|
||||
void VisitAsmStmtHelperInputs(const AsmStmt* A,
|
||||
void VisitAsmStmtHelperInputs(const AsmStmt *A,
|
||||
AsmStmt::const_inputs_iterator I,
|
||||
AsmStmt::const_inputs_iterator E,
|
||||
ExplodedNode* Pred, ExplodedNodeSet& Dst);
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitBlockExpr - Transfer function logic for BlockExprs.
|
||||
void VisitBlockExpr(const BlockExpr *BE, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitBinaryOperator - Transfer function logic for binary operators.
|
||||
void VisitBinaryOperator(const BinaryOperator* B, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
void VisitBinaryOperator(const BinaryOperator* B, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
|
||||
/// VisitCall - Transfer function for function calls.
|
||||
void VisitCallExpr(const CallExpr* CE, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
void VisitCallExpr(const CallExpr *CE, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitCast - Transfer function logic for all casts (implicit and explicit).
|
||||
void VisitCast(const CastExpr *CastE, const Expr *Ex, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitCompoundLiteralExpr - Transfer function logic for compound literals.
|
||||
void VisitCompoundLiteralExpr(const CompoundLiteralExpr* CL,
|
||||
ExplodedNode* Pred, ExplodedNodeSet& Dst);
|
||||
void VisitCompoundLiteralExpr(const CompoundLiteralExpr *CL,
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst);
|
||||
|
||||
/// Transfer function logic for DeclRefExprs and BlockDeclRefExprs.
|
||||
void VisitCommonDeclRefExpr(const Expr* DR, const NamedDecl *D,
|
||||
ExplodedNode* Pred, ExplodedNodeSet& Dst);
|
||||
void VisitCommonDeclRefExpr(const Expr *DR, const NamedDecl *D,
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitDeclStmt - Transfer function logic for DeclStmts.
|
||||
void VisitDeclStmt(const DeclStmt* DS, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
void VisitDeclStmt(const DeclStmt *DS, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitGuardedExpr - Transfer function logic for ?, __builtin_choose
|
||||
void VisitGuardedExpr(const Expr* Ex, const Expr* L, const Expr* R,
|
||||
ExplodedNode* Pred, ExplodedNodeSet& Dst);
|
||||
void VisitGuardedExpr(const Expr *Ex, const Expr *L, const Expr *R,
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst);
|
||||
|
||||
void VisitInitListExpr(const InitListExpr* E, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
void VisitInitListExpr(const InitListExpr *E, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitLogicalExpr - Transfer function logic for '&&', '||'
|
||||
void VisitLogicalExpr(const BinaryOperator* B, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
void VisitLogicalExpr(const BinaryOperator* B, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitMemberExpr - Transfer function for member expressions.
|
||||
void VisitMemberExpr(const MemberExpr* M, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
void VisitMemberExpr(const MemberExpr *M, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// Transfer function logic for ObjCAtSynchronizedStmts.
|
||||
void VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S,
|
||||
@@ -302,32 +302,32 @@ public:
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst);
|
||||
|
||||
/// Transfer function logic for computing the lvalue of an Objective-C ivar.
|
||||
void VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr* DR, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
void VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr *DR, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitObjCForCollectionStmt - Transfer function logic for
|
||||
/// ObjCForCollectionStmt.
|
||||
void VisitObjCForCollectionStmt(const ObjCForCollectionStmt* S,
|
||||
ExplodedNode* Pred, ExplodedNodeSet& Dst);
|
||||
void VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S,
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst);
|
||||
|
||||
void VisitObjCMessage(const ObjCMessage &msg, ExplodedNode *Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitReturnStmt - Transfer function logic for return statements.
|
||||
void VisitReturnStmt(const ReturnStmt* R, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
void VisitReturnStmt(const ReturnStmt *R, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitOffsetOfExpr - Transfer function for offsetof.
|
||||
void VisitOffsetOfExpr(const OffsetOfExpr* Ex, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
void VisitOffsetOfExpr(const OffsetOfExpr *Ex, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitUnaryExprOrTypeTraitExpr - Transfer function for sizeof.
|
||||
void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr* Ex,
|
||||
ExplodedNode* Pred, ExplodedNodeSet& Dst);
|
||||
void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Ex,
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst);
|
||||
|
||||
/// VisitUnaryOperator - Transfer function logic for unary operators.
|
||||
void VisitUnaryOperator(const UnaryOperator* B, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst);
|
||||
void VisitUnaryOperator(const UnaryOperator* B, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst);
|
||||
|
||||
void VisitCXXThisExpr(const CXXThisExpr *TE, ExplodedNode *Pred,
|
||||
ExplodedNodeSet & Dst);
|
||||
@@ -378,7 +378,7 @@ public:
|
||||
/// evalEagerlyAssume - Given the nodes in 'Src', eagerly assume symbolic
|
||||
/// expressions of the form 'x != 0' and generate new nodes (stored in Dst)
|
||||
/// with those assumptions.
|
||||
void evalEagerlyAssume(ExplodedNodeSet& Dst, ExplodedNodeSet& Src,
|
||||
void evalEagerlyAssume(ExplodedNodeSet &Dst, ExplodedNodeSet &Src,
|
||||
const Expr *Ex);
|
||||
|
||||
SVal evalMinus(SVal X) {
|
||||
@@ -407,19 +407,19 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void evalObjCMessage(ExplodedNodeSet& Dst, const ObjCMessage &msg,
|
||||
ExplodedNode* Pred, const GRState *state) {
|
||||
void evalObjCMessage(ExplodedNodeSet &Dst, const ObjCMessage &msg,
|
||||
ExplodedNode *Pred, const GRState *state) {
|
||||
assert (Builder && "StmtNodeBuilder must be defined.");
|
||||
getTF().evalObjCMessage(Dst, *this, *Builder, msg, Pred, state);
|
||||
}
|
||||
|
||||
const GRState* MarkBranch(const GRState* St, const Stmt* Terminator,
|
||||
const GRState *MarkBranch(const GRState *St, const Stmt *Terminator,
|
||||
bool branchTaken);
|
||||
|
||||
/// evalBind - Handle the semantics of binding a value to a specific location.
|
||||
/// This method is used by evalStore, VisitDeclStmt, and others.
|
||||
void evalBind(ExplodedNodeSet& Dst, const Stmt* StoreE, ExplodedNode* Pred,
|
||||
const GRState* St, SVal location, SVal Val,
|
||||
void evalBind(ExplodedNodeSet &Dst, const Stmt *StoreE, ExplodedNode *Pred,
|
||||
const GRState *St, SVal location, SVal Val,
|
||||
bool atDeclInit = false);
|
||||
|
||||
public:
|
||||
@@ -429,24 +429,24 @@ public:
|
||||
// be the same as Pred->state, and when 'location' may not be the
|
||||
// same as state->getLValue(Ex).
|
||||
/// Simulate a read of the result of Ex.
|
||||
void evalLoad(ExplodedNodeSet& Dst, const Expr* Ex, ExplodedNode* Pred,
|
||||
const GRState* St, SVal location, const ProgramPointTag *tag = 0,
|
||||
void evalLoad(ExplodedNodeSet &Dst, const Expr *Ex, ExplodedNode *Pred,
|
||||
const GRState *St, SVal location, const ProgramPointTag *tag = 0,
|
||||
QualType LoadTy = QualType());
|
||||
|
||||
// FIXME: 'tag' should be removed, and a LocationContext should be used
|
||||
// instead.
|
||||
void evalStore(ExplodedNodeSet& Dst, const Expr* AssignE, const Expr* StoreE,
|
||||
ExplodedNode* Pred, const GRState* St, SVal TargetLV, SVal Val,
|
||||
void evalStore(ExplodedNodeSet &Dst, const Expr *AssignE, const Expr *StoreE,
|
||||
ExplodedNode *Pred, const GRState *St, SVal TargetLV, SVal Val,
|
||||
const ProgramPointTag *tag = 0);
|
||||
private:
|
||||
void evalLoadCommon(ExplodedNodeSet& Dst, const Expr* Ex, ExplodedNode* Pred,
|
||||
const GRState* St, SVal location, const ProgramPointTag *tag,
|
||||
void evalLoadCommon(ExplodedNodeSet &Dst, const Expr *Ex, ExplodedNode *Pred,
|
||||
const GRState *St, SVal location, const ProgramPointTag *tag,
|
||||
QualType LoadTy);
|
||||
|
||||
// FIXME: 'tag' should be removed, and a LocationContext should be used
|
||||
// instead.
|
||||
void evalLocation(ExplodedNodeSet &Dst, const Stmt *S, ExplodedNode* Pred,
|
||||
const GRState* St, SVal location,
|
||||
void evalLocation(ExplodedNodeSet &Dst, const Stmt *S, ExplodedNode *Pred,
|
||||
const GRState *St, SVal location,
|
||||
const ProgramPointTag *tag, bool isLoad);
|
||||
|
||||
bool InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE, ExplodedNode *Pred);
|
||||
|
||||
@@ -25,9 +25,9 @@ class StmtNodeBuilderRef {
|
||||
ExplodedNodeSet &Dst;
|
||||
StmtNodeBuilder &B;
|
||||
ExprEngine& Eng;
|
||||
ExplodedNode* Pred;
|
||||
const GRState* state;
|
||||
const Stmt* stmt;
|
||||
ExplodedNode *Pred;
|
||||
const GRState *state;
|
||||
const Stmt *stmt;
|
||||
const unsigned OldSize;
|
||||
const bool AutoCreateNode;
|
||||
SaveAndRestore<bool> OldSink;
|
||||
@@ -42,9 +42,9 @@ private:
|
||||
StmtNodeBuilderRef(ExplodedNodeSet &dst,
|
||||
StmtNodeBuilder &builder,
|
||||
ExprEngine& eng,
|
||||
ExplodedNode* pred,
|
||||
ExplodedNode *pred,
|
||||
const GRState *st,
|
||||
const Stmt* s, bool auto_create_node)
|
||||
const Stmt *s, bool auto_create_node)
|
||||
: Dst(dst), B(builder), Eng(eng), Pred(pred),
|
||||
state(st), stmt(s), OldSize(Dst.size()), AutoCreateNode(auto_create_node),
|
||||
OldSink(B.BuildSinks), OldHasGen(B.hasGeneratedNode) {}
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
return Eng.getStateManager();
|
||||
}
|
||||
|
||||
ExplodedNode* MakeNode(const GRState* state) {
|
||||
ExplodedNode *MakeNode(const GRState *state) {
|
||||
return B.MakeNode(Dst, const_cast<Stmt*>(stmt), Pred, state);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -47,9 +47,9 @@ template <typename T> struct GRStatePartialTrait;
|
||||
|
||||
template <typename T> struct GRStateTrait {
|
||||
typedef typename T::data_type data_type;
|
||||
static inline void* GDMIndex() { return &T::TagInt; }
|
||||
static inline void* MakeVoidPtr(data_type D) { return (void*) D; }
|
||||
static inline data_type MakeData(void* const* P) {
|
||||
static inline void *GDMIndex() { return &T::TagInt; }
|
||||
static inline void *MakeVoidPtr(data_type D) { return (void*) D; }
|
||||
static inline data_type MakeData(void *const* P) {
|
||||
return P ? (data_type) *P : (data_type) 0;
|
||||
}
|
||||
};
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
|
||||
/// Copy ctor - We must explicitly define this or else the "Next" ptr
|
||||
/// in FoldingSetNode will also get copied.
|
||||
GRState(const GRState& RHS);
|
||||
GRState(const GRState &RHS);
|
||||
|
||||
~GRState();
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
/// Profile - Profile the contents of a GRState object for use in a
|
||||
/// FoldingSet. Two GRState objects are considered equal if they
|
||||
/// have the same Environment, Store, and GenericDataMap.
|
||||
static void Profile(llvm::FoldingSetNodeID& ID, const GRState* V) {
|
||||
static void Profile(llvm::FoldingSetNodeID& ID, const GRState *V) {
|
||||
V->Env.Profile(ID);
|
||||
ID.AddPointer(V->store);
|
||||
V->GDM.Profile(ID);
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
|
||||
/// BindCompoundLiteral - Return the state that has the bindings currently
|
||||
/// in this state plus the bindings for the CompoundLiteral.
|
||||
const GRState *bindCompoundLiteral(const CompoundLiteralExpr* CL,
|
||||
const GRState *bindCompoundLiteral(const CompoundLiteralExpr *CL,
|
||||
const LocationContext *LC,
|
||||
SVal V) const;
|
||||
|
||||
@@ -259,7 +259,7 @@ public:
|
||||
const llvm::APSInt *getSymVal(SymbolRef sym) const;
|
||||
|
||||
/// Returns the SVal bound to the statement 'S' in the state's environment.
|
||||
SVal getSVal(const Stmt* S, bool useOnlyDirectBindings = false) const;
|
||||
SVal getSVal(const Stmt *S, bool useOnlyDirectBindings = false) const;
|
||||
|
||||
SVal getSValAsScalarOrLoc(const Stmt *Ex) const;
|
||||
|
||||
@@ -293,7 +293,7 @@ public:
|
||||
// Accessing the Generic Data Map (GDM).
|
||||
//==---------------------------------------------------------------------==//
|
||||
|
||||
void* const* FindGDM(void* K) const;
|
||||
void *const* FindGDM(void *K) const;
|
||||
|
||||
template<typename T>
|
||||
const GRState *add(typename GRStateTrait<T>::key_type K) const;
|
||||
@@ -307,7 +307,7 @@ public:
|
||||
template<typename T>
|
||||
typename GRStateTrait<T>::lookup_type
|
||||
get(typename GRStateTrait<T>::key_type key) const {
|
||||
void* const* d = FindGDM(GRStateTrait<T>::GDMIndex());
|
||||
void *const* d = FindGDM(GRStateTrait<T>::GDMIndex());
|
||||
return GRStateTrait<T>::Lookup(GRStateTrait<T>::MakeData(d), key);
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ public:
|
||||
|
||||
template<typename T>
|
||||
bool contains(typename GRStateTrait<T>::key_type key) const {
|
||||
void* const* d = FindGDM(GRStateTrait<T>::GDMIndex());
|
||||
void *const* d = FindGDM(GRStateTrait<T>::GDMIndex());
|
||||
return GRStateTrait<T>::Contains(GRStateTrait<T>::MakeData(d), key);
|
||||
}
|
||||
|
||||
@@ -346,17 +346,17 @@ public:
|
||||
class Printer {
|
||||
public:
|
||||
virtual ~Printer() {}
|
||||
virtual void Print(raw_ostream& Out, const GRState* state,
|
||||
virtual void Print(raw_ostream &Out, const GRState *state,
|
||||
const char* nl, const char* sep) = 0;
|
||||
};
|
||||
|
||||
// Pretty-printing.
|
||||
void print(raw_ostream& Out, CFG &C, const char *nl = "\n",
|
||||
void print(raw_ostream &Out, CFG &C, const char *nl = "\n",
|
||||
const char *sep = "") const;
|
||||
|
||||
void printStdErr(CFG &C) const;
|
||||
|
||||
void printDOT(raw_ostream& Out, CFG &C) const;
|
||||
void printDOT(raw_ostream &Out, CFG &C) const;
|
||||
|
||||
private:
|
||||
/// Increments the number of times this state is referenced by ExplodeNodes.
|
||||
@@ -381,7 +381,7 @@ class GRStateSet {
|
||||
public:
|
||||
GRStateSet() {}
|
||||
|
||||
inline void Add(const GRState* St) {
|
||||
inline void Add(const GRState *St) {
|
||||
Impl.insert(St);
|
||||
}
|
||||
|
||||
@@ -394,11 +394,11 @@ public:
|
||||
inline iterator end() const { return Impl.end(); }
|
||||
|
||||
class AutoPopulate {
|
||||
GRStateSet& S;
|
||||
GRStateSet &S;
|
||||
unsigned StartSize;
|
||||
const GRState* St;
|
||||
const GRState *St;
|
||||
public:
|
||||
AutoPopulate(GRStateSet& s, const GRState* st)
|
||||
AutoPopulate(GRStateSet &s, const GRState *st)
|
||||
: S(s), StartSize(S.size()), St(st) {}
|
||||
|
||||
~AutoPopulate() {
|
||||
@@ -450,7 +450,7 @@ private:
|
||||
std::vector<GRState *> freeStates;
|
||||
|
||||
public:
|
||||
GRStateManager(ASTContext& Ctx,
|
||||
GRStateManager(ASTContext &Ctx,
|
||||
StoreManagerCreator CreateStoreManager,
|
||||
ConstraintManagerCreator CreateConstraintManager,
|
||||
llvm::BumpPtrAllocator& alloc,
|
||||
@@ -464,7 +464,7 @@ public:
|
||||
ConstraintMgr.reset((*CreateConstraintManager)(*this, subeng));
|
||||
}
|
||||
|
||||
GRStateManager(ASTContext& Ctx,
|
||||
GRStateManager(ASTContext &Ctx,
|
||||
StoreManagerCreator CreateStoreManager,
|
||||
ConstraintManager* ConstraintManagerPtr,
|
||||
llvm::BumpPtrAllocator& alloc)
|
||||
@@ -515,7 +515,7 @@ public:
|
||||
ConstraintManager& getConstraintManager() { return *ConstraintMgr; }
|
||||
SubEngine* getOwningEngine() { return Eng; }
|
||||
|
||||
const GRState* removeDeadBindings(const GRState* St,
|
||||
const GRState *removeDeadBindings(const GRState *St,
|
||||
const StackFrameContext *LCtx,
|
||||
SymbolReaper& SymReaper);
|
||||
|
||||
@@ -530,17 +530,17 @@ public:
|
||||
}
|
||||
|
||||
// Methods that manipulate the GDM.
|
||||
const GRState* addGDM(const GRState* St, void* Key, void* Data);
|
||||
const GRState *addGDM(const GRState *St, void *Key, void *Data);
|
||||
const GRState *removeGDM(const GRState *state, void *Key);
|
||||
|
||||
// Methods that query & manipulate the Store.
|
||||
|
||||
void iterBindings(const GRState* state, StoreManager::BindingsHandler& F) {
|
||||
void iterBindings(const GRState *state, StoreManager::BindingsHandler& F) {
|
||||
StoreMgr->iterBindings(state->getStore(), F);
|
||||
}
|
||||
|
||||
const GRState* getPersistentState(GRState& Impl);
|
||||
const GRState* getPersistentStateWithGDM(const GRState *FromState,
|
||||
const GRState *getPersistentState(GRState &Impl);
|
||||
const GRState *getPersistentStateWithGDM(const GRState *FromState,
|
||||
const GRState *GDMState);
|
||||
|
||||
bool haveEqualEnvironments(const GRState * S1, const GRState * S2) {
|
||||
@@ -575,13 +575,13 @@ public:
|
||||
|
||||
// Trait based GDM dispatch.
|
||||
template <typename T>
|
||||
const GRState* set(const GRState* st, typename GRStateTrait<T>::data_type D) {
|
||||
const GRState *set(const GRState *st, typename GRStateTrait<T>::data_type D) {
|
||||
return addGDM(st, GRStateTrait<T>::GDMIndex(),
|
||||
GRStateTrait<T>::MakeVoidPtr(D));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const GRState* set(const GRState* st,
|
||||
const GRState *set(const GRState *st,
|
||||
typename GRStateTrait<T>::key_type K,
|
||||
typename GRStateTrait<T>::value_type V,
|
||||
typename GRStateTrait<T>::context_type C) {
|
||||
@@ -591,7 +591,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const GRState* add(const GRState* st,
|
||||
const GRState *add(const GRState *st,
|
||||
typename GRStateTrait<T>::key_type K,
|
||||
typename GRStateTrait<T>::context_type C) {
|
||||
return addGDM(st, GRStateTrait<T>::GDMIndex(),
|
||||
@@ -599,7 +599,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const GRState* remove(const GRState* st,
|
||||
const GRState *remove(const GRState *st,
|
||||
typename GRStateTrait<T>::key_type K,
|
||||
typename GRStateTrait<T>::context_type C) {
|
||||
|
||||
@@ -612,24 +612,24 @@ public:
|
||||
return removeGDM(st, GRStateTrait<T>::GDMIndex());
|
||||
}
|
||||
|
||||
void* FindGDMContext(void* index,
|
||||
void* (*CreateContext)(llvm::BumpPtrAllocator&),
|
||||
void *FindGDMContext(void *index,
|
||||
void *(*CreateContext)(llvm::BumpPtrAllocator&),
|
||||
void (*DeleteContext)(void*));
|
||||
|
||||
template <typename T>
|
||||
typename GRStateTrait<T>::context_type get_context() {
|
||||
void* p = FindGDMContext(GRStateTrait<T>::GDMIndex(),
|
||||
void *p = FindGDMContext(GRStateTrait<T>::GDMIndex(),
|
||||
GRStateTrait<T>::CreateContext,
|
||||
GRStateTrait<T>::DeleteContext);
|
||||
|
||||
return GRStateTrait<T>::MakeContext(p);
|
||||
}
|
||||
|
||||
const llvm::APSInt* getSymVal(const GRState* St, SymbolRef sym) {
|
||||
const llvm::APSInt* getSymVal(const GRState *St, SymbolRef sym) {
|
||||
return ConstraintMgr->getSymVal(St, sym);
|
||||
}
|
||||
|
||||
void EndPath(const GRState* St) {
|
||||
void EndPath(const GRState *St) {
|
||||
ConstraintMgr->EndPath(St);
|
||||
}
|
||||
};
|
||||
@@ -666,7 +666,7 @@ inline const GRState *GRState::bindLoc(SVal LV, SVal V) const {
|
||||
return !isa<Loc>(LV) ? this : bindLoc(cast<Loc>(LV), V);
|
||||
}
|
||||
|
||||
inline Loc GRState::getLValue(const VarDecl* VD,
|
||||
inline Loc GRState::getLValue(const VarDecl *VD,
|
||||
const LocationContext *LC) const {
|
||||
return getStateManager().StoreMgr->getLValueVar(VD, LC);
|
||||
}
|
||||
@@ -684,7 +684,7 @@ inline SVal GRState::getLValue(const ObjCIvarDecl *D, SVal Base) const {
|
||||
return getStateManager().StoreMgr->getLValueIvar(D, Base);
|
||||
}
|
||||
|
||||
inline SVal GRState::getLValue(const FieldDecl* D, SVal Base) const {
|
||||
inline SVal GRState::getLValue(const FieldDecl *D, SVal Base) const {
|
||||
return getStateManager().StoreMgr->getLValueField(D, Base);
|
||||
}
|
||||
|
||||
@@ -698,7 +698,7 @@ inline const llvm::APSInt *GRState::getSymVal(SymbolRef sym) const {
|
||||
return getStateManager().getSymVal(this, sym);
|
||||
}
|
||||
|
||||
inline SVal GRState::getSVal(const Stmt* Ex, bool useOnlyDirectBindings) const{
|
||||
inline SVal GRState::getSVal(const Stmt *Ex, bool useOnlyDirectBindings) const{
|
||||
return Env.getSVal(Ex, *getStateManager().svalBuilder,
|
||||
useOnlyDirectBindings);
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ namespace ento {
|
||||
typedef Data value_type;
|
||||
typedef const value_type* lookup_type;
|
||||
|
||||
static inline data_type MakeData(void* const* p) {
|
||||
static inline data_type MakeData(void *const* p) {
|
||||
return p ? data_type((typename data_type::TreeTy*) *p) : data_type(0);
|
||||
}
|
||||
static inline void* MakeVoidPtr(data_type B) {
|
||||
static inline void *MakeVoidPtr(data_type B) {
|
||||
return B.getRoot();
|
||||
}
|
||||
static lookup_type Lookup(data_type B, key_type K) {
|
||||
@@ -57,15 +57,15 @@ namespace ento {
|
||||
return F.remove(B, K);
|
||||
}
|
||||
|
||||
static inline context_type MakeContext(void* p) {
|
||||
static inline context_type MakeContext(void *p) {
|
||||
return *((typename data_type::Factory*) p);
|
||||
}
|
||||
|
||||
static void* CreateContext(llvm::BumpPtrAllocator& Alloc) {
|
||||
static void *CreateContext(llvm::BumpPtrAllocator& Alloc) {
|
||||
return new typename data_type::Factory(Alloc);
|
||||
}
|
||||
|
||||
static void DeleteContext(void* Ctx) {
|
||||
static void DeleteContext(void *Ctx) {
|
||||
delete (typename data_type::Factory*) Ctx;
|
||||
}
|
||||
};
|
||||
@@ -79,11 +79,11 @@ namespace ento {
|
||||
typedef typename data_type::Factory& context_type;
|
||||
typedef Key key_type;
|
||||
|
||||
static inline data_type MakeData(void* const* p) {
|
||||
static inline data_type MakeData(void *const* p) {
|
||||
return p ? data_type((typename data_type::TreeTy*) *p) : data_type(0);
|
||||
}
|
||||
|
||||
static inline void* MakeVoidPtr(data_type B) {
|
||||
static inline void *MakeVoidPtr(data_type B) {
|
||||
return B.getRoot();
|
||||
}
|
||||
|
||||
@@ -99,15 +99,15 @@ namespace ento {
|
||||
return B.contains(K);
|
||||
}
|
||||
|
||||
static inline context_type MakeContext(void* p) {
|
||||
static inline context_type MakeContext(void *p) {
|
||||
return *((typename data_type::Factory*) p);
|
||||
}
|
||||
|
||||
static void* CreateContext(llvm::BumpPtrAllocator& Alloc) {
|
||||
static void *CreateContext(llvm::BumpPtrAllocator& Alloc) {
|
||||
return new typename data_type::Factory(Alloc);
|
||||
}
|
||||
|
||||
static void DeleteContext(void* Ctx) {
|
||||
static void DeleteContext(void *Ctx) {
|
||||
delete (typename data_type::Factory*) Ctx;
|
||||
}
|
||||
};
|
||||
@@ -128,24 +128,24 @@ namespace ento {
|
||||
return L.contains(K);
|
||||
}
|
||||
|
||||
static inline data_type MakeData(void* const* p) {
|
||||
static inline data_type MakeData(void *const* p) {
|
||||
return p ? data_type((const llvm::ImmutableListImpl<T>*) *p)
|
||||
: data_type(0);
|
||||
}
|
||||
|
||||
static inline void* MakeVoidPtr(data_type D) {
|
||||
static inline void *MakeVoidPtr(data_type D) {
|
||||
return (void*) D.getInternalPointer();
|
||||
}
|
||||
|
||||
static inline context_type MakeContext(void* p) {
|
||||
static inline context_type MakeContext(void *p) {
|
||||
return *((typename data_type::Factory*) p);
|
||||
}
|
||||
|
||||
static void* CreateContext(llvm::BumpPtrAllocator& Alloc) {
|
||||
static void *CreateContext(llvm::BumpPtrAllocator& Alloc) {
|
||||
return new typename data_type::Factory(Alloc);
|
||||
}
|
||||
|
||||
static void DeleteContext(void* Ctx) {
|
||||
static void DeleteContext(void *Ctx) {
|
||||
delete (typename data_type::Factory*) Ctx;
|
||||
}
|
||||
};
|
||||
@@ -154,7 +154,7 @@ namespace ento {
|
||||
template <> struct GRStatePartialTrait<bool> {
|
||||
typedef bool data_type;
|
||||
|
||||
static inline data_type MakeData(void* const* p) {
|
||||
static inline data_type MakeData(void *const* p) {
|
||||
return p ? (data_type) (uintptr_t) *p
|
||||
: data_type();
|
||||
}
|
||||
@@ -167,7 +167,7 @@ namespace ento {
|
||||
template <> struct GRStatePartialTrait<unsigned> {
|
||||
typedef unsigned data_type;
|
||||
|
||||
static inline data_type MakeData(void* const* p) {
|
||||
static inline data_type MakeData(void *const* p) {
|
||||
return p ? (data_type) (uintptr_t) *p
|
||||
: data_type();
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
/// Compute the offset within the top level memory object.
|
||||
RegionOffset getAsOffset() const;
|
||||
|
||||
virtual void dumpToStream(raw_ostream& os) const;
|
||||
virtual void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
void dump() const;
|
||||
|
||||
@@ -198,7 +198,7 @@ class StaticGlobalSpaceRegion : public GlobalsSpaceRegion {
|
||||
public:
|
||||
void Profile(llvm::FoldingSetNodeID &ID) const;
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
const CodeTextRegion *getCodeRegion() const { return CR; }
|
||||
|
||||
@@ -215,7 +215,7 @@ class NonStaticGlobalSpaceRegion : public GlobalsSpaceRegion {
|
||||
|
||||
public:
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
static bool classof(const MemRegion *R) {
|
||||
return R->getKind() == NonStaticGlobalSpaceRegionKind;
|
||||
@@ -324,14 +324,14 @@ class AllocaRegion : public SubRegion {
|
||||
protected:
|
||||
unsigned Cnt; // Block counter. Used to distinguish different pieces of
|
||||
// memory allocated by alloca at the same call site.
|
||||
const Expr* Ex;
|
||||
const Expr *Ex;
|
||||
|
||||
AllocaRegion(const Expr* ex, unsigned cnt, const MemRegion *superRegion)
|
||||
AllocaRegion(const Expr *ex, unsigned cnt, const MemRegion *superRegion)
|
||||
: SubRegion(superRegion, AllocaRegionKind), Cnt(cnt), Ex(ex) {}
|
||||
|
||||
public:
|
||||
|
||||
const Expr* getExpr() const { return Ex; }
|
||||
const Expr *getExpr() const { return Ex; }
|
||||
|
||||
bool isBoundable() const { return true; }
|
||||
|
||||
@@ -339,10 +339,10 @@ public:
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const;
|
||||
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const Expr* Ex,
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const Expr *Ex,
|
||||
unsigned Cnt, const MemRegion *superRegion);
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
static bool classof(const MemRegion* R) {
|
||||
return R->getKind() == AllocaRegionKind;
|
||||
@@ -414,7 +414,7 @@ public:
|
||||
class FunctionTextRegion : public CodeTextRegion {
|
||||
const FunctionDecl *FD;
|
||||
public:
|
||||
FunctionTextRegion(const FunctionDecl* fd, const MemRegion* sreg)
|
||||
FunctionTextRegion(const FunctionDecl *fd, const MemRegion* sreg)
|
||||
: CodeTextRegion(sreg, FunctionTextRegionKind), FD(fd) {}
|
||||
|
||||
QualType getLocationType() const {
|
||||
@@ -425,7 +425,7 @@ public:
|
||||
return FD;
|
||||
}
|
||||
|
||||
virtual void dumpToStream(raw_ostream& os) const;
|
||||
virtual void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const;
|
||||
|
||||
@@ -466,7 +466,7 @@ public:
|
||||
|
||||
AnalysisContext *getAnalysisContext() const { return AC; }
|
||||
|
||||
virtual void dumpToStream(raw_ostream& os) const;
|
||||
virtual void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const;
|
||||
|
||||
@@ -519,7 +519,7 @@ public:
|
||||
bool operator!=(const referenced_vars_iterator &I) const {
|
||||
return I.R != R;
|
||||
}
|
||||
referenced_vars_iterator& operator++() {
|
||||
referenced_vars_iterator &operator++() {
|
||||
++R;
|
||||
return *this;
|
||||
}
|
||||
@@ -528,7 +528,7 @@ public:
|
||||
referenced_vars_iterator referenced_vars_begin() const;
|
||||
referenced_vars_iterator referenced_vars_end() const;
|
||||
|
||||
virtual void dumpToStream(raw_ostream& os) const;
|
||||
virtual void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const;
|
||||
|
||||
@@ -569,7 +569,7 @@ public:
|
||||
SymbolRef sym,
|
||||
const MemRegion* superRegion);
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
static bool classof(const MemRegion* R) {
|
||||
return R->getKind() == SymbolicRegionKind;
|
||||
@@ -605,7 +605,7 @@ public:
|
||||
ProfileRegion(ID, Str, superRegion);
|
||||
}
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
static bool classof(const MemRegion* R) {
|
||||
return R->getKind() == StringRegionKind;
|
||||
@@ -618,13 +618,13 @@ public:
|
||||
class CompoundLiteralRegion : public TypedValueRegion {
|
||||
private:
|
||||
friend class MemRegionManager;
|
||||
const CompoundLiteralExpr* CL;
|
||||
const CompoundLiteralExpr *CL;
|
||||
|
||||
CompoundLiteralRegion(const CompoundLiteralExpr* cl, const MemRegion* sReg)
|
||||
CompoundLiteralRegion(const CompoundLiteralExpr *cl, const MemRegion* sReg)
|
||||
: TypedValueRegion(sReg, CompoundLiteralRegionKind), CL(cl) {}
|
||||
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID,
|
||||
const CompoundLiteralExpr* CL,
|
||||
const CompoundLiteralExpr *CL,
|
||||
const MemRegion* superRegion);
|
||||
public:
|
||||
QualType getValueType() const {
|
||||
@@ -635,9 +635,9 @@ public:
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const;
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
const CompoundLiteralExpr* getLiteralExpr() const { return CL; }
|
||||
const CompoundLiteralExpr *getLiteralExpr() const { return CL; }
|
||||
|
||||
static bool classof(const MemRegion* R) {
|
||||
return R->getKind() == CompoundLiteralRegionKind;
|
||||
@@ -646,16 +646,16 @@ public:
|
||||
|
||||
class DeclRegion : public TypedValueRegion {
|
||||
protected:
|
||||
const Decl* D;
|
||||
const Decl *D;
|
||||
|
||||
DeclRegion(const Decl* d, const MemRegion* sReg, Kind k)
|
||||
DeclRegion(const Decl *d, const MemRegion* sReg, Kind k)
|
||||
: TypedValueRegion(sReg, k), D(d) {}
|
||||
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const Decl* D,
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const Decl *D,
|
||||
const MemRegion* superRegion, Kind k);
|
||||
|
||||
public:
|
||||
const Decl* getDecl() const { return D; }
|
||||
const Decl *getDecl() const { return D; }
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const;
|
||||
|
||||
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const;
|
||||
@@ -670,10 +670,10 @@ class VarRegion : public DeclRegion {
|
||||
friend class MemRegionManager;
|
||||
|
||||
// Constructors and private methods.
|
||||
VarRegion(const VarDecl* vd, const MemRegion* sReg)
|
||||
VarRegion(const VarDecl *vd, const MemRegion* sReg)
|
||||
: DeclRegion(vd, sReg, VarRegionKind) {}
|
||||
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const VarDecl* VD,
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const VarDecl *VD,
|
||||
const MemRegion *superRegion) {
|
||||
DeclRegion::ProfileRegion(ID, VD, superRegion, VarRegionKind);
|
||||
}
|
||||
@@ -690,7 +690,7 @@ public:
|
||||
return getDecl()->getType();
|
||||
}
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
static bool classof(const MemRegion* R) {
|
||||
return R->getKind() == VarRegionKind;
|
||||
@@ -717,7 +717,7 @@ public:
|
||||
return QualType(ThisPointerTy, 0);
|
||||
}
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
static bool classof(const MemRegion* R) {
|
||||
return R->getKind() == CXXThisRegionKind;
|
||||
@@ -730,14 +730,14 @@ private:
|
||||
class FieldRegion : public DeclRegion {
|
||||
friend class MemRegionManager;
|
||||
|
||||
FieldRegion(const FieldDecl* fd, const MemRegion* sReg)
|
||||
FieldRegion(const FieldDecl *fd, const MemRegion* sReg)
|
||||
: DeclRegion(fd, sReg, FieldRegionKind) {}
|
||||
|
||||
public:
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
const FieldDecl* getDecl() const { return cast<FieldDecl>(D); }
|
||||
const FieldDecl *getDecl() const { return cast<FieldDecl>(D); }
|
||||
|
||||
QualType getValueType() const {
|
||||
// FIXME: We can cache this if needed.
|
||||
@@ -746,7 +746,7 @@ public:
|
||||
|
||||
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const;
|
||||
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const FieldDecl* FD,
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const FieldDecl *FD,
|
||||
const MemRegion* superRegion) {
|
||||
DeclRegion::ProfileRegion(ID, FD, superRegion, FieldRegionKind);
|
||||
}
|
||||
@@ -760,19 +760,19 @@ class ObjCIvarRegion : public DeclRegion {
|
||||
|
||||
friend class MemRegionManager;
|
||||
|
||||
ObjCIvarRegion(const ObjCIvarDecl* ivd, const MemRegion* sReg)
|
||||
ObjCIvarRegion(const ObjCIvarDecl *ivd, const MemRegion* sReg)
|
||||
: DeclRegion(ivd, sReg, ObjCIvarRegionKind) {}
|
||||
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const ObjCIvarDecl* ivd,
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const ObjCIvarDecl *ivd,
|
||||
const MemRegion* superRegion) {
|
||||
DeclRegion::ProfileRegion(ID, ivd, superRegion, ObjCIvarRegionKind);
|
||||
}
|
||||
|
||||
public:
|
||||
const ObjCIvarDecl* getDecl() const { return cast<ObjCIvarDecl>(D); }
|
||||
const ObjCIvarDecl *getDecl() const { return cast<ObjCIvarDecl>(D); }
|
||||
QualType getValueType() const { return getDecl()->getType(); }
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
static bool classof(const MemRegion* R) {
|
||||
return R->getKind() == ObjCIvarRegionKind;
|
||||
@@ -799,7 +799,7 @@ public:
|
||||
CharUnits getOffset() const { return Offset; }
|
||||
const MemRegion *getRegion() const { return Region; }
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
@@ -834,7 +834,7 @@ public:
|
||||
/// Compute the offset within the array. The array might also be a subobject.
|
||||
RegionRawOffset getAsArrayOffset() const;
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const;
|
||||
|
||||
@@ -860,7 +860,7 @@ public:
|
||||
return Ex->getType();
|
||||
}
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) const;
|
||||
|
||||
@@ -887,7 +887,7 @@ public:
|
||||
|
||||
QualType getValueType() const;
|
||||
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) const;
|
||||
|
||||
@@ -961,13 +961,13 @@ public:
|
||||
const MemSpaceRegion *getCodeRegion();
|
||||
|
||||
/// getAllocaRegion - Retrieve a region associated with a call to alloca().
|
||||
const AllocaRegion *getAllocaRegion(const Expr* Ex, unsigned Cnt,
|
||||
const AllocaRegion *getAllocaRegion(const Expr *Ex, unsigned Cnt,
|
||||
const LocationContext *LC);
|
||||
|
||||
/// getCompoundLiteralRegion - Retrieve the region associated with a
|
||||
/// given CompoundLiteral.
|
||||
const CompoundLiteralRegion*
|
||||
getCompoundLiteralRegion(const CompoundLiteralExpr* CL,
|
||||
getCompoundLiteralRegion(const CompoundLiteralExpr *CL,
|
||||
const LocationContext *LC);
|
||||
|
||||
/// getCXXThisRegion - Retrieve the [artificial] region associated with the
|
||||
@@ -1004,7 +1004,7 @@ public:
|
||||
/// a specified FieldDecl. 'superRegion' corresponds to the containing
|
||||
/// memory region (which typically represents the memory representing
|
||||
/// a structure or class).
|
||||
const FieldRegion *getFieldRegion(const FieldDecl* fd,
|
||||
const FieldRegion *getFieldRegion(const FieldDecl *fd,
|
||||
const MemRegion* superRegion);
|
||||
|
||||
const FieldRegion *getFieldRegionWithSuper(const FieldRegion *FR,
|
||||
@@ -1016,7 +1016,7 @@ public:
|
||||
/// a specified Objective-c instance variable. 'superRegion' corresponds
|
||||
/// to the containing region (which typically represents the Objective-C
|
||||
/// object).
|
||||
const ObjCIvarRegion *getObjCIvarRegion(const ObjCIvarDecl* ivd,
|
||||
const ObjCIvarRegion *getObjCIvarRegion(const ObjCIvarDecl *ivd,
|
||||
const MemRegion* superRegion);
|
||||
|
||||
const CXXTempObjectRegion *getCXXTempObjectRegion(Expr const *Ex,
|
||||
@@ -1079,7 +1079,7 @@ private:
|
||||
// Out-of-line member definitions.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
inline ASTContext& MemRegion::getContext() const {
|
||||
inline ASTContext &MemRegion::getContext() const {
|
||||
return getMemRegionManager()->getContext();
|
||||
}
|
||||
|
||||
@@ -1092,7 +1092,7 @@ inline ASTContext& MemRegion::getContext() const {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace llvm {
|
||||
static inline raw_ostream& operator<<(raw_ostream& os,
|
||||
static inline raw_ostream &operator<<(raw_ostream &os,
|
||||
const clang::ento::MemRegion* R) {
|
||||
R->dumpToStream(os);
|
||||
return os;
|
||||
|
||||
@@ -115,14 +115,14 @@ public:
|
||||
|
||||
// Forwarding methods to SymbolManager.
|
||||
|
||||
const SymbolConjured* getConjuredSymbol(const Stmt* stmt, QualType type,
|
||||
const SymbolConjured* getConjuredSymbol(const Stmt *stmt, QualType type,
|
||||
unsigned visitCount,
|
||||
const void* symbolTag = 0) {
|
||||
const void *symbolTag = 0) {
|
||||
return SymMgr.getConjuredSymbol(stmt, type, visitCount, symbolTag);
|
||||
}
|
||||
|
||||
const SymbolConjured* getConjuredSymbol(const Expr* expr, unsigned visitCount,
|
||||
const void* symbolTag = 0) {
|
||||
const SymbolConjured* getConjuredSymbol(const Expr *expr, unsigned visitCount,
|
||||
const void *symbolTag = 0) {
|
||||
return SymMgr.getConjuredSymbol(expr, visitCount, symbolTag);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,16 +53,16 @@ public:
|
||||
enum { BaseBits = 2, BaseMask = 0x3 };
|
||||
|
||||
protected:
|
||||
const void* Data;
|
||||
const void *Data;
|
||||
|
||||
/// The lowest 2 bits are a BaseKind (0 -- 3).
|
||||
/// The higher bits are an unsigned "kind" value.
|
||||
unsigned Kind;
|
||||
|
||||
explicit SVal(const void* d, bool isLoc, unsigned ValKind)
|
||||
explicit SVal(const void *d, bool isLoc, unsigned ValKind)
|
||||
: Data(d), Kind((isLoc ? LocKind : NonLocKind) | (ValKind << BaseBits)) {}
|
||||
|
||||
explicit SVal(BaseKind k, const void* D = NULL)
|
||||
explicit SVal(BaseKind k, const void *D = NULL)
|
||||
: Data(D), Kind(k) {}
|
||||
|
||||
public:
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
/// getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a
|
||||
/// CodeTextRegion wrapping a FunctionDecl, return that FunctionDecl.
|
||||
/// Otherwise return 0.
|
||||
const FunctionDecl* getAsFunctionDecl() const;
|
||||
const FunctionDecl *getAsFunctionDecl() const;
|
||||
|
||||
/// getAsLocSymbol - If this SVal is a location (subclasses Loc) and
|
||||
/// wraps a symbol, return that SymbolRef. Otherwise return NULL.
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
|
||||
const MemRegion *getAsRegion() const;
|
||||
|
||||
void dumpToStream(raw_ostream& OS) const;
|
||||
void dumpToStream(raw_ostream &OS) const;
|
||||
void dump() const;
|
||||
|
||||
// Iterators.
|
||||
@@ -147,13 +147,13 @@ public:
|
||||
void expand();
|
||||
public:
|
||||
symbol_iterator() {}
|
||||
symbol_iterator(const SymExpr* SE);
|
||||
symbol_iterator(const SymExpr *SE);
|
||||
|
||||
symbol_iterator& operator++();
|
||||
symbol_iterator &operator++();
|
||||
SymbolRef operator*();
|
||||
|
||||
bool operator==(const symbol_iterator& X) const;
|
||||
bool operator!=(const symbol_iterator& X) const;
|
||||
bool operator==(const symbol_iterator &X) const;
|
||||
bool operator!=(const symbol_iterator &X) const;
|
||||
};
|
||||
|
||||
symbol_iterator symbol_begin() const {
|
||||
@@ -174,13 +174,13 @@ public:
|
||||
class UndefinedVal : public SVal {
|
||||
public:
|
||||
UndefinedVal() : SVal(UndefinedKind) {}
|
||||
UndefinedVal(const void* D) : SVal(UndefinedKind, D) {}
|
||||
UndefinedVal(const void *D) : SVal(UndefinedKind, D) {}
|
||||
|
||||
static inline bool classof(const SVal* V) {
|
||||
return V->getBaseKind() == UndefinedKind;
|
||||
}
|
||||
|
||||
const void* getData() const { return Data; }
|
||||
const void *getData() const { return Data; }
|
||||
};
|
||||
|
||||
class DefinedOrUnknownSVal : public SVal {
|
||||
@@ -191,7 +191,7 @@ private:
|
||||
bool isValid() const;
|
||||
|
||||
protected:
|
||||
explicit DefinedOrUnknownSVal(const void* d, bool isLoc, unsigned ValKind)
|
||||
explicit DefinedOrUnknownSVal(const void *d, bool isLoc, unsigned ValKind)
|
||||
: SVal(d, isLoc, ValKind) {}
|
||||
|
||||
explicit DefinedOrUnknownSVal(BaseKind k, void *D = NULL)
|
||||
@@ -221,7 +221,7 @@ private:
|
||||
bool isUnknownOrUndef() const;
|
||||
bool isValid() const;
|
||||
protected:
|
||||
explicit DefinedSVal(const void* d, bool isLoc, unsigned ValKind)
|
||||
explicit DefinedSVal(const void *d, bool isLoc, unsigned ValKind)
|
||||
: DefinedOrUnknownSVal(d, isLoc, ValKind) {}
|
||||
public:
|
||||
// Implement isa<T> support.
|
||||
@@ -232,11 +232,11 @@ public:
|
||||
|
||||
class NonLoc : public DefinedSVal {
|
||||
protected:
|
||||
explicit NonLoc(unsigned SubKind, const void* d)
|
||||
explicit NonLoc(unsigned SubKind, const void *d)
|
||||
: DefinedSVal(d, false, SubKind) {}
|
||||
|
||||
public:
|
||||
void dumpToStream(raw_ostream& Out) const;
|
||||
void dumpToStream(raw_ostream &Out) const;
|
||||
|
||||
// Implement isa<T> support.
|
||||
static inline bool classof(const SVal* V) {
|
||||
@@ -246,11 +246,11 @@ public:
|
||||
|
||||
class Loc : public DefinedSVal {
|
||||
protected:
|
||||
explicit Loc(unsigned SubKind, const void* D)
|
||||
explicit Loc(unsigned SubKind, const void *D)
|
||||
: DefinedSVal(const_cast<void*>(D), true, SubKind) {}
|
||||
|
||||
public:
|
||||
void dumpToStream(raw_ostream& Out) const;
|
||||
void dumpToStream(raw_ostream &Out) const;
|
||||
|
||||
Loc(const Loc& X) : DefinedSVal(X.Data, true, X.getSubKind()) {}
|
||||
|
||||
@@ -529,7 +529,7 @@ public:
|
||||
} // end clang namespace
|
||||
|
||||
namespace llvm {
|
||||
static inline raw_ostream& operator<<(raw_ostream& os,
|
||||
static inline raw_ostream &operator<<(raw_ostream &os,
|
||||
clang::ento::SVal V) {
|
||||
V.dumpToStream(os);
|
||||
return os;
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
/// for the compound literal and 'BegInit' and 'EndInit' represent an
|
||||
/// array of initializer values.
|
||||
virtual StoreRef BindCompoundLiteral(Store store,
|
||||
const CompoundLiteralExpr* cl,
|
||||
const CompoundLiteralExpr *cl,
|
||||
const LocationContext *LC, SVal v) = 0;
|
||||
|
||||
/// getInitialStore - Returns the initial "empty" store representing the
|
||||
@@ -97,16 +97,16 @@ public:
|
||||
return svalBuilder.makeLoc(MRMgr.getStringRegion(S));
|
||||
}
|
||||
|
||||
Loc getLValueCompoundLiteral(const CompoundLiteralExpr* CL,
|
||||
Loc getLValueCompoundLiteral(const CompoundLiteralExpr *CL,
|
||||
const LocationContext *LC) {
|
||||
return loc::MemRegionVal(MRMgr.getCompoundLiteralRegion(CL, LC));
|
||||
}
|
||||
|
||||
virtual SVal getLValueIvar(const ObjCIvarDecl* decl, SVal base) {
|
||||
virtual SVal getLValueIvar(const ObjCIvarDecl *decl, SVal base) {
|
||||
return getLValueFieldOrIvar(decl, base);
|
||||
}
|
||||
|
||||
virtual SVal getLValueField(const FieldDecl* D, SVal Base) {
|
||||
virtual SVal getLValueField(const FieldDecl *D, SVal Base) {
|
||||
return getLValueFieldOrIvar(D, Base);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
virtual StoreRef enterStackFrame(const GRState *state,
|
||||
const StackFrameContext *frame);
|
||||
|
||||
virtual void print(Store store, raw_ostream& Out,
|
||||
virtual void print(Store store, raw_ostream &Out,
|
||||
const char* nl, const char *sep) = 0;
|
||||
|
||||
class BindingsHandler {
|
||||
@@ -223,7 +223,7 @@ protected:
|
||||
QualType castTy, bool performTestOnly = true);
|
||||
|
||||
private:
|
||||
SVal getLValueFieldOrIvar(const Decl* decl, SVal base);
|
||||
SVal getLValueFieldOrIvar(const Decl *decl, SVal base);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace ento {
|
||||
/// locations to values. At a high-level, it represents the symbolic
|
||||
/// memory model. Different subclasses of StoreManager may choose
|
||||
/// different types to represent the locations and values.
|
||||
typedef const void* Store;
|
||||
typedef const void *Store;
|
||||
|
||||
class StoreManager;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class SubEngine {
|
||||
public:
|
||||
virtual ~SubEngine() {}
|
||||
|
||||
virtual const GRState* getInitialState(const LocationContext *InitLoc) = 0;
|
||||
virtual const GRState *getInitialState(const LocationContext *InitLoc) = 0;
|
||||
|
||||
virtual AnalysisManager &getAnalysisManager() = 0;
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
/// Called by CoreEngine. Used to generate successor
|
||||
/// nodes by processing the 'effects' of a branch condition.
|
||||
virtual void processBranch(const Stmt* Condition, const Stmt* Term,
|
||||
virtual void processBranch(const Stmt *Condition, const Stmt *Term,
|
||||
BranchNodeBuilder& builder) = 0;
|
||||
|
||||
/// Called by CoreEngine. Used to generate successor
|
||||
@@ -87,12 +87,12 @@ public:
|
||||
|
||||
/// Called by ConstraintManager. Used to call checker-specific
|
||||
/// logic for handling assumptions on symbolic values.
|
||||
virtual const GRState* processAssume(const GRState *state,
|
||||
virtual const GRState *processAssume(const GRState *state,
|
||||
SVal cond, bool assumption) = 0;
|
||||
|
||||
/// wantsRegionChangeUpdate - Called by GRStateManager to determine if a
|
||||
/// region change should trigger a processRegionChanges update.
|
||||
virtual bool wantsRegionChangeUpdate(const GRState* state) = 0;
|
||||
virtual bool wantsRegionChangeUpdate(const GRState *state) = 0;
|
||||
|
||||
/// processRegionChanges - Called by GRStateManager whenever a change is made
|
||||
/// to the store. Used to update checkers that track region values.
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
|
||||
|
||||
inline const GRState *
|
||||
processRegionChange(const GRState* state,
|
||||
processRegionChange(const GRState *state,
|
||||
const MemRegion* MR) {
|
||||
return processRegionChanges(state, 0, &MR, &MR+1);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
SymbolID getSymbolID() const { return Sym; }
|
||||
|
||||
// Implement isa<T> support.
|
||||
static inline bool classof(const SymExpr* SE) {
|
||||
static inline bool classof(const SymExpr *SE) {
|
||||
Kind k = SE->getKind();
|
||||
return k >= BEGIN_SYMBOLS && k <= END_SYMBOLS;
|
||||
}
|
||||
@@ -117,34 +117,34 @@ public:
|
||||
QualType getType(ASTContext&) const;
|
||||
|
||||
// Implement isa<T> support.
|
||||
static inline bool classof(const SymExpr* SE) {
|
||||
static inline bool classof(const SymExpr *SE) {
|
||||
return SE->getKind() == RegionValueKind;
|
||||
}
|
||||
};
|
||||
|
||||
/// A symbol representing the result of an expression.
|
||||
class SymbolConjured : public SymbolData {
|
||||
const Stmt* S;
|
||||
const Stmt *S;
|
||||
QualType T;
|
||||
unsigned Count;
|
||||
const void* SymbolTag;
|
||||
const void *SymbolTag;
|
||||
|
||||
public:
|
||||
SymbolConjured(SymbolID sym, const Stmt* s, QualType t, unsigned count,
|
||||
const void* symbolTag)
|
||||
SymbolConjured(SymbolID sym, const Stmt *s, QualType t, unsigned count,
|
||||
const void *symbolTag)
|
||||
: SymbolData(ConjuredKind, sym), S(s), T(t), Count(count),
|
||||
SymbolTag(symbolTag) {}
|
||||
|
||||
const Stmt* getStmt() const { return S; }
|
||||
const Stmt *getStmt() const { return S; }
|
||||
unsigned getCount() const { return Count; }
|
||||
const void* getTag() const { return SymbolTag; }
|
||||
const void *getTag() const { return SymbolTag; }
|
||||
|
||||
QualType getType(ASTContext&) const;
|
||||
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
static void Profile(llvm::FoldingSetNodeID& profile, const Stmt* S,
|
||||
QualType T, unsigned Count, const void* SymbolTag) {
|
||||
static void Profile(llvm::FoldingSetNodeID& profile, const Stmt *S,
|
||||
QualType T, unsigned Count, const void *SymbolTag) {
|
||||
profile.AddInteger((unsigned) ConjuredKind);
|
||||
profile.AddPointer(S);
|
||||
profile.Add(T);
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
}
|
||||
|
||||
// Implement isa<T> support.
|
||||
static inline bool classof(const SymExpr* SE) {
|
||||
static inline bool classof(const SymExpr *SE) {
|
||||
return SE->getKind() == ConjuredKind;
|
||||
}
|
||||
};
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
}
|
||||
|
||||
// Implement isa<T> support.
|
||||
static inline bool classof(const SymExpr* SE) {
|
||||
static inline bool classof(const SymExpr *SE) {
|
||||
return SE->getKind() == DerivedKind;
|
||||
}
|
||||
};
|
||||
@@ -222,7 +222,7 @@ public:
|
||||
}
|
||||
|
||||
// Implement isa<T> support.
|
||||
static inline bool classof(const SymExpr* SE) {
|
||||
static inline bool classof(const SymExpr *SE) {
|
||||
return SE->getKind() == ExtentKind;
|
||||
}
|
||||
};
|
||||
@@ -233,19 +233,19 @@ public:
|
||||
/// Intended for use by checkers.
|
||||
class SymbolMetadata : public SymbolData {
|
||||
const MemRegion* R;
|
||||
const Stmt* S;
|
||||
const Stmt *S;
|
||||
QualType T;
|
||||
unsigned Count;
|
||||
const void* Tag;
|
||||
const void *Tag;
|
||||
public:
|
||||
SymbolMetadata(SymbolID sym, const MemRegion* r, const Stmt* s, QualType t,
|
||||
unsigned count, const void* tag)
|
||||
SymbolMetadata(SymbolID sym, const MemRegion* r, const Stmt *s, QualType t,
|
||||
unsigned count, const void *tag)
|
||||
: SymbolData(MetadataKind, sym), R(r), S(s), T(t), Count(count), Tag(tag) {}
|
||||
|
||||
const MemRegion *getRegion() const { return R; }
|
||||
const Stmt* getStmt() const { return S; }
|
||||
const Stmt *getStmt() const { return S; }
|
||||
unsigned getCount() const { return Count; }
|
||||
const void* getTag() const { return Tag; }
|
||||
const void *getTag() const { return Tag; }
|
||||
|
||||
QualType getType(ASTContext&) const;
|
||||
|
||||
@@ -267,7 +267,7 @@ public:
|
||||
}
|
||||
|
||||
// Implement isa<T> support.
|
||||
static inline bool classof(const SymExpr* SE) {
|
||||
static inline bool classof(const SymExpr *SE) {
|
||||
return SE->getKind() == MetadataKind;
|
||||
}
|
||||
};
|
||||
@@ -286,7 +286,7 @@ public:
|
||||
|
||||
// FIXME: We probably need to make this out-of-line to avoid redundant
|
||||
// generation of virtual functions.
|
||||
QualType getType(ASTContext& C) const { return T; }
|
||||
QualType getType(ASTContext &C) const { return T; }
|
||||
|
||||
BinaryOperator::Opcode getOpcode() const { return Op; }
|
||||
|
||||
@@ -310,7 +310,7 @@ public:
|
||||
}
|
||||
|
||||
// Implement isa<T> support.
|
||||
static inline bool classof(const SymExpr* SE) {
|
||||
static inline bool classof(const SymExpr *SE) {
|
||||
return SE->getKind() == SymIntKind;
|
||||
}
|
||||
};
|
||||
@@ -333,7 +333,7 @@ public:
|
||||
|
||||
// FIXME: We probably need to make this out-of-line to avoid redundant
|
||||
// generation of virtual functions.
|
||||
QualType getType(ASTContext& C) const { return T; }
|
||||
QualType getType(ASTContext &C) const { return T; }
|
||||
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
|
||||
@@ -351,7 +351,7 @@ public:
|
||||
}
|
||||
|
||||
// Implement isa<T> support.
|
||||
static inline bool classof(const SymExpr* SE) {
|
||||
static inline bool classof(const SymExpr *SE) {
|
||||
return SE->getKind() == SymSymKind;
|
||||
}
|
||||
};
|
||||
@@ -367,10 +367,10 @@ class SymbolManager {
|
||||
unsigned SymbolCounter;
|
||||
llvm::BumpPtrAllocator& BPAlloc;
|
||||
BasicValueFactory &BV;
|
||||
ASTContext& Ctx;
|
||||
ASTContext &Ctx;
|
||||
|
||||
public:
|
||||
SymbolManager(ASTContext& ctx, BasicValueFactory &bv,
|
||||
SymbolManager(ASTContext &ctx, BasicValueFactory &bv,
|
||||
llvm::BumpPtrAllocator& bpalloc)
|
||||
: SymbolDependencies(16), SymbolCounter(0),
|
||||
BPAlloc(bpalloc), BV(bv), Ctx(ctx) {}
|
||||
@@ -382,12 +382,12 @@ public:
|
||||
/// \brief Make a unique symbol for MemRegion R according to its kind.
|
||||
const SymbolRegionValue* getRegionValueSymbol(const TypedValueRegion* R);
|
||||
|
||||
const SymbolConjured* getConjuredSymbol(const Stmt* E, QualType T,
|
||||
const SymbolConjured* getConjuredSymbol(const Stmt *E, QualType T,
|
||||
unsigned VisitCount,
|
||||
const void* SymbolTag = 0);
|
||||
const void *SymbolTag = 0);
|
||||
|
||||
const SymbolConjured* getConjuredSymbol(const Expr* E, unsigned VisitCount,
|
||||
const void* SymbolTag = 0) {
|
||||
const SymbolConjured* getConjuredSymbol(const Expr *E, unsigned VisitCount,
|
||||
const void *SymbolTag = 0) {
|
||||
return getConjuredSymbol(E, E->getType(), VisitCount, SymbolTag);
|
||||
}
|
||||
|
||||
@@ -400,9 +400,9 @@ public:
|
||||
///
|
||||
/// VisitCount can be used to differentiate regions corresponding to
|
||||
/// different loop iterations, thus, making the symbol path-dependent.
|
||||
const SymbolMetadata* getMetadataSymbol(const MemRegion* R, const Stmt* S,
|
||||
const SymbolMetadata* getMetadataSymbol(const MemRegion* R, const Stmt *S,
|
||||
QualType T, unsigned VisitCount,
|
||||
const void* SymbolTag = 0);
|
||||
const void *SymbolTag = 0);
|
||||
|
||||
const SymIntExpr *getSymIntExpr(const SymExpr *lhs, BinaryOperator::Opcode op,
|
||||
const llvm::APSInt& rhs, QualType t);
|
||||
@@ -536,7 +536,7 @@ public:
|
||||
} // end clang namespace
|
||||
|
||||
namespace llvm {
|
||||
static inline raw_ostream& operator<<(raw_ostream& os,
|
||||
static inline raw_ostream &operator<<(raw_ostream &os,
|
||||
const clang::ento::SymExpr *SE) {
|
||||
SE->dumpToStream(os);
|
||||
return os;
|
||||
|
||||
@@ -42,17 +42,17 @@ public:
|
||||
|
||||
// Calls.
|
||||
|
||||
virtual void evalCall(ExplodedNodeSet& Dst,
|
||||
virtual void evalCall(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Engine,
|
||||
StmtNodeBuilder& Builder,
|
||||
const CallExpr* CE, SVal L,
|
||||
ExplodedNode* Pred) {}
|
||||
const CallExpr *CE, SVal L,
|
||||
ExplodedNode *Pred) {}
|
||||
|
||||
virtual void evalObjCMessage(ExplodedNodeSet& Dst,
|
||||
virtual void evalObjCMessage(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Engine,
|
||||
StmtNodeBuilder& Builder,
|
||||
ObjCMessage msg,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *state) {}
|
||||
|
||||
// Stores.
|
||||
@@ -65,22 +65,22 @@ public:
|
||||
EndOfFunctionNodeBuilder& Builder) {}
|
||||
|
||||
|
||||
virtual void evalDeadSymbols(ExplodedNodeSet& Dst,
|
||||
virtual void evalDeadSymbols(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Engine,
|
||||
StmtNodeBuilder& Builder,
|
||||
ExplodedNode* Pred,
|
||||
const GRState* state,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *state,
|
||||
SymbolReaper& SymReaper) {}
|
||||
|
||||
// Return statements.
|
||||
virtual void evalReturn(ExplodedNodeSet& Dst,
|
||||
virtual void evalReturn(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Engine,
|
||||
StmtNodeBuilder& Builder,
|
||||
const ReturnStmt* S,
|
||||
ExplodedNode* Pred) {}
|
||||
const ReturnStmt *S,
|
||||
ExplodedNode *Pred) {}
|
||||
|
||||
// Assumptions.
|
||||
virtual const GRState* evalAssume(const GRState *state,
|
||||
virtual const GRState *evalAssume(const GRState *state,
|
||||
SVal Cond, bool Assumption) {
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -28,20 +28,20 @@ class ExplodedNode;
|
||||
class ExplodedNodeImpl;
|
||||
|
||||
class WorkListUnit {
|
||||
ExplodedNode* node;
|
||||
ExplodedNode *node;
|
||||
BlockCounter counter;
|
||||
const CFGBlock* block;
|
||||
const CFGBlock *block;
|
||||
unsigned blockIdx; // This is the index of the next statement.
|
||||
|
||||
public:
|
||||
WorkListUnit(ExplodedNode* N, BlockCounter C,
|
||||
const CFGBlock* B, unsigned idx)
|
||||
WorkListUnit(ExplodedNode *N, BlockCounter C,
|
||||
const CFGBlock *B, unsigned idx)
|
||||
: node(N),
|
||||
counter(C),
|
||||
block(B),
|
||||
blockIdx(idx) {}
|
||||
|
||||
explicit WorkListUnit(ExplodedNode* N, BlockCounter C)
|
||||
explicit WorkListUnit(ExplodedNode *N, BlockCounter C)
|
||||
: node(N),
|
||||
counter(C),
|
||||
block(NULL),
|
||||
|
||||
@@ -204,7 +204,7 @@ void LocationContext::ProfileCommon(llvm::FoldingSetNodeID &ID,
|
||||
ContextKind ck,
|
||||
AnalysisContext *ctx,
|
||||
const LocationContext *parent,
|
||||
const void* data) {
|
||||
const void *data) {
|
||||
ID.AddInteger(ck);
|
||||
ID.AddPointer(ctx);
|
||||
ID.AddPointer(parent);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,7 @@ namespace {
|
||||
};
|
||||
}
|
||||
|
||||
static LiveVariablesImpl &getImpl(void* x) {
|
||||
static LiveVariablesImpl &getImpl(void *x) {
|
||||
return *((LiveVariablesImpl *) x);
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ void TransferFunctions::VisitBinaryOperator(BinaryOperator *B) {
|
||||
// Assigning to a variable?
|
||||
Expr *LHS = B->getLHS()->IgnoreParens();
|
||||
|
||||
if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(LHS))
|
||||
if (DeclRefExpr *DR = dyn_cast<DeclRefExpr>(LHS))
|
||||
if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {
|
||||
// Assignments to references don't kill the ref's address
|
||||
if (VD->getType()->isReferenceType())
|
||||
@@ -274,7 +274,7 @@ void TransferFunctions::VisitDeclRefExpr(DeclRefExpr *DR) {
|
||||
void TransferFunctions::VisitDeclStmt(DeclStmt *DS) {
|
||||
for (DeclStmt::decl_iterator DI=DS->decl_begin(), DE = DS->decl_end();
|
||||
DI != DE; ++DI)
|
||||
if (VarDecl* VD = dyn_cast<VarDecl>(*DI)) {
|
||||
if (VarDecl *VD = dyn_cast<VarDecl>(*DI)) {
|
||||
if (!isAlwaysAlive(VD))
|
||||
val.liveDecls = LV.DSetFact.remove(val.liveDecls, VD);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void PseudoConstantAnalysis::RunAnalysis() {
|
||||
WorkList.push_back(DeclBody);
|
||||
|
||||
while (!WorkList.empty()) {
|
||||
const Stmt* Head = WorkList.front();
|
||||
const Stmt *Head = WorkList.front();
|
||||
WorkList.pop_front();
|
||||
|
||||
if (const Expr *Ex = dyn_cast<Expr>(Head))
|
||||
|
||||
@@ -408,8 +408,8 @@ void TransferFunctions::reportUninit(const DeclRefExpr *ex,
|
||||
if (handler) handler->handleUseOfUninitVariable(ex, vd, isAlwaysUnit);
|
||||
}
|
||||
|
||||
FindVarResult TransferFunctions::findBlockVarDecl(Expr* ex) {
|
||||
if (DeclRefExpr* dr = dyn_cast<DeclRefExpr>(ex->IgnoreParenCasts()))
|
||||
FindVarResult TransferFunctions::findBlockVarDecl(Expr *ex) {
|
||||
if (DeclRefExpr *dr = dyn_cast<DeclRefExpr>(ex->IgnoreParenCasts()))
|
||||
if (VarDecl *vd = dyn_cast<VarDecl>(dr->getDecl()))
|
||||
if (isTrackedVar(vd))
|
||||
return FindVarResult(vd, dr);
|
||||
@@ -419,9 +419,9 @@ FindVarResult TransferFunctions::findBlockVarDecl(Expr* ex) {
|
||||
void TransferFunctions::VisitObjCForCollectionStmt(ObjCForCollectionStmt *fs) {
|
||||
// This represents an initialization of the 'element' value.
|
||||
Stmt *element = fs->getElement();
|
||||
const VarDecl* vd = 0;
|
||||
const VarDecl *vd = 0;
|
||||
|
||||
if (DeclStmt* ds = dyn_cast<DeclStmt>(element)) {
|
||||
if (DeclStmt *ds = dyn_cast<DeclStmt>(element)) {
|
||||
vd = cast<VarDecl>(ds->getSingleDecl());
|
||||
if (!isTrackedVar(vd))
|
||||
vd = 0;
|
||||
@@ -509,7 +509,7 @@ void TransferFunctions::VisitDeclStmt(DeclStmt *ds) {
|
||||
void TransferFunctions::VisitBinaryOperator(clang::BinaryOperator *bo) {
|
||||
if (bo->isAssignmentOp()) {
|
||||
const FindVarResult &res = findBlockVarDecl(bo->getLHS());
|
||||
if (const VarDecl* vd = res.getDecl()) {
|
||||
if (const VarDecl *vd = res.getDecl()) {
|
||||
ValueVector::reference val = vals[vd];
|
||||
if (isUninitialized(val)) {
|
||||
if (bo->getOpcode() != BO_Assign)
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
SVal location);
|
||||
|
||||
void dump() const;
|
||||
void dumpToStream(raw_ostream& os) const;
|
||||
void dumpToStream(raw_ostream &os) const;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ void RegionRawOffsetV2::dump() const {
|
||||
dumpToStream(llvm::errs());
|
||||
}
|
||||
|
||||
void RegionRawOffsetV2::dumpToStream(raw_ostream& os) const {
|
||||
void RegionRawOffsetV2::dumpToStream(raw_ostream &os) const {
|
||||
os << "raw_offset_v2{" << getRegion() << ',' << getByteOffset() << '}';
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ void AttrNonNullChecker::checkPreStmt(const CallExpr *CE,
|
||||
// Check if the callee has a 'nonnull' attribute.
|
||||
SVal X = state->getSVal(CE->getCallee());
|
||||
|
||||
const FunctionDecl* FD = X.getAsFunctionDecl();
|
||||
const FunctionDecl *FD = X.getAsFunctionDecl();
|
||||
if (!FD)
|
||||
return;
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;
|
||||
|
||||
private:
|
||||
void EmitError(const TypedRegion* R, const Expr* Ex,
|
||||
void EmitError(const TypedRegion* R, const Expr *Ex,
|
||||
uint64_t SourceSize, uint64_t TargetSize, uint64_t NumberKind);
|
||||
};
|
||||
} // end anonymous namespace
|
||||
@@ -194,7 +194,7 @@ namespace {
|
||||
};
|
||||
}
|
||||
|
||||
static Optional<uint64_t> GetCFNumberSize(ASTContext& Ctx, uint64_t i) {
|
||||
static Optional<uint64_t> GetCFNumberSize(ASTContext &Ctx, uint64_t i) {
|
||||
static const unsigned char FixedSize[] = { 8, 16, 32, 64, 32, 64 };
|
||||
|
||||
if (i < kCFNumberCharType)
|
||||
@@ -248,10 +248,10 @@ static const char* GetCFNumberTypeStr(uint64_t i) {
|
||||
|
||||
void CFNumberCreateChecker::checkPreStmt(const CallExpr *CE,
|
||||
CheckerContext &C) const {
|
||||
const Expr* Callee = CE->getCallee();
|
||||
const Expr *Callee = CE->getCallee();
|
||||
const GRState *state = C.getState();
|
||||
SVal CallV = state->getSVal(Callee);
|
||||
const FunctionDecl* FD = CallV.getAsFunctionDecl();
|
||||
const FunctionDecl *FD = CallV.getAsFunctionDecl();
|
||||
|
||||
if (!FD)
|
||||
return;
|
||||
@@ -351,21 +351,21 @@ class CFRetainReleaseChecker : public Checker< check::PreStmt<CallExpr> > {
|
||||
mutable IdentifierInfo *Retain, *Release;
|
||||
public:
|
||||
CFRetainReleaseChecker(): Retain(0), Release(0) {}
|
||||
void checkPreStmt(const CallExpr* CE, CheckerContext& C) const;
|
||||
void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
|
||||
void CFRetainReleaseChecker::checkPreStmt(const CallExpr* CE,
|
||||
CheckerContext& C) const {
|
||||
void CFRetainReleaseChecker::checkPreStmt(const CallExpr *CE,
|
||||
CheckerContext &C) const {
|
||||
// If the CallExpr doesn't have exactly 1 argument just give up checking.
|
||||
if (CE->getNumArgs() != 1)
|
||||
return;
|
||||
|
||||
// Get the function declaration of the callee.
|
||||
const GRState* state = C.getState();
|
||||
const GRState *state = C.getState();
|
||||
SVal X = state->getSVal(CE->getCallee());
|
||||
const FunctionDecl* FD = X.getAsFunctionDecl();
|
||||
const FunctionDecl *FD = X.getAsFunctionDecl();
|
||||
|
||||
if (!FD)
|
||||
return;
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
const GRState *state,
|
||||
const Expr *Ex, SVal V);
|
||||
|
||||
static bool SummarizeRegion(raw_ostream& os, ASTContext& Ctx,
|
||||
static bool SummarizeRegion(raw_ostream &os, ASTContext &Ctx,
|
||||
const MemRegion *MR);
|
||||
|
||||
// Re-usable checks
|
||||
@@ -767,7 +767,7 @@ const GRState *CStringChecker::InvalidateBuffer(CheckerContext &C,
|
||||
return state->unbindLoc(*L);
|
||||
}
|
||||
|
||||
bool CStringChecker::SummarizeRegion(raw_ostream& os, ASTContext& Ctx,
|
||||
bool CStringChecker::SummarizeRegion(raw_ostream &os, ASTContext &Ctx,
|
||||
const MemRegion *MR) {
|
||||
const TypedValueRegion *TVR = dyn_cast<TypedValueRegion>(MR);
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ void CallAndMessageChecker::HandleNilReceiver(CheckerContext &C,
|
||||
// have the "use of undefined value" be smarter about where the
|
||||
// undefined value came from.
|
||||
if (C.getPredecessor()->getParentMap().isConsumedExpr(msg.getOriginExpr())){
|
||||
if (ExplodedNode* N = C.generateSink(state))
|
||||
if (ExplodedNode *N = C.generateSink(state))
|
||||
emitNilReceiverBug(C, msg, N);
|
||||
return;
|
||||
}
|
||||
@@ -328,7 +328,7 @@ void CallAndMessageChecker::HandleNilReceiver(CheckerContext &C,
|
||||
Ctx.LongDoubleTy == CanRetTy ||
|
||||
Ctx.LongLongTy == CanRetTy ||
|
||||
Ctx.UnsignedLongLongTy == CanRetTy))) {
|
||||
if (ExplodedNode* N = C.generateSink(state))
|
||||
if (ExplodedNode *N = C.generateSink(state))
|
||||
emitNilReceiverBug(C, msg, N);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
using namespace clang;
|
||||
using namespace ento;
|
||||
|
||||
static bool scan_dealloc(Stmt* S, Selector Dealloc) {
|
||||
static bool scan_dealloc(Stmt *S, Selector Dealloc) {
|
||||
|
||||
if (ObjCMessageExpr* ME = dyn_cast<ObjCMessageExpr>(S))
|
||||
if (ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S))
|
||||
if (ME->getSelector() == Dealloc) {
|
||||
switch (ME->getReceiverKind()) {
|
||||
case ObjCMessageExpr::Instance: return false;
|
||||
@@ -48,26 +48,26 @@ static bool scan_dealloc(Stmt* S, Selector Dealloc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool scan_ivar_release(Stmt* S, ObjCIvarDecl* ID,
|
||||
const ObjCPropertyDecl* PD,
|
||||
static bool scan_ivar_release(Stmt *S, ObjCIvarDecl *ID,
|
||||
const ObjCPropertyDecl *PD,
|
||||
Selector Release,
|
||||
IdentifierInfo* SelfII,
|
||||
ASTContext& Ctx) {
|
||||
ASTContext &Ctx) {
|
||||
|
||||
// [mMyIvar release]
|
||||
if (ObjCMessageExpr* ME = dyn_cast<ObjCMessageExpr>(S))
|
||||
if (ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S))
|
||||
if (ME->getSelector() == Release)
|
||||
if (ME->getInstanceReceiver())
|
||||
if (Expr* Receiver = ME->getInstanceReceiver()->IgnoreParenCasts())
|
||||
if (ObjCIvarRefExpr* E = dyn_cast<ObjCIvarRefExpr>(Receiver))
|
||||
if (Expr *Receiver = ME->getInstanceReceiver()->IgnoreParenCasts())
|
||||
if (ObjCIvarRefExpr *E = dyn_cast<ObjCIvarRefExpr>(Receiver))
|
||||
if (E->getDecl() == ID)
|
||||
return true;
|
||||
|
||||
// [self setMyIvar:nil];
|
||||
if (ObjCMessageExpr* ME = dyn_cast<ObjCMessageExpr>(S))
|
||||
if (ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S))
|
||||
if (ME->getInstanceReceiver())
|
||||
if (Expr* Receiver = ME->getInstanceReceiver()->IgnoreParenCasts())
|
||||
if (DeclRefExpr* E = dyn_cast<DeclRefExpr>(Receiver))
|
||||
if (Expr *Receiver = ME->getInstanceReceiver()->IgnoreParenCasts())
|
||||
if (DeclRefExpr *E = dyn_cast<DeclRefExpr>(Receiver))
|
||||
if (E->getDecl()->getIdentifier() == SelfII)
|
||||
if (ME->getMethodDecl() == PD->getSetterMethodDecl() &&
|
||||
ME->getNumArgs() == 1 &&
|
||||
@@ -78,7 +78,7 @@ static bool scan_ivar_release(Stmt* S, ObjCIvarDecl* ID,
|
||||
// self.myIvar = nil;
|
||||
if (BinaryOperator* BO = dyn_cast<BinaryOperator>(S))
|
||||
if (BO->isAssignmentOp())
|
||||
if (ObjCPropertyRefExpr* PRE =
|
||||
if (ObjCPropertyRefExpr *PRE =
|
||||
dyn_cast<ObjCPropertyRefExpr>(BO->getLHS()->IgnoreParenCasts()))
|
||||
if (PRE->isExplicitProperty() && PRE->getExplicitProperty() == PD)
|
||||
if (BO->getRHS()->isNullPointerConstant(Ctx,
|
||||
@@ -96,13 +96,13 @@ static bool scan_ivar_release(Stmt* S, ObjCIvarDecl* ID,
|
||||
return false;
|
||||
}
|
||||
|
||||
static void checkObjCDealloc(const ObjCImplementationDecl* D,
|
||||
static void checkObjCDealloc(const ObjCImplementationDecl *D,
|
||||
const LangOptions& LOpts, BugReporter& BR) {
|
||||
|
||||
assert (LOpts.getGCMode() != LangOptions::GCOnly);
|
||||
|
||||
ASTContext& Ctx = BR.getContext();
|
||||
const ObjCInterfaceDecl* ID = D->getClassInterface();
|
||||
ASTContext &Ctx = BR.getContext();
|
||||
const ObjCInterfaceDecl *ID = D->getClassInterface();
|
||||
|
||||
// Does the class contain any ivars that are pointers (or id<...>)?
|
||||
// If not, skip the check entirely.
|
||||
@@ -114,7 +114,7 @@ static void checkObjCDealloc(const ObjCImplementationDecl* D,
|
||||
for (ObjCInterfaceDecl::ivar_iterator I=ID->ivar_begin(), E=ID->ivar_end();
|
||||
I!=E; ++I) {
|
||||
|
||||
ObjCIvarDecl* ID = *I;
|
||||
ObjCIvarDecl *ID = *I;
|
||||
QualType T = ID->getType();
|
||||
|
||||
if (!T->isObjCObjectPointerType() ||
|
||||
@@ -154,7 +154,7 @@ static void checkObjCDealloc(const ObjCImplementationDecl* D,
|
||||
// Get the "dealloc" selector.
|
||||
IdentifierInfo* II = &Ctx.Idents.get("dealloc");
|
||||
Selector S = Ctx.Selectors.getSelector(0, &II);
|
||||
ObjCMethodDecl* MD = 0;
|
||||
ObjCMethodDecl *MD = 0;
|
||||
|
||||
// Scan the instance methods for "dealloc".
|
||||
for (ObjCImplementationDecl::instmeth_iterator I = D->instmeth_begin(),
|
||||
@@ -213,7 +213,7 @@ static void checkObjCDealloc(const ObjCImplementationDecl* D,
|
||||
if ((*I)->getPropertyImplementation() != ObjCPropertyImplDecl::Synthesize)
|
||||
continue;
|
||||
|
||||
ObjCIvarDecl* ID = (*I)->getPropertyIvarDecl();
|
||||
ObjCIvarDecl *ID = (*I)->getPropertyIvarDecl();
|
||||
if (!ID)
|
||||
continue;
|
||||
|
||||
@@ -221,7 +221,7 @@ static void checkObjCDealloc(const ObjCImplementationDecl* D,
|
||||
if (!T->isObjCObjectPointerType()) // Skip non-pointer ivars
|
||||
continue;
|
||||
|
||||
const ObjCPropertyDecl* PD = (*I)->getPropertyDecl();
|
||||
const ObjCPropertyDecl *PD = (*I)->getPropertyDecl();
|
||||
if (!PD)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ using namespace clang;
|
||||
using namespace ento;
|
||||
|
||||
static bool AreTypesCompatible(QualType Derived, QualType Ancestor,
|
||||
ASTContext& C) {
|
||||
ASTContext &C) {
|
||||
|
||||
// Right now don't compare the compatibility of pointers. That involves
|
||||
// looking at subtyping relationships. FIXME: Future patch.
|
||||
@@ -71,16 +71,16 @@ static void CompareReturnTypes(const ObjCMethodDecl *MethDerived,
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckObjCInstMethSignature(const ObjCImplementationDecl* ID,
|
||||
static void CheckObjCInstMethSignature(const ObjCImplementationDecl *ID,
|
||||
BugReporter& BR) {
|
||||
|
||||
const ObjCInterfaceDecl* D = ID->getClassInterface();
|
||||
const ObjCInterfaceDecl* C = D->getSuperClass();
|
||||
const ObjCInterfaceDecl *D = ID->getClassInterface();
|
||||
const ObjCInterfaceDecl *C = D->getSuperClass();
|
||||
|
||||
if (!C)
|
||||
return;
|
||||
|
||||
ASTContext& Ctx = BR.getContext();
|
||||
ASTContext &Ctx = BR.getContext();
|
||||
|
||||
// Build a DenseMap of the methods for quick querying.
|
||||
typedef llvm::DenseMap<Selector,ObjCMethodDecl*> MapTy;
|
||||
@@ -90,7 +90,7 @@ static void CheckObjCInstMethSignature(const ObjCImplementationDecl* ID,
|
||||
for (ObjCImplementationDecl::instmeth_iterator I=ID->instmeth_begin(),
|
||||
E=ID->instmeth_end(); I!=E; ++I) {
|
||||
|
||||
ObjCMethodDecl* M = *I;
|
||||
ObjCMethodDecl *M = *I;
|
||||
IMeths[M->getSelector()] = M;
|
||||
++NumMethods;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ static void CheckObjCInstMethSignature(const ObjCImplementationDecl* ID,
|
||||
for (ObjCInterfaceDecl::instmeth_iterator I=C->instmeth_begin(),
|
||||
E=C->instmeth_end(); I!=E; ++I) {
|
||||
|
||||
ObjCMethodDecl* M = *I;
|
||||
ObjCMethodDecl *M = *I;
|
||||
Selector S = M->getSelector();
|
||||
|
||||
MapTy::iterator MI = IMeths.find(S);
|
||||
@@ -110,7 +110,7 @@ static void CheckObjCInstMethSignature(const ObjCImplementationDecl* ID,
|
||||
continue;
|
||||
|
||||
--NumMethods;
|
||||
ObjCMethodDecl* MethDerived = MI->second;
|
||||
ObjCMethodDecl *MethDerived = MI->second;
|
||||
MI->second = 0;
|
||||
|
||||
CompareReturnTypes(MethDerived, M, BR, Ctx, ID);
|
||||
|
||||
@@ -102,7 +102,7 @@ void ChrootChecker::Chdir(CheckerContext &C, const CallExpr *CE) const {
|
||||
GRStateManager &Mgr = state->getStateManager();
|
||||
|
||||
// If there are no jail state in the GDM, just return.
|
||||
const void* k = state->FindGDM(ChrootChecker::getTag());
|
||||
const void *k = state->FindGDM(ChrootChecker::getTag());
|
||||
if (!k)
|
||||
return;
|
||||
|
||||
@@ -143,7 +143,7 @@ void ChrootChecker::checkPreStmt(const CallExpr *CE, CheckerContext &C) const {
|
||||
return;
|
||||
|
||||
// If jail state is ROOT_CHANGED, generate BugReport.
|
||||
void* const* k = state->FindGDM(ChrootChecker::getTag());
|
||||
void *const* k = state->FindGDM(ChrootChecker::getTag());
|
||||
if (k)
|
||||
if (isRootChanged((intptr_t) *k))
|
||||
if (ExplodedNode *N = C.generateNode()) {
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
virtual ~DeadStoreObs() {}
|
||||
|
||||
void Report(const VarDecl* V, DeadStoreKind dsk,
|
||||
void Report(const VarDecl *V, DeadStoreKind dsk,
|
||||
SourceLocation L, SourceRange R) {
|
||||
if (Escaped.count(V))
|
||||
return;
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
BR.EmitBasicReport(BugType, "Dead store", msg, L, R);
|
||||
}
|
||||
|
||||
void CheckVarDecl(const VarDecl* VD, const Expr* Ex, const Expr* Val,
|
||||
void CheckVarDecl(const VarDecl *VD, const Expr *Ex, const Expr *Val,
|
||||
DeadStoreKind dsk,
|
||||
const LiveVariables::LivenessValues &Live) {
|
||||
|
||||
@@ -152,17 +152,17 @@ public:
|
||||
Val->getSourceRange());
|
||||
}
|
||||
|
||||
void CheckDeclRef(const DeclRefExpr* DR, const Expr* Val, DeadStoreKind dsk,
|
||||
void CheckDeclRef(const DeclRefExpr *DR, const Expr *Val, DeadStoreKind dsk,
|
||||
const LiveVariables::LivenessValues& Live) {
|
||||
if (const VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl()))
|
||||
if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl()))
|
||||
CheckVarDecl(VD, DR, Val, dsk, Live);
|
||||
}
|
||||
|
||||
bool isIncrement(VarDecl* VD, const BinaryOperator* B) {
|
||||
bool isIncrement(VarDecl *VD, const BinaryOperator* B) {
|
||||
if (B->isCompoundAssignmentOp())
|
||||
return true;
|
||||
|
||||
const Expr* RHS = B->getRHS()->IgnoreParenCasts();
|
||||
const Expr *RHS = B->getRHS()->IgnoreParenCasts();
|
||||
const BinaryOperator* BRHS = dyn_cast<BinaryOperator>(RHS);
|
||||
|
||||
if (!BRHS)
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void observeStmt(const Stmt* S, const CFGBlock *block,
|
||||
virtual void observeStmt(const Stmt *S, const CFGBlock *block,
|
||||
const LiveVariables::LivenessValues &Live) {
|
||||
|
||||
currentBlock = block;
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
if (const BinaryOperator* B = dyn_cast<BinaryOperator>(S)) {
|
||||
if (!B->isAssignmentOp()) return; // Skip non-assignments.
|
||||
|
||||
if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(B->getLHS()))
|
||||
if (DeclRefExpr *DR = dyn_cast<DeclRefExpr>(B->getLHS()))
|
||||
if (VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {
|
||||
// Special case: check for assigning null to a pointer.
|
||||
// This is a common form of defensive programming.
|
||||
@@ -206,10 +206,10 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
Expr* RHS = B->getRHS()->IgnoreParenCasts();
|
||||
Expr *RHS = B->getRHS()->IgnoreParenCasts();
|
||||
// Special case: self-assignments. These are often used to shut up
|
||||
// "unused variable" compiler warnings.
|
||||
if (DeclRefExpr* RhsDR = dyn_cast<DeclRefExpr>(RHS))
|
||||
if (DeclRefExpr *RhsDR = dyn_cast<DeclRefExpr>(RHS))
|
||||
if (VD == dyn_cast<VarDecl>(RhsDR->getDecl()))
|
||||
return;
|
||||
|
||||
@@ -231,16 +231,16 @@ public:
|
||||
|
||||
const Expr *Ex = U->getSubExpr()->IgnoreParenCasts();
|
||||
|
||||
if (const DeclRefExpr* DR = dyn_cast<DeclRefExpr>(Ex))
|
||||
if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(Ex))
|
||||
CheckDeclRef(DR, U, DeadIncrement, Live);
|
||||
}
|
||||
else if (const DeclStmt* DS = dyn_cast<DeclStmt>(S))
|
||||
else if (const DeclStmt *DS = dyn_cast<DeclStmt>(S))
|
||||
// Iterate through the decls. Warn if any initializers are complex
|
||||
// expressions that are not live (never used).
|
||||
for (DeclStmt::const_decl_iterator DI=DS->decl_begin(), DE=DS->decl_end();
|
||||
DI != DE; ++DI) {
|
||||
|
||||
VarDecl* V = dyn_cast<VarDecl>(*DI);
|
||||
VarDecl *V = dyn_cast<VarDecl>(*DI);
|
||||
|
||||
if (!V)
|
||||
continue;
|
||||
@@ -251,7 +251,7 @@ public:
|
||||
if (V->getType()->getAs<ReferenceType>())
|
||||
return;
|
||||
|
||||
if (Expr* E = V->getInit()) {
|
||||
if (Expr *E = V->getInit()) {
|
||||
while (ExprWithCleanups *exprClean = dyn_cast<ExprWithCleanups>(E))
|
||||
E = exprClean->getSubExpr();
|
||||
|
||||
@@ -321,10 +321,10 @@ public:
|
||||
void VisitUnaryOperator(UnaryOperator* U) {
|
||||
// Check for '&'. Any VarDecl whose value has its address-taken we
|
||||
// treat as escaped.
|
||||
Expr* E = U->getSubExpr()->IgnoreParenCasts();
|
||||
Expr *E = U->getSubExpr()->IgnoreParenCasts();
|
||||
if (U->getOpcode() == UO_AddrOf)
|
||||
if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E))
|
||||
if (VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl())) {
|
||||
if (DeclRefExpr *DR = dyn_cast<DeclRefExpr>(E))
|
||||
if (VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {
|
||||
Escaped.insert(VD);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -505,8 +505,8 @@ void IteratorsChecker::checkPreStmt(const CXXOperatorCallExpr *OCE,
|
||||
// uninitialized ones as Undefined.
|
||||
void IteratorsChecker::checkPreStmt(const DeclStmt *DS,
|
||||
CheckerContext &C) const {
|
||||
const Decl* D = *DS->decl_begin();
|
||||
const VarDecl* VD = dyn_cast<VarDecl>(D);
|
||||
const Decl *D = *DS->decl_begin();
|
||||
const VarDecl *VD = dyn_cast<VarDecl>(D);
|
||||
// Only care about iterators.
|
||||
if (getTemplateKind(VD->getType()) != VectorIteratorKind)
|
||||
return;
|
||||
@@ -520,7 +520,7 @@ void IteratorsChecker::checkPreStmt(const DeclStmt *DS,
|
||||
state = state->set<IteratorState>(MR, RefState::getUndefined());
|
||||
|
||||
// if there is an initializer, handle marking Valid if a proper initializer
|
||||
const Expr* InitEx = VD->getInit();
|
||||
const Expr *InitEx = VD->getInit();
|
||||
if (InitEx) {
|
||||
// FIXME: This is too syntactic. Since 'InitEx' will be analyzed first
|
||||
// it should resolve to an SVal that we can check for validity
|
||||
|
||||
@@ -107,8 +107,8 @@ private:
|
||||
void ReallocMem(CheckerContext &C, const CallExpr *CE) const;
|
||||
static void CallocMem(CheckerContext &C, const CallExpr *CE);
|
||||
|
||||
static bool SummarizeValue(raw_ostream& os, SVal V);
|
||||
static bool SummarizeRegion(raw_ostream& os, const MemRegion *MR);
|
||||
static bool SummarizeValue(raw_ostream &os, SVal V);
|
||||
static bool SummarizeRegion(raw_ostream &os, const MemRegion *MR);
|
||||
void ReportBadFree(CheckerContext &C, SVal ArgVal, SourceRange range) const;
|
||||
};
|
||||
} // end anonymous namespace
|
||||
@@ -364,7 +364,7 @@ const GRState *MallocChecker::FreeMemAux(CheckerContext &C, const CallExpr *CE,
|
||||
return notNullState->set<RegionState>(Sym, RefState::getReleased(CE));
|
||||
}
|
||||
|
||||
bool MallocChecker::SummarizeValue(raw_ostream& os, SVal V) {
|
||||
bool MallocChecker::SummarizeValue(raw_ostream &os, SVal V) {
|
||||
if (nonloc::ConcreteInt *IntVal = dyn_cast<nonloc::ConcreteInt>(&V))
|
||||
os << "an integer (" << IntVal->getValue() << ")";
|
||||
else if (loc::ConcreteInt *ConstAddr = dyn_cast<loc::ConcreteInt>(&V))
|
||||
@@ -377,7 +377,7 @@ bool MallocChecker::SummarizeValue(raw_ostream& os, SVal V) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MallocChecker::SummarizeRegion(raw_ostream& os,
|
||||
bool MallocChecker::SummarizeRegion(raw_ostream &os,
|
||||
const MemRegion *MR) {
|
||||
switch (MR->getKind()) {
|
||||
case MemRegion::FunctionTextRegionKind: {
|
||||
|
||||
@@ -53,7 +53,7 @@ void NSAutoreleasePoolChecker::checkPreObjCMessage(ObjCMessage msg,
|
||||
|
||||
if (!PT)
|
||||
return;
|
||||
const ObjCInterfaceDecl* OD = PT->getInterfaceDecl();
|
||||
const ObjCInterfaceDecl *OD = PT->getInterfaceDecl();
|
||||
if (!OD)
|
||||
return;
|
||||
if (!OD->getIdentifier()->getName().equals("NSAutoreleasePool"))
|
||||
|
||||
@@ -37,7 +37,7 @@ bool OSAtomicChecker::evalCall(const CallExpr *CE, CheckerContext &C) const {
|
||||
const Expr *Callee = CE->getCallee();
|
||||
SVal L = state->getSVal(Callee);
|
||||
|
||||
const FunctionDecl* FD = L.getAsFunctionDecl();
|
||||
const FunctionDecl *FD = L.getAsFunctionDecl();
|
||||
if (!FD)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace clang {
|
||||
namespace ento {
|
||||
template<>
|
||||
struct GRStateTrait<SelfFlag> : public GRStatePartialTrait<SelfFlag> {
|
||||
static void* GDMIndex() { static int index = 0; return &index; }
|
||||
static void *GDMIndex() { static int index = 0; return &index; }
|
||||
};
|
||||
template <>
|
||||
struct GRStateTrait<CalledInit> : public GRStatePartialTrait<bool> {
|
||||
@@ -315,9 +315,9 @@ static bool shouldRunOnFunctionOrMethod(const NamedDecl *ND) {
|
||||
|
||||
// self = [super init] applies only to NSObject subclasses.
|
||||
// For instance, NSProxy doesn't implement -init.
|
||||
ASTContext& Ctx = MD->getASTContext();
|
||||
ASTContext &Ctx = MD->getASTContext();
|
||||
IdentifierInfo* NSObjectII = &Ctx.Idents.get("NSObject");
|
||||
ObjCInterfaceDecl* ID = MD->getClassInterface()->getSuperClass();
|
||||
ObjCInterfaceDecl *ID = MD->getClassInterface()->getSuperClass();
|
||||
for ( ; ID ; ID = ID->getSuperClass()) {
|
||||
IdentifierInfo *II = ID->getIdentifier();
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ using namespace ento;
|
||||
enum IVarState { Unused, Used };
|
||||
typedef llvm::DenseMap<const ObjCIvarDecl*,IVarState> IvarUsageMap;
|
||||
|
||||
static void Scan(IvarUsageMap& M, const Stmt* S) {
|
||||
static void Scan(IvarUsageMap& M, const Stmt *S) {
|
||||
if (!S)
|
||||
return;
|
||||
|
||||
@@ -51,11 +51,11 @@ static void Scan(IvarUsageMap& M, const Stmt* S) {
|
||||
Scan(M, *I);
|
||||
}
|
||||
|
||||
static void Scan(IvarUsageMap& M, const ObjCPropertyImplDecl* D) {
|
||||
static void Scan(IvarUsageMap& M, const ObjCPropertyImplDecl *D) {
|
||||
if (!D)
|
||||
return;
|
||||
|
||||
const ObjCIvarDecl* ID = D->getPropertyIvarDecl();
|
||||
const ObjCIvarDecl *ID = D->getPropertyIvarDecl();
|
||||
|
||||
if (!ID)
|
||||
return;
|
||||
@@ -65,7 +65,7 @@ static void Scan(IvarUsageMap& M, const ObjCPropertyImplDecl* D) {
|
||||
I->second = Used;
|
||||
}
|
||||
|
||||
static void Scan(IvarUsageMap& M, const ObjCContainerDecl* D) {
|
||||
static void Scan(IvarUsageMap& M, const ObjCContainerDecl *D) {
|
||||
// Scan the methods for accesses.
|
||||
for (ObjCContainerDecl::instmeth_iterator I = D->instmeth_begin(),
|
||||
E = D->instmeth_end(); I!=E; ++I)
|
||||
@@ -102,14 +102,14 @@ static void Scan(IvarUsageMap &M, const DeclContext *C, const FileID FID,
|
||||
static void checkObjCUnusedIvar(const ObjCImplementationDecl *D,
|
||||
BugReporter &BR) {
|
||||
|
||||
const ObjCInterfaceDecl* ID = D->getClassInterface();
|
||||
const ObjCInterfaceDecl *ID = D->getClassInterface();
|
||||
IvarUsageMap M;
|
||||
|
||||
// Iterate over the ivars.
|
||||
for (ObjCInterfaceDecl::ivar_iterator I=ID->ivar_begin(),
|
||||
E=ID->ivar_end(); I!=E; ++I) {
|
||||
|
||||
const ObjCIvarDecl* ID = *I;
|
||||
const ObjCIvarDecl *ID = *I;
|
||||
|
||||
// Ignore ivars that...
|
||||
// (a) aren't private
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace clang {
|
||||
namespace ento {
|
||||
template <> struct GRStateTrait<LockSet> :
|
||||
public GRStatePartialTrait<llvm::ImmutableList<const MemRegion*> > {
|
||||
static void* GDMIndex() { static int x = 0; return &x; }
|
||||
static void *GDMIndex() { static int x = 0; return &x; }
|
||||
};
|
||||
} // end GR namespace
|
||||
} // end clang namespace
|
||||
|
||||
@@ -50,7 +50,7 @@ SourceRange StackAddrEscapeChecker::GenName(raw_ostream &os,
|
||||
|
||||
// Check if the region is a compound literal.
|
||||
if (const CompoundLiteralRegion* CR = dyn_cast<CompoundLiteralRegion>(R)) {
|
||||
const CompoundLiteralExpr* CL = CR->getLiteralExpr();
|
||||
const CompoundLiteralExpr *CL = CR->getLiteralExpr();
|
||||
os << "stack memory associated with a compound literal "
|
||||
"declared on line "
|
||||
<< SM.getExpansionLineNumber(CL->getLocStart())
|
||||
@@ -58,7 +58,7 @@ SourceRange StackAddrEscapeChecker::GenName(raw_ostream &os,
|
||||
range = CL->getSourceRange();
|
||||
}
|
||||
else if (const AllocaRegion* AR = dyn_cast<AllocaRegion>(R)) {
|
||||
const Expr* ARE = AR->getExpr();
|
||||
const Expr *ARE = AR->getExpr();
|
||||
SourceLocation L = ARE->getLocStart();
|
||||
range = ARE->getSourceRange();
|
||||
os << "stack memory allocated by call to alloca() on line "
|
||||
|
||||
@@ -28,25 +28,25 @@ class UndefBranchChecker : public Checker<check::BranchCondition> {
|
||||
|
||||
struct FindUndefExpr {
|
||||
GRStateManager& VM;
|
||||
const GRState* St;
|
||||
const GRState *St;
|
||||
|
||||
FindUndefExpr(GRStateManager& V, const GRState* S) : VM(V), St(S) {}
|
||||
FindUndefExpr(GRStateManager& V, const GRState *S) : VM(V), St(S) {}
|
||||
|
||||
const Expr* FindExpr(const Expr* Ex) {
|
||||
const Expr *FindExpr(const Expr *Ex) {
|
||||
if (!MatchesCriteria(Ex))
|
||||
return 0;
|
||||
|
||||
for (Stmt::const_child_iterator I = Ex->child_begin(),
|
||||
E = Ex->child_end();I!=E;++I)
|
||||
if (const Expr* ExI = dyn_cast_or_null<Expr>(*I)) {
|
||||
const Expr* E2 = FindExpr(ExI);
|
||||
if (const Expr *ExI = dyn_cast_or_null<Expr>(*I)) {
|
||||
const Expr *E2 = FindExpr(ExI);
|
||||
if (E2) return E2;
|
||||
}
|
||||
|
||||
return Ex;
|
||||
}
|
||||
|
||||
bool MatchesCriteria(const Expr* Ex) { return St->getSVal(Ex).isUndef(); }
|
||||
bool MatchesCriteria(const Expr *Ex) { return St->getSVal(Ex).isUndef(); }
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -75,7 +75,7 @@ void UndefBranchChecker::checkBranchCondition(const Stmt *Condition,
|
||||
// subexpressions and roughly look for the most nested subexpression
|
||||
// that binds to Undefined. We then highlight that expression's range.
|
||||
BlockEdge B = cast<BlockEdge>(N->getLocation());
|
||||
const Expr* Ex = cast<Expr>(B.getSrc()->getTerminatorCondition());
|
||||
const Expr *Ex = cast<Expr>(B.getSrc()->getTerminatorCondition());
|
||||
assert (Ex && "Block must have a terminator.");
|
||||
|
||||
// Get the predecessor node and check if is a PostStmt with the Stmt
|
||||
@@ -89,9 +89,9 @@ void UndefBranchChecker::checkBranchCondition(const Stmt *Condition,
|
||||
// had to already be undefined.
|
||||
ExplodedNode *PrevN = *N->pred_begin();
|
||||
ProgramPoint P = PrevN->getLocation();
|
||||
const GRState* St = N->getState();
|
||||
const GRState *St = N->getState();
|
||||
|
||||
if (PostStmt* PS = dyn_cast<PostStmt>(&P))
|
||||
if (PostStmt *PS = dyn_cast<PostStmt>(&P))
|
||||
if (PS->getStmt() == Ex)
|
||||
St = PrevN->getState();
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ void UndefinedAssignmentChecker::checkBind(SVal location, SVal val,
|
||||
}
|
||||
|
||||
if (const DeclStmt *DS = dyn_cast<DeclStmt>(StoreE)) {
|
||||
const VarDecl* VD = dyn_cast<VarDecl>(DS->getSingleDecl());
|
||||
const VarDecl *VD = dyn_cast<VarDecl>(DS->getSingleDecl());
|
||||
ex = VD->getInit();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ void VLASizeChecker::checkPreStmt(const DeclStmt *DS, CheckerContext &C) const {
|
||||
return;
|
||||
|
||||
// FIXME: Handle multi-dimensional VLAs.
|
||||
const Expr* SE = VLA->getSizeExpr();
|
||||
const Expr *SE = VLA->getSizeExpr();
|
||||
const GRState *state = C.getState();
|
||||
SVal sizeV = state->getSVal(SE);
|
||||
|
||||
@@ -82,7 +82,7 @@ void VLASizeChecker::checkPreStmt(const DeclStmt *DS, CheckerContext &C) const {
|
||||
llvm::tie(stateNotZero, stateZero) = state->assume(sizeD);
|
||||
|
||||
if (stateZero && !stateNotZero) {
|
||||
ExplodedNode* N = C.generateSink(stateZero);
|
||||
ExplodedNode *N = C.generateSink(stateZero);
|
||||
if (!BT_zero)
|
||||
BT_zero.reset(new BuiltinBug("Declared variable-length array (VLA) has "
|
||||
"zero size"));
|
||||
|
||||
@@ -35,12 +35,12 @@ namespace clang {
|
||||
namespace ento {
|
||||
template<>
|
||||
struct GRStateTrait<ConstNotEq> : public GRStatePartialTrait<ConstNotEqTy> {
|
||||
static inline void* GDMIndex() { return &ConstNotEqIndex; }
|
||||
static inline void *GDMIndex() { return &ConstNotEqIndex; }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct GRStateTrait<ConstEq> : public GRStatePartialTrait<ConstEqTy> {
|
||||
static inline void* GDMIndex() { return &ConstEqIndex; }
|
||||
static inline void *GDMIndex() { return &ConstEqIndex; }
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -56,43 +56,43 @@ public:
|
||||
: SimpleConstraintManager(subengine),
|
||||
ISetFactory(statemgr.getAllocator()) {}
|
||||
|
||||
const GRState *assumeSymNE(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymNE(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& V,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const GRState *assumeSymEQ(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymEQ(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& V,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const GRState *assumeSymLT(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymLT(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& V,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const GRState *assumeSymGT(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymGT(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& V,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const GRState *assumeSymGE(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymGE(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& V,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const GRState *assumeSymLE(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymLE(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& V,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const GRState* AddEQ(const GRState* state, SymbolRef sym, const llvm::APSInt& V);
|
||||
const GRState *AddEQ(const GRState *state, SymbolRef sym, const llvm::APSInt& V);
|
||||
|
||||
const GRState* AddNE(const GRState* state, SymbolRef sym, const llvm::APSInt& V);
|
||||
const GRState *AddNE(const GRState *state, SymbolRef sym, const llvm::APSInt& V);
|
||||
|
||||
const llvm::APSInt* getSymVal(const GRState* state, SymbolRef sym) const;
|
||||
bool isNotEqual(const GRState* state, SymbolRef sym, const llvm::APSInt& V)
|
||||
const llvm::APSInt* getSymVal(const GRState *state, SymbolRef sym) const;
|
||||
bool isNotEqual(const GRState *state, SymbolRef sym, const llvm::APSInt& V)
|
||||
const;
|
||||
bool isEqual(const GRState* state, SymbolRef sym, const llvm::APSInt& V)
|
||||
bool isEqual(const GRState *state, SymbolRef sym, const llvm::APSInt& V)
|
||||
const;
|
||||
|
||||
const GRState* removeDeadBindings(const GRState* state, SymbolReaper& SymReaper);
|
||||
const GRState *removeDeadBindings(const GRState *state, SymbolReaper& SymReaper);
|
||||
|
||||
void print(const GRState* state, raw_ostream& Out,
|
||||
void print(const GRState *state, raw_ostream &Out,
|
||||
const char* nl, const char *sep);
|
||||
};
|
||||
|
||||
@@ -229,13 +229,13 @@ BasicConstraintManager::assumeSymLE(const GRState *state, SymbolRef sym,
|
||||
return state;
|
||||
}
|
||||
|
||||
const GRState* BasicConstraintManager::AddEQ(const GRState* state, SymbolRef sym,
|
||||
const GRState *BasicConstraintManager::AddEQ(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& V) {
|
||||
// Create a new state with the old binding replaced.
|
||||
return state->set<ConstEq>(sym, &state->getBasicVals().getValue(V));
|
||||
}
|
||||
|
||||
const GRState* BasicConstraintManager::AddNE(const GRState* state, SymbolRef sym,
|
||||
const GRState *BasicConstraintManager::AddNE(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& V) {
|
||||
|
||||
// First, retrieve the NE-set associated with the given symbol.
|
||||
@@ -249,13 +249,13 @@ const GRState* BasicConstraintManager::AddNE(const GRState* state, SymbolRef sym
|
||||
return state->set<ConstNotEq>(sym, S);
|
||||
}
|
||||
|
||||
const llvm::APSInt* BasicConstraintManager::getSymVal(const GRState* state,
|
||||
const llvm::APSInt* BasicConstraintManager::getSymVal(const GRState *state,
|
||||
SymbolRef sym) const {
|
||||
const ConstEqTy::data_type* T = state->get<ConstEq>(sym);
|
||||
return T ? *T : NULL;
|
||||
}
|
||||
|
||||
bool BasicConstraintManager::isNotEqual(const GRState* state, SymbolRef sym,
|
||||
bool BasicConstraintManager::isNotEqual(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& V) const {
|
||||
|
||||
// Retrieve the NE-set associated with the given symbol.
|
||||
@@ -265,7 +265,7 @@ bool BasicConstraintManager::isNotEqual(const GRState* state, SymbolRef sym,
|
||||
return T ? T->contains(&state->getBasicVals().getValue(V)) : false;
|
||||
}
|
||||
|
||||
bool BasicConstraintManager::isEqual(const GRState* state, SymbolRef sym,
|
||||
bool BasicConstraintManager::isEqual(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& V) const {
|
||||
// Retrieve the EQ-set associated with the given symbol.
|
||||
const ConstEqTy::data_type* T = state->get<ConstEq>(sym);
|
||||
@@ -276,7 +276,7 @@ bool BasicConstraintManager::isEqual(const GRState* state, SymbolRef sym,
|
||||
/// Scan all symbols referenced by the constraints. If the symbol is not alive
|
||||
/// as marked in LSymbols, mark it as dead in DSymbols.
|
||||
const GRState*
|
||||
BasicConstraintManager::removeDeadBindings(const GRState* state,
|
||||
BasicConstraintManager::removeDeadBindings(const GRState *state,
|
||||
SymbolReaper& SymReaper) {
|
||||
|
||||
ConstEqTy CE = state->get<ConstEq>();
|
||||
@@ -301,7 +301,7 @@ BasicConstraintManager::removeDeadBindings(const GRState* state,
|
||||
return state->set<ConstNotEq>(CNE);
|
||||
}
|
||||
|
||||
void BasicConstraintManager::print(const GRState* state, raw_ostream& Out,
|
||||
void BasicConstraintManager::print(const GRState *state, raw_ostream &Out,
|
||||
const char* nl, const char *sep) {
|
||||
// Print equality constraints.
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ BasicValueFactory::~BasicValueFactory() {
|
||||
|
||||
const llvm::APSInt& BasicValueFactory::getValue(const llvm::APSInt& X) {
|
||||
llvm::FoldingSetNodeID ID;
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
typedef llvm::FoldingSetNodeWrapper<llvm::APSInt> FoldNodeTy;
|
||||
|
||||
X.Profile(ID);
|
||||
@@ -113,7 +113,7 @@ BasicValueFactory::getCompoundValData(QualType T,
|
||||
|
||||
llvm::FoldingSetNodeID ID;
|
||||
CompoundValData::Profile(ID, T, Vals);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
|
||||
CompoundValData* D = CompoundValDataSet.FindNodeOrInsertPos(ID, InsertPos);
|
||||
|
||||
@@ -131,7 +131,7 @@ BasicValueFactory::getLazyCompoundValData(const StoreRef &store,
|
||||
const TypedValueRegion *region) {
|
||||
llvm::FoldingSetNodeID ID;
|
||||
LazyCompoundValData::Profile(ID, store, region);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
|
||||
LazyCompoundValData *D =
|
||||
LazyCompoundValDataSet.FindNodeOrInsertPos(ID, InsertPos);
|
||||
@@ -243,7 +243,7 @@ BasicValueFactory::getPersistentSValWithData(const SVal& V, uintptr_t Data) {
|
||||
if (!PersistentSVals) PersistentSVals = new PersistentSValsTy();
|
||||
|
||||
llvm::FoldingSetNodeID ID;
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
V.Profile(ID);
|
||||
ID.AddPointer((void*) Data);
|
||||
|
||||
@@ -268,7 +268,7 @@ BasicValueFactory::getPersistentSValPair(const SVal& V1, const SVal& V2) {
|
||||
if (!PersistentSValPairs) PersistentSValPairs = new PersistentSValPairsTy();
|
||||
|
||||
llvm::FoldingSetNodeID ID;
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
V1.Profile(ID);
|
||||
V2.Profile(ID);
|
||||
|
||||
|
||||
@@ -48,11 +48,11 @@ public:
|
||||
|
||||
typedef llvm::ImmutableMap<CountKey, unsigned> CountMap;
|
||||
|
||||
static inline CountMap GetMap(void* D) {
|
||||
static inline CountMap GetMap(void *D) {
|
||||
return CountMap(static_cast<CountMap::TreeTy*>(D));
|
||||
}
|
||||
|
||||
static inline CountMap::Factory& GetFactory(void* F) {
|
||||
static inline CountMap::Factory& GetFactory(void *F) {
|
||||
return *static_cast<CountMap::Factory*>(F);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,26 +59,26 @@ void BugReporterContext::addVisitor(BugReporterVisitor* visitor) {
|
||||
// Helper routines for walking the ExplodedGraph and fetching statements.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static inline const Stmt* GetStmt(const ProgramPoint &P) {
|
||||
static inline const Stmt *GetStmt(const ProgramPoint &P) {
|
||||
if (const StmtPoint* SP = dyn_cast<StmtPoint>(&P))
|
||||
return SP->getStmt();
|
||||
else if (const BlockEdge* BE = dyn_cast<BlockEdge>(&P))
|
||||
else if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P))
|
||||
return BE->getSrc()->getTerminator();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline const ExplodedNode*
|
||||
GetPredecessorNode(const ExplodedNode* N) {
|
||||
GetPredecessorNode(const ExplodedNode *N) {
|
||||
return N->pred_empty() ? NULL : *(N->pred_begin());
|
||||
}
|
||||
|
||||
static inline const ExplodedNode*
|
||||
GetSuccessorNode(const ExplodedNode* N) {
|
||||
GetSuccessorNode(const ExplodedNode *N) {
|
||||
return N->succ_empty() ? NULL : *(N->succ_begin());
|
||||
}
|
||||
|
||||
static const Stmt* GetPreviousStmt(const ExplodedNode* N) {
|
||||
static const Stmt *GetPreviousStmt(const ExplodedNode *N) {
|
||||
for (N = GetPredecessorNode(N); N; N = GetPredecessorNode(N))
|
||||
if (const Stmt *S = GetStmt(N->getLocation()))
|
||||
return S;
|
||||
@@ -86,7 +86,7 @@ static const Stmt* GetPreviousStmt(const ExplodedNode* N) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const Stmt* GetNextStmt(const ExplodedNode* N) {
|
||||
static const Stmt *GetNextStmt(const ExplodedNode *N) {
|
||||
for (N = GetSuccessorNode(N); N; N = GetSuccessorNode(N))
|
||||
if (const Stmt *S = GetStmt(N->getLocation())) {
|
||||
// Check if the statement is '?' or '&&'/'||'. These are "merges",
|
||||
@@ -116,7 +116,7 @@ static const Stmt* GetNextStmt(const ExplodedNode* N) {
|
||||
}
|
||||
|
||||
static inline const Stmt*
|
||||
GetCurrentOrPreviousStmt(const ExplodedNode* N) {
|
||||
GetCurrentOrPreviousStmt(const ExplodedNode *N) {
|
||||
if (const Stmt *S = GetStmt(N->getLocation()))
|
||||
return S;
|
||||
|
||||
@@ -124,7 +124,7 @@ GetCurrentOrPreviousStmt(const ExplodedNode* N) {
|
||||
}
|
||||
|
||||
static inline const Stmt*
|
||||
GetCurrentOrNextStmt(const ExplodedNode* N) {
|
||||
GetCurrentOrNextStmt(const ExplodedNode *N) {
|
||||
if (const Stmt *S = GetStmt(N->getLocation()))
|
||||
return S;
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
NodeMapClosure(NodeBackMap *m) : M(*m) {}
|
||||
~NodeMapClosure() {}
|
||||
|
||||
const ExplodedNode* getOriginalNode(const ExplodedNode* N) {
|
||||
const ExplodedNode *getOriginalNode(const ExplodedNode *N) {
|
||||
NodeBackMap::iterator I = M.find(N);
|
||||
return I == M.end() ? 0 : I->second;
|
||||
}
|
||||
@@ -165,10 +165,10 @@ public:
|
||||
addVisitor(R);
|
||||
}
|
||||
|
||||
PathDiagnosticLocation ExecutionContinues(const ExplodedNode* N);
|
||||
PathDiagnosticLocation ExecutionContinues(const ExplodedNode *N);
|
||||
|
||||
PathDiagnosticLocation ExecutionContinues(llvm::raw_string_ostream& os,
|
||||
const ExplodedNode* N);
|
||||
PathDiagnosticLocation ExecutionContinues(llvm::raw_string_ostream &os,
|
||||
const ExplodedNode *N);
|
||||
|
||||
Decl const &getCodeDecl() { return R->getErrorNode()->getCodeDecl(); }
|
||||
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
} // end anonymous namespace
|
||||
|
||||
PathDiagnosticLocation
|
||||
PathDiagnosticBuilder::ExecutionContinues(const ExplodedNode* N) {
|
||||
PathDiagnosticBuilder::ExecutionContinues(const ExplodedNode *N) {
|
||||
if (const Stmt *S = GetNextStmt(N))
|
||||
return PathDiagnosticLocation(S, getSourceManager());
|
||||
|
||||
@@ -202,8 +202,8 @@ PathDiagnosticBuilder::ExecutionContinues(const ExplodedNode* N) {
|
||||
}
|
||||
|
||||
PathDiagnosticLocation
|
||||
PathDiagnosticBuilder::ExecutionContinues(llvm::raw_string_ostream& os,
|
||||
const ExplodedNode* N) {
|
||||
PathDiagnosticBuilder::ExecutionContinues(llvm::raw_string_ostream &os,
|
||||
const ExplodedNode *N) {
|
||||
|
||||
// Slow, but probably doesn't matter.
|
||||
if (os.str().empty())
|
||||
@@ -253,7 +253,7 @@ static bool IsNested(const Stmt *S, ParentMap &PM) {
|
||||
|
||||
PathDiagnosticLocation
|
||||
PathDiagnosticBuilder::getEnclosingStmtLocation(const Stmt *S) {
|
||||
assert(S && "Null Stmt* passed to getEnclosingStmtLocation");
|
||||
assert(S && "Null Stmt *passed to getEnclosingStmtLocation");
|
||||
ParentMap &P = getParentMap();
|
||||
SourceManager &SMgr = getSourceManager();
|
||||
|
||||
@@ -347,7 +347,7 @@ PathDiagnosticBuilder::getEnclosingStmtLocation(const Stmt *S) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static const VarDecl*
|
||||
GetMostRecentVarDeclBinding(const ExplodedNode* N,
|
||||
GetMostRecentVarDeclBinding(const ExplodedNode *N,
|
||||
GRStateManager& VMgr, SVal X) {
|
||||
|
||||
for ( ; N ; N = N->pred_empty() ? 0 : *N->pred_begin()) {
|
||||
@@ -357,7 +357,7 @@ GetMostRecentVarDeclBinding(const ExplodedNode* N,
|
||||
if (!isa<PostStmt>(P))
|
||||
continue;
|
||||
|
||||
const DeclRefExpr* DR = dyn_cast<DeclRefExpr>(cast<PostStmt>(P).getStmt());
|
||||
const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(cast<PostStmt>(P).getStmt());
|
||||
|
||||
if (!DR)
|
||||
continue;
|
||||
@@ -367,7 +367,7 @@ GetMostRecentVarDeclBinding(const ExplodedNode* N,
|
||||
if (X != Y)
|
||||
continue;
|
||||
|
||||
const VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl());
|
||||
const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl());
|
||||
|
||||
if (!VD)
|
||||
continue;
|
||||
@@ -383,17 +383,17 @@ class NotableSymbolHandler
|
||||
: public StoreManager::BindingsHandler {
|
||||
|
||||
SymbolRef Sym;
|
||||
const GRState* PrevSt;
|
||||
const Stmt* S;
|
||||
const GRState *PrevSt;
|
||||
const Stmt *S;
|
||||
GRStateManager& VMgr;
|
||||
const ExplodedNode* Pred;
|
||||
const ExplodedNode *Pred;
|
||||
PathDiagnostic& PD;
|
||||
BugReporter& BR;
|
||||
|
||||
public:
|
||||
|
||||
NotableSymbolHandler(SymbolRef sym, const GRState* prevst, const Stmt* s,
|
||||
GRStateManager& vmgr, const ExplodedNode* pred,
|
||||
NotableSymbolHandler(SymbolRef sym, const GRState *prevst, const Stmt *s,
|
||||
GRStateManager& vmgr, const ExplodedNode *pred,
|
||||
PathDiagnostic& pd, BugReporter& br)
|
||||
: Sym(sym), PrevSt(prevst), S(s), VMgr(vmgr), Pred(pred), PD(pd), BR(br) {}
|
||||
|
||||
@@ -422,14 +422,14 @@ public:
|
||||
return true;
|
||||
|
||||
// What variable did we assign to?
|
||||
DeclRefExpr* DR = dyn_cast<DeclRefExpr>(B->getLHS()->IgnoreParenCasts());
|
||||
DeclRefExpr *DR = dyn_cast<DeclRefExpr>(B->getLHS()->IgnoreParenCasts());
|
||||
|
||||
if (!DR)
|
||||
return true;
|
||||
|
||||
VD = dyn_cast<VarDecl>(DR->getDecl());
|
||||
}
|
||||
else if (const DeclStmt* DS = dyn_cast<DeclStmt>(S)) {
|
||||
else if (const DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
|
||||
// FIXME: Eventually CFGs won't have DeclStmts. Right now we
|
||||
// assume that each DeclStmt has a single Decl. This invariant
|
||||
// holds by construction in the CFG.
|
||||
@@ -440,7 +440,7 @@ public:
|
||||
return true;
|
||||
|
||||
// What is the most recently referenced variable with this binding?
|
||||
const VarDecl* MostRecent = GetMostRecentVarDeclBinding(Pred, VMgr, V);
|
||||
const VarDecl *MostRecent = GetMostRecentVarDeclBinding(Pred, VMgr, V);
|
||||
|
||||
if (!MostRecent)
|
||||
return true;
|
||||
@@ -460,13 +460,13 @@ public:
|
||||
};
|
||||
}
|
||||
|
||||
static void HandleNotableSymbol(const ExplodedNode* N,
|
||||
const Stmt* S,
|
||||
static void HandleNotableSymbol(const ExplodedNode *N,
|
||||
const Stmt *S,
|
||||
SymbolRef Sym, BugReporter& BR,
|
||||
PathDiagnostic& PD) {
|
||||
|
||||
const ExplodedNode* Pred = N->pred_empty() ? 0 : *N->pred_begin();
|
||||
const GRState* PrevSt = Pred ? Pred->getState() : 0;
|
||||
const ExplodedNode *Pred = N->pred_empty() ? 0 : *N->pred_begin();
|
||||
const GRState *PrevSt = Pred ? Pred->getState() : 0;
|
||||
|
||||
if (!PrevSt)
|
||||
return;
|
||||
@@ -483,13 +483,13 @@ class ScanNotableSymbols
|
||||
: public StoreManager::BindingsHandler {
|
||||
|
||||
llvm::SmallSet<SymbolRef, 10> AlreadyProcessed;
|
||||
const ExplodedNode* N;
|
||||
const Stmt* S;
|
||||
const ExplodedNode *N;
|
||||
const Stmt *S;
|
||||
GRBugReporter& BR;
|
||||
PathDiagnostic& PD;
|
||||
|
||||
public:
|
||||
ScanNotableSymbols(const ExplodedNode* n, const Stmt* s,
|
||||
ScanNotableSymbols(const ExplodedNode *n, const Stmt *s,
|
||||
GRBugReporter& br, PathDiagnostic& pd)
|
||||
: N(n), S(s), BR(br), PD(pd) {}
|
||||
|
||||
@@ -526,7 +526,7 @@ static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
|
||||
const ExplodedNode *N) {
|
||||
|
||||
SourceManager& SMgr = PDB.getSourceManager();
|
||||
const ExplodedNode* NextNode = N->pred_empty()
|
||||
const ExplodedNode *NextNode = N->pred_empty()
|
||||
? NULL : *(N->pred_begin());
|
||||
while (NextNode) {
|
||||
N = NextNode;
|
||||
@@ -534,10 +534,10 @@ static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
|
||||
|
||||
ProgramPoint P = N->getLocation();
|
||||
|
||||
if (const BlockEdge* BE = dyn_cast<BlockEdge>(&P)) {
|
||||
const CFGBlock* Src = BE->getSrc();
|
||||
const CFGBlock* Dst = BE->getDst();
|
||||
const Stmt* T = Src->getTerminator();
|
||||
if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) {
|
||||
const CFGBlock *Src = BE->getSrc();
|
||||
const CFGBlock *Dst = BE->getDst();
|
||||
const Stmt *T = Src->getTerminator();
|
||||
|
||||
if (!T)
|
||||
continue;
|
||||
@@ -550,7 +550,7 @@ static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
|
||||
|
||||
case Stmt::GotoStmtClass:
|
||||
case Stmt::IndirectGotoStmtClass: {
|
||||
const Stmt* S = GetNextStmt(N);
|
||||
const Stmt *S = GetNextStmt(N);
|
||||
|
||||
if (!S)
|
||||
continue;
|
||||
@@ -571,7 +571,7 @@ static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
|
||||
std::string sbuf;
|
||||
llvm::raw_string_ostream os(sbuf);
|
||||
|
||||
if (const Stmt* S = Dst->getLabel()) {
|
||||
if (const Stmt *S = Dst->getLabel()) {
|
||||
PathDiagnosticLocation End(S, SMgr);
|
||||
|
||||
switch (S->getStmtClass()) {
|
||||
@@ -587,16 +587,16 @@ static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
|
||||
|
||||
case Stmt::CaseStmtClass: {
|
||||
os << "Control jumps to 'case ";
|
||||
const CaseStmt* Case = cast<CaseStmt>(S);
|
||||
const Expr* LHS = Case->getLHS()->IgnoreParenCasts();
|
||||
const CaseStmt *Case = cast<CaseStmt>(S);
|
||||
const Expr *LHS = Case->getLHS()->IgnoreParenCasts();
|
||||
|
||||
// Determine if it is an enum.
|
||||
bool GetRawInt = true;
|
||||
|
||||
if (const DeclRefExpr* DR = dyn_cast<DeclRefExpr>(LHS)) {
|
||||
if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(LHS)) {
|
||||
// FIXME: Maybe this should be an assertion. Are there cases
|
||||
// were it is not an EnumConstantDecl?
|
||||
const EnumConstantDecl* D =
|
||||
const EnumConstantDecl *D =
|
||||
dyn_cast<EnumConstantDecl>(DR->getDecl());
|
||||
|
||||
if (D) {
|
||||
@@ -783,12 +783,12 @@ static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
|
||||
if (NextNode) {
|
||||
for (BugReporterContext::visitor_iterator I = PDB.visitor_begin(),
|
||||
E = PDB.visitor_end(); I!=E; ++I) {
|
||||
if (PathDiagnosticPiece* p = (*I)->VisitNode(N, NextNode, PDB))
|
||||
if (PathDiagnosticPiece *p = (*I)->VisitNode(N, NextNode, PDB))
|
||||
PD.push_front(p);
|
||||
}
|
||||
}
|
||||
|
||||
if (const PostStmt* PS = dyn_cast<PostStmt>(&P)) {
|
||||
if (const PostStmt *PS = dyn_cast<PostStmt>(&P)) {
|
||||
// Scan the region bindings, and see if a "notable" symbol has a new
|
||||
// lval binding.
|
||||
ScanNotableSymbols SNS(N, PS->getStmt(), PDB.getBugReporter(), PD);
|
||||
@@ -1125,7 +1125,7 @@ static void GenerateExtensivePathDiagnostic(PathDiagnostic& PD,
|
||||
const ExplodedNode *N) {
|
||||
EdgeBuilder EB(PD, PDB);
|
||||
|
||||
const ExplodedNode* NextNode = N->pred_empty() ? NULL : *(N->pred_begin());
|
||||
const ExplodedNode *NextNode = N->pred_empty() ? NULL : *(N->pred_begin());
|
||||
while (NextNode) {
|
||||
N = NextNode;
|
||||
NextNode = GetPredecessorNode(N);
|
||||
@@ -1190,7 +1190,7 @@ static void GenerateExtensivePathDiagnostic(PathDiagnostic& PD,
|
||||
|
||||
for (BugReporterContext::visitor_iterator I = PDB.visitor_begin(),
|
||||
E = PDB.visitor_end(); I!=E; ++I) {
|
||||
if (PathDiagnosticPiece* p = (*I)->VisitNode(N, NextNode, PDB)) {
|
||||
if (PathDiagnosticPiece *p = (*I)->VisitNode(N, NextNode, PDB)) {
|
||||
const PathDiagnosticLocation &Loc = p->getLocation();
|
||||
EB.addEdge(Loc, true);
|
||||
PD.push_front(p);
|
||||
@@ -1214,11 +1214,11 @@ void BugType::FlushReports(BugReporter &BR) {}
|
||||
BugReport::~BugReport() {}
|
||||
RangedBugReport::~RangedBugReport() {}
|
||||
|
||||
const Stmt* BugReport::getStmt() const {
|
||||
const Stmt *BugReport::getStmt() const {
|
||||
ProgramPoint ProgP = ErrorNode->getLocation();
|
||||
const Stmt *S = NULL;
|
||||
|
||||
if (BlockEntrance* BE = dyn_cast<BlockEntrance>(&ProgP)) {
|
||||
if (BlockEntrance *BE = dyn_cast<BlockEntrance>(&ProgP)) {
|
||||
CFGBlock &Exit = ProgP.getLocationContext()->getCFG()->getExit();
|
||||
if (BE->getBlock() == &Exit)
|
||||
S = GetPreviousStmt(ErrorNode);
|
||||
@@ -1230,8 +1230,8 @@ const Stmt* BugReport::getStmt() const {
|
||||
}
|
||||
|
||||
PathDiagnosticPiece*
|
||||
BugReport::getEndPath(BugReporterContext& BRC,
|
||||
const ExplodedNode* EndPathNode) {
|
||||
BugReport::getEndPath(BugReporterContext &BRC,
|
||||
const ExplodedNode *EndPathNode) {
|
||||
|
||||
const ProgramPoint &PP = EndPathNode->getLocation();
|
||||
PathDiagnosticLocation L;
|
||||
@@ -1246,7 +1246,7 @@ BugReport::getEndPath(BugReporterContext& BRC,
|
||||
}
|
||||
|
||||
if (!L.isValid()) {
|
||||
const Stmt* S = getStmt();
|
||||
const Stmt *S = getStmt();
|
||||
|
||||
if (!S)
|
||||
return NULL;
|
||||
@@ -1259,7 +1259,7 @@ BugReport::getEndPath(BugReporterContext& BRC,
|
||||
|
||||
// Only add the statement itself as a range if we didn't specify any
|
||||
// special ranges for this report.
|
||||
PathDiagnosticPiece* P = new PathDiagnosticEventPiece(L, getDescription(),
|
||||
PathDiagnosticPiece *P = new PathDiagnosticEventPiece(L, getDescription(),
|
||||
Beg == End);
|
||||
|
||||
for (; Beg != End; ++Beg)
|
||||
@@ -1270,7 +1270,7 @@ BugReport::getEndPath(BugReporterContext& BRC,
|
||||
|
||||
std::pair<BugReport::ranges_iterator, BugReport::ranges_iterator>
|
||||
BugReport::getRanges() const {
|
||||
if (const Expr* E = dyn_cast_or_null<Expr>(getStmt())) {
|
||||
if (const Expr *E = dyn_cast_or_null<Expr>(getStmt())) {
|
||||
R = E->getSourceRange();
|
||||
assert(R.isValid());
|
||||
return std::make_pair(&R, &R+1);
|
||||
@@ -1281,7 +1281,7 @@ BugReport::getRanges() const {
|
||||
|
||||
SourceLocation BugReport::getLocation() const {
|
||||
if (ErrorNode)
|
||||
if (const Stmt* S = GetCurrentOrPreviousStmt(ErrorNode)) {
|
||||
if (const Stmt *S = GetCurrentOrPreviousStmt(ErrorNode)) {
|
||||
// For member expressions, return the location of the '.' or '->'.
|
||||
if (const MemberExpr *ME = dyn_cast<MemberExpr>(S))
|
||||
return ME->getMemberLoc();
|
||||
@@ -1295,8 +1295,8 @@ SourceLocation BugReport::getLocation() const {
|
||||
return FullSourceLoc();
|
||||
}
|
||||
|
||||
PathDiagnosticPiece* BugReport::VisitNode(const ExplodedNode* N,
|
||||
const ExplodedNode* PrevN,
|
||||
PathDiagnosticPiece *BugReport::VisitNode(const ExplodedNode *N,
|
||||
const ExplodedNode *PrevN,
|
||||
BugReporterContext &BRC) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -1405,10 +1405,10 @@ MakeReportGraph(const ExplodedGraph* G,
|
||||
llvm::DenseMap<const void*,unsigned> Visited;
|
||||
|
||||
unsigned cnt = 0;
|
||||
const ExplodedNode* Root = 0;
|
||||
const ExplodedNode *Root = 0;
|
||||
|
||||
while (!WS.empty()) {
|
||||
const ExplodedNode* Node = WS.front();
|
||||
const ExplodedNode *Node = WS.front();
|
||||
WS.pop();
|
||||
|
||||
if (Visited.find(Node) != Visited.end())
|
||||
@@ -1441,7 +1441,7 @@ MakeReportGraph(const ExplodedGraph* G,
|
||||
|
||||
// Create the equivalent node in the new graph with the same state
|
||||
// and location.
|
||||
ExplodedNode* NewN = GNew->getNode(N->getLocation(), N->getState());
|
||||
ExplodedNode *NewN = GNew->getNode(N->getLocation(), N->getState());
|
||||
|
||||
// Store the mapping to the original node.
|
||||
llvm::DenseMap<const void*, const void*>::iterator IMitr=InverseMap.find(N);
|
||||
@@ -1611,7 +1611,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
|
||||
// Start building the path diagnostic...
|
||||
PathDiagnosticBuilder PDB(*this, R, BackMap.get(), getPathDiagnosticClient());
|
||||
|
||||
if (PathDiagnosticPiece* Piece = R->getEndPath(PDB, N))
|
||||
if (PathDiagnosticPiece *Piece = R->getEndPath(PDB, N))
|
||||
PD.push_back(Piece);
|
||||
else
|
||||
return;
|
||||
@@ -1683,7 +1683,7 @@ FindReportInEquivalenceClass(BugReportEquivClass& EQ,
|
||||
// to 'Nodes'. Any of the reports will serve as a "representative" report.
|
||||
if (!BT.isSuppressOnSink()) {
|
||||
for (BugReportEquivClass::iterator I=EQ.begin(), E=EQ.end(); I!=E; ++I) {
|
||||
const ExplodedNode* N = I->getErrorNode();
|
||||
const ExplodedNode *N = I->getErrorNode();
|
||||
if (N) {
|
||||
R = *I;
|
||||
bugReports.push_back(R);
|
||||
@@ -1878,7 +1878,7 @@ void BugReporter::FlushReport(BugReportEquivClass& EQ) {
|
||||
return;
|
||||
|
||||
if (D->empty()) {
|
||||
PathDiagnosticPiece* piece =
|
||||
PathDiagnosticPiece *piece =
|
||||
new PathDiagnosticEventPiece(L, exampleReport->getDescription());
|
||||
|
||||
for ( ; Beg != End; ++Beg) piece->addRange(*Beg);
|
||||
|
||||
@@ -88,9 +88,9 @@ public:
|
||||
ID.Add(V);
|
||||
}
|
||||
|
||||
PathDiagnosticPiece* VisitNode(const ExplodedNode *N,
|
||||
PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
|
||||
const ExplodedNode *PrevN,
|
||||
BugReporterContext& BRC) {
|
||||
BugReporterContext &BRC) {
|
||||
|
||||
if (satisfied)
|
||||
return NULL;
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
static void registerFindLastStore(BugReporterContext& BRC, const MemRegion *R,
|
||||
static void registerFindLastStore(BugReporterContext &BRC, const MemRegion *R,
|
||||
SVal V) {
|
||||
BRC.addVisitor(new FindLastStoreBRVisitor(V, R));
|
||||
}
|
||||
@@ -240,9 +240,9 @@ public:
|
||||
ID.Add(Constraint);
|
||||
}
|
||||
|
||||
PathDiagnosticPiece* VisitNode(const ExplodedNode *N,
|
||||
PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
|
||||
const ExplodedNode *PrevN,
|
||||
BugReporterContext& BRC) {
|
||||
BugReporterContext &BRC) {
|
||||
if (isSatisfied)
|
||||
return NULL;
|
||||
|
||||
@@ -296,15 +296,15 @@ public:
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
static void registerTrackConstraint(BugReporterContext& BRC,
|
||||
static void registerTrackConstraint(BugReporterContext &BRC,
|
||||
DefinedSVal Constraint,
|
||||
bool Assumption) {
|
||||
BRC.addVisitor(new TrackConstraintBRVisitor(Constraint, Assumption));
|
||||
}
|
||||
|
||||
void bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC,
|
||||
void bugreporter::registerTrackNullOrUndefValue(BugReporterContext &BRC,
|
||||
const void *data,
|
||||
const ExplodedNode* N) {
|
||||
const ExplodedNode *N) {
|
||||
|
||||
const Stmt *S = static_cast<const Stmt*>(data);
|
||||
|
||||
@@ -365,9 +365,9 @@ void bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC,
|
||||
}
|
||||
}
|
||||
|
||||
void bugreporter::registerFindLastStore(BugReporterContext& BRC,
|
||||
void bugreporter::registerFindLastStore(BugReporterContext &BRC,
|
||||
const void *data,
|
||||
const ExplodedNode* N) {
|
||||
const ExplodedNode *N) {
|
||||
|
||||
const MemRegion *R = static_cast<const MemRegion*>(data);
|
||||
|
||||
@@ -394,9 +394,9 @@ public:
|
||||
ID.AddPointer(&x);
|
||||
}
|
||||
|
||||
PathDiagnosticPiece* VisitNode(const ExplodedNode *N,
|
||||
PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
|
||||
const ExplodedNode *PrevN,
|
||||
BugReporterContext& BRC) {
|
||||
BugReporterContext &BRC) {
|
||||
|
||||
const PostStmt *P = N->getLocationAs<PostStmt>();
|
||||
if (!P)
|
||||
|
||||
@@ -304,10 +304,10 @@ public:
|
||||
ID.Add(T);
|
||||
}
|
||||
|
||||
void print(raw_ostream& Out) const;
|
||||
void print(raw_ostream &Out) const;
|
||||
};
|
||||
|
||||
void RefVal::print(raw_ostream& Out) const {
|
||||
void RefVal::print(raw_ostream &Out) const {
|
||||
if (!T.isNull())
|
||||
Out << "Tracked Type:" << T.getAsString() << '\n';
|
||||
|
||||
@@ -398,7 +398,7 @@ namespace clang {
|
||||
namespace ento {
|
||||
template<>
|
||||
struct GRStateTrait<RefBindings> : public GRStatePartialTrait<RefBindings> {
|
||||
static void* GDMIndex() {
|
||||
static void *GDMIndex() {
|
||||
static int RefBIndex = 0;
|
||||
return &RefBIndex;
|
||||
}
|
||||
@@ -490,10 +490,10 @@ public:
|
||||
ObjCSummaryKey(IdentifierInfo* ii, Selector s)
|
||||
: II(ii), S(s) {}
|
||||
|
||||
ObjCSummaryKey(const ObjCInterfaceDecl* d, Selector s)
|
||||
ObjCSummaryKey(const ObjCInterfaceDecl *d, Selector s)
|
||||
: II(d ? d->getIdentifier() : 0), S(s) {}
|
||||
|
||||
ObjCSummaryKey(const ObjCInterfaceDecl* d, IdentifierInfo *ii, Selector s)
|
||||
ObjCSummaryKey(const ObjCInterfaceDecl *d, IdentifierInfo *ii, Selector s)
|
||||
: II(d ? d->getIdentifier() : ii), S(s) {}
|
||||
|
||||
ObjCSummaryKey(Selector s)
|
||||
@@ -542,14 +542,14 @@ class ObjCSummaryCache {
|
||||
public:
|
||||
ObjCSummaryCache() {}
|
||||
|
||||
RetainSummary* find(const ObjCInterfaceDecl* D, IdentifierInfo *ClsName,
|
||||
RetainSummary* find(const ObjCInterfaceDecl *D, IdentifierInfo *ClsName,
|
||||
Selector S) {
|
||||
// Lookup the method using the decl for the class @interface. If we
|
||||
// have no decl, lookup using the class name.
|
||||
return D ? find(D, S) : find(ClsName, S);
|
||||
}
|
||||
|
||||
RetainSummary* find(const ObjCInterfaceDecl* D, Selector S) {
|
||||
RetainSummary* find(const ObjCInterfaceDecl *D, Selector S) {
|
||||
// Do a lookup with the (D,S) pair. If we find a match return
|
||||
// the iterator.
|
||||
ObjCSummaryKey K(D, S);
|
||||
@@ -564,7 +564,7 @@ public:
|
||||
// generate initial summaries without having to worry about NSObject
|
||||
// being declared.
|
||||
// FIXME: We may change this at some point.
|
||||
for (ObjCInterfaceDecl* C=D->getSuperClass() ;; C=C->getSuperClass()) {
|
||||
for (ObjCInterfaceDecl *C=D->getSuperClass() ;; C=C->getSuperClass()) {
|
||||
if ((I = M.find(ObjCSummaryKey(C, S))) != M.end())
|
||||
break;
|
||||
|
||||
@@ -621,7 +621,7 @@ class RetainSummaryManager {
|
||||
//==-----------------------------------------------------------------==//
|
||||
|
||||
/// Ctx - The ASTContext object for the analyzed ASTs.
|
||||
ASTContext& Ctx;
|
||||
ASTContext &Ctx;
|
||||
|
||||
/// CFDictionaryCreateII - An IdentifierInfo* representing the indentifier
|
||||
/// "CFDictionaryCreate".
|
||||
@@ -684,9 +684,9 @@ public:
|
||||
|
||||
RetainSummary* getUnarySummary(const FunctionType* FT, UnaryFuncKind func);
|
||||
|
||||
RetainSummary* getCFSummaryCreateRule(const FunctionDecl* FD);
|
||||
RetainSummary* getCFSummaryGetRule(const FunctionDecl* FD);
|
||||
RetainSummary* getCFCreateGetRuleSummary(const FunctionDecl* FD,
|
||||
RetainSummary* getCFSummaryCreateRule(const FunctionDecl *FD);
|
||||
RetainSummary* getCFSummaryGetRule(const FunctionDecl *FD);
|
||||
RetainSummary* getCFCreateGetRuleSummary(const FunctionDecl *FD,
|
||||
StringRef FName);
|
||||
|
||||
RetainSummary* getPersistentSummary(ArgEffects AE, RetEffect RetEff,
|
||||
@@ -785,7 +785,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
RetainSummaryManager(ASTContext& ctx, bool gcenabled, bool usesARC)
|
||||
RetainSummaryManager(ASTContext &ctx, bool gcenabled, bool usesARC)
|
||||
: Ctx(ctx),
|
||||
CFDictionaryCreateII(&ctx.Idents.get("CFDictionaryCreate")),
|
||||
GCEnabled(gcenabled),
|
||||
@@ -811,20 +811,20 @@ public:
|
||||
|
||||
~RetainSummaryManager();
|
||||
|
||||
RetainSummary* getSummary(const FunctionDecl* FD);
|
||||
RetainSummary* getSummary(const FunctionDecl *FD);
|
||||
|
||||
RetainSummary *getInstanceMethodSummary(const ObjCMessage &msg,
|
||||
const GRState *state,
|
||||
const LocationContext *LC);
|
||||
|
||||
RetainSummary* getInstanceMethodSummary(const ObjCMessage &msg,
|
||||
const ObjCInterfaceDecl* ID) {
|
||||
const ObjCInterfaceDecl *ID) {
|
||||
return getInstanceMethodSummary(msg.getSelector(), 0,
|
||||
ID, msg.getMethodDecl(), msg.getType(Ctx));
|
||||
}
|
||||
|
||||
RetainSummary* getInstanceMethodSummary(Selector S, IdentifierInfo *ClsName,
|
||||
const ObjCInterfaceDecl* ID,
|
||||
const ObjCInterfaceDecl *ID,
|
||||
const ObjCMethodDecl *MD,
|
||||
QualType RetTy);
|
||||
|
||||
@@ -859,7 +859,7 @@ public:
|
||||
return getClassMethodSummary(S, ClsName, ID, MD, ResultTy);
|
||||
}
|
||||
|
||||
RetainSummary* getCommonMethodSummary(const ObjCMethodDecl* MD,
|
||||
RetainSummary* getCommonMethodSummary(const ObjCMethodDecl *MD,
|
||||
Selector S, QualType RetTy);
|
||||
|
||||
void updateSummaryFromAnnotations(RetainSummary &Summ,
|
||||
@@ -910,15 +910,15 @@ RetainSummaryManager::getPersistentSummary(ArgEffects AE, RetEffect RetEff,
|
||||
// Summary creation for functions (largely uses of Core Foundation).
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static bool isRetain(const FunctionDecl* FD, StringRef FName) {
|
||||
static bool isRetain(const FunctionDecl *FD, StringRef FName) {
|
||||
return FName.endswith("Retain");
|
||||
}
|
||||
|
||||
static bool isRelease(const FunctionDecl* FD, StringRef FName) {
|
||||
static bool isRelease(const FunctionDecl *FD, StringRef FName) {
|
||||
return FName.endswith("Release");
|
||||
}
|
||||
|
||||
RetainSummary* RetainSummaryManager::getSummary(const FunctionDecl* FD) {
|
||||
RetainSummary* RetainSummaryManager::getSummary(const FunctionDecl *FD) {
|
||||
// Look up a summary in our cache of FunctionDecls -> Summaries.
|
||||
FuncSummariesTy::iterator I = FuncSummaries.find(FD);
|
||||
if (I != FuncSummaries.end())
|
||||
@@ -1119,7 +1119,7 @@ RetainSummary* RetainSummaryManager::getSummary(const FunctionDecl* FD) {
|
||||
}
|
||||
|
||||
RetainSummary*
|
||||
RetainSummaryManager::getCFCreateGetRuleSummary(const FunctionDecl* FD,
|
||||
RetainSummaryManager::getCFCreateGetRuleSummary(const FunctionDecl *FD,
|
||||
StringRef FName) {
|
||||
if (coreFoundation::followsCreateRule(FName))
|
||||
return getCFSummaryCreateRule(FD);
|
||||
@@ -1164,7 +1164,7 @@ RetainSummaryManager::getUnarySummary(const FunctionType* FT,
|
||||
}
|
||||
|
||||
RetainSummary*
|
||||
RetainSummaryManager::getCFSummaryCreateRule(const FunctionDecl* FD) {
|
||||
RetainSummaryManager::getCFSummaryCreateRule(const FunctionDecl *FD) {
|
||||
assert (ScratchArgs.isEmpty());
|
||||
|
||||
if (FD->getIdentifier() == CFDictionaryCreateII) {
|
||||
@@ -1176,7 +1176,7 @@ RetainSummaryManager::getCFSummaryCreateRule(const FunctionDecl* FD) {
|
||||
}
|
||||
|
||||
RetainSummary*
|
||||
RetainSummaryManager::getCFSummaryGetRule(const FunctionDecl* FD) {
|
||||
RetainSummaryManager::getCFSummaryGetRule(const FunctionDecl *FD) {
|
||||
assert (ScratchArgs.isEmpty());
|
||||
return getPersistentSummary(RetEffect::MakeNotOwned(RetEffect::CF),
|
||||
DoNothing, DoNothing);
|
||||
@@ -1299,7 +1299,7 @@ RetainSummaryManager::updateSummaryFromAnnotations(RetainSummary &Summ,
|
||||
}
|
||||
|
||||
RetainSummary*
|
||||
RetainSummaryManager::getCommonMethodSummary(const ObjCMethodDecl* MD,
|
||||
RetainSummaryManager::getCommonMethodSummary(const ObjCMethodDecl *MD,
|
||||
Selector S, QualType RetTy) {
|
||||
|
||||
if (MD) {
|
||||
@@ -1364,7 +1364,7 @@ RetainSummaryManager::getInstanceMethodSummary(const ObjCMessage &msg,
|
||||
// We need the type-information of the tracked receiver object
|
||||
// Retrieve it from the state.
|
||||
const Expr *Receiver = msg.getInstanceReceiver();
|
||||
const ObjCInterfaceDecl* ID = 0;
|
||||
const ObjCInterfaceDecl *ID = 0;
|
||||
|
||||
// FIXME: Is this really working as expected? There are cases where
|
||||
// we just use the 'ID' from the message expression.
|
||||
@@ -1403,7 +1403,7 @@ RetainSummaryManager::getInstanceMethodSummary(const ObjCMessage &msg,
|
||||
RetainSummary*
|
||||
RetainSummaryManager::getInstanceMethodSummary(Selector S,
|
||||
IdentifierInfo *ClsName,
|
||||
const ObjCInterfaceDecl* ID,
|
||||
const ObjCInterfaceDecl *ID,
|
||||
const ObjCMethodDecl *MD,
|
||||
QualType RetTy) {
|
||||
|
||||
@@ -1611,17 +1611,17 @@ namespace clang {
|
||||
namespace ento {
|
||||
template<> struct GRStateTrait<AutoreleaseStack>
|
||||
: public GRStatePartialTrait<ARStack> {
|
||||
static inline void* GDMIndex() { return &AutoRBIndex; }
|
||||
static inline void *GDMIndex() { return &AutoRBIndex; }
|
||||
};
|
||||
|
||||
template<> struct GRStateTrait<AutoreleasePoolContents>
|
||||
: public GRStatePartialTrait<ARPoolContents> {
|
||||
static inline void* GDMIndex() { return &AutoRCIndex; }
|
||||
static inline void *GDMIndex() { return &AutoRCIndex; }
|
||||
};
|
||||
} // end GR namespace
|
||||
} // end clang namespace
|
||||
|
||||
static SymbolRef GetCurrentAutoreleasePool(const GRState* state) {
|
||||
static SymbolRef GetCurrentAutoreleasePool(const GRState *state) {
|
||||
ARStack stack = state->get<AutoreleaseStack>();
|
||||
return stack.isEmpty() ? SymbolRef() : stack.getHead();
|
||||
}
|
||||
@@ -1653,7 +1653,7 @@ class CFRefCount : public TransferFuncs {
|
||||
public:
|
||||
class BindingsPrinter : public GRState::Printer {
|
||||
public:
|
||||
virtual void Print(raw_ostream& Out, const GRState* state,
|
||||
virtual void Print(raw_ostream &Out, const GRState *state,
|
||||
const char* nl, const char* sep);
|
||||
};
|
||||
|
||||
@@ -1677,24 +1677,24 @@ public:
|
||||
const GRState * Update(const GRState * state, SymbolRef sym, RefVal V,
|
||||
ArgEffect E, RefVal::Kind& hasErr);
|
||||
|
||||
void ProcessNonLeakError(ExplodedNodeSet& Dst,
|
||||
void ProcessNonLeakError(ExplodedNodeSet &Dst,
|
||||
StmtNodeBuilder& Builder,
|
||||
const Expr* NodeExpr, SourceRange ErrorRange,
|
||||
ExplodedNode* Pred,
|
||||
const GRState* St,
|
||||
const Expr *NodeExpr, SourceRange ErrorRange,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *St,
|
||||
RefVal::Kind hasErr, SymbolRef Sym);
|
||||
|
||||
const GRState * HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V,
|
||||
SmallVectorImpl<SymbolRef> &Leaked);
|
||||
|
||||
ExplodedNode* ProcessLeaks(const GRState * state,
|
||||
ExplodedNode *ProcessLeaks(const GRState * state,
|
||||
SmallVectorImpl<SymbolRef> &Leaked,
|
||||
GenericNodeBuilderRefCount &Builder,
|
||||
ExprEngine &Eng,
|
||||
ExplodedNode *Pred = 0);
|
||||
|
||||
public:
|
||||
CFRefCount(ASTContext& Ctx, bool gcenabled, const LangOptions& lopts)
|
||||
CFRefCount(ASTContext &Ctx, bool gcenabled, const LangOptions& lopts)
|
||||
: Summaries(Ctx, gcenabled, (bool)lopts.ObjCAutoRefCount),
|
||||
LOpts(lopts), useAfterRelease(0), releaseNotOwned(0),
|
||||
deallocGC(0), deallocNotOwned(0),
|
||||
@@ -1725,28 +1725,28 @@ public:
|
||||
|
||||
// Calls.
|
||||
|
||||
void evalSummary(ExplodedNodeSet& Dst,
|
||||
void evalSummary(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Eng,
|
||||
StmtNodeBuilder& Builder,
|
||||
const Expr* Ex,
|
||||
const Expr *Ex,
|
||||
const CallOrObjCMessage &callOrMsg,
|
||||
InstanceReceiver Receiver,
|
||||
const RetainSummary& Summ,
|
||||
const MemRegion *Callee,
|
||||
ExplodedNode* Pred, const GRState *state);
|
||||
ExplodedNode *Pred, const GRState *state);
|
||||
|
||||
virtual void evalCall(ExplodedNodeSet& Dst,
|
||||
virtual void evalCall(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Eng,
|
||||
StmtNodeBuilder& Builder,
|
||||
const CallExpr* CE, SVal L,
|
||||
ExplodedNode* Pred);
|
||||
const CallExpr *CE, SVal L,
|
||||
ExplodedNode *Pred);
|
||||
|
||||
|
||||
virtual void evalObjCMessage(ExplodedNodeSet& Dst,
|
||||
virtual void evalObjCMessage(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Engine,
|
||||
StmtNodeBuilder& Builder,
|
||||
ObjCMessage msg,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *state);
|
||||
// Stores.
|
||||
virtual void evalBind(StmtNodeBuilderRef& B, SVal location, SVal val);
|
||||
@@ -1756,39 +1756,39 @@ public:
|
||||
virtual void evalEndPath(ExprEngine& Engine,
|
||||
EndOfFunctionNodeBuilder& Builder);
|
||||
|
||||
virtual void evalDeadSymbols(ExplodedNodeSet& Dst,
|
||||
virtual void evalDeadSymbols(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Engine,
|
||||
StmtNodeBuilder& Builder,
|
||||
ExplodedNode* Pred,
|
||||
const GRState* state,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *state,
|
||||
SymbolReaper& SymReaper);
|
||||
|
||||
const ProgramPointTag *getDeadSymbolTag(SymbolRef sym);
|
||||
|
||||
std::pair<ExplodedNode*, const GRState *>
|
||||
HandleAutoreleaseCounts(const GRState * state, GenericNodeBuilderRefCount Bd,
|
||||
ExplodedNode* Pred, ExprEngine &Eng,
|
||||
ExplodedNode *Pred, ExprEngine &Eng,
|
||||
SymbolRef Sym, RefVal V, bool &stop);
|
||||
// Return statements.
|
||||
|
||||
virtual void evalReturn(ExplodedNodeSet& Dst,
|
||||
virtual void evalReturn(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Engine,
|
||||
StmtNodeBuilder& Builder,
|
||||
const ReturnStmt* S,
|
||||
ExplodedNode* Pred);
|
||||
const ReturnStmt *S,
|
||||
ExplodedNode *Pred);
|
||||
|
||||
void evalReturnWithRetEffect(ExplodedNodeSet& Dst,
|
||||
void evalReturnWithRetEffect(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Engine,
|
||||
StmtNodeBuilder& Builder,
|
||||
const ReturnStmt* S,
|
||||
ExplodedNode* Pred,
|
||||
const ReturnStmt *S,
|
||||
ExplodedNode *Pred,
|
||||
RetEffect RE, RefVal X,
|
||||
SymbolRef Sym, const GRState *state);
|
||||
|
||||
|
||||
// Assumptions.
|
||||
|
||||
virtual const GRState *evalAssume(const GRState* state, SVal condition,
|
||||
virtual const GRState *evalAssume(const GRState *state, SVal condition,
|
||||
bool assumption);
|
||||
};
|
||||
|
||||
@@ -1811,8 +1811,8 @@ static void PrintPool(raw_ostream &Out, SymbolRef Sym,
|
||||
Out << '}';
|
||||
}
|
||||
|
||||
void CFRefCount::BindingsPrinter::Print(raw_ostream& Out,
|
||||
const GRState* state,
|
||||
void CFRefCount::BindingsPrinter::Print(raw_ostream &Out,
|
||||
const GRState *state,
|
||||
const char* nl, const char* sep) {
|
||||
|
||||
RefBindings B = state->get<RefBindings>();
|
||||
@@ -1980,14 +1980,14 @@ namespace {
|
||||
|
||||
SymbolRef getSymbol() const { return Sym; }
|
||||
|
||||
PathDiagnosticPiece* getEndPath(BugReporterContext& BRC,
|
||||
const ExplodedNode* N);
|
||||
PathDiagnosticPiece *getEndPath(BugReporterContext &BRC,
|
||||
const ExplodedNode *N);
|
||||
|
||||
std::pair<const char**,const char**> getExtraDescriptiveText();
|
||||
|
||||
PathDiagnosticPiece* VisitNode(const ExplodedNode* N,
|
||||
const ExplodedNode* PrevN,
|
||||
BugReporterContext& BRC);
|
||||
PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
|
||||
const ExplodedNode *PrevN,
|
||||
BugReporterContext &BRC);
|
||||
};
|
||||
|
||||
class CFRefLeakReport : public CFRefReport {
|
||||
@@ -1998,8 +1998,8 @@ namespace {
|
||||
ExplodedNode *n, SymbolRef sym,
|
||||
ExprEngine& Eng);
|
||||
|
||||
PathDiagnosticPiece* getEndPath(BugReporterContext& BRC,
|
||||
const ExplodedNode* N);
|
||||
PathDiagnosticPiece *getEndPath(BugReporterContext &BRC,
|
||||
const ExplodedNode *N);
|
||||
|
||||
SourceLocation getLocation() const { return AllocSite; }
|
||||
};
|
||||
@@ -2052,9 +2052,9 @@ static inline bool contains(const SmallVectorImpl<ArgEffect>& V,
|
||||
return false;
|
||||
}
|
||||
|
||||
PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N,
|
||||
const ExplodedNode* PrevN,
|
||||
BugReporterContext& BRC) {
|
||||
PathDiagnosticPiece *CFRefReport::VisitNode(const ExplodedNode *N,
|
||||
const ExplodedNode *PrevN,
|
||||
BugReporterContext &BRC) {
|
||||
|
||||
if (!isa<PostStmt>(N->getLocation()))
|
||||
return NULL;
|
||||
@@ -2077,12 +2077,12 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N,
|
||||
// This is the allocation site since the previous node had no bindings
|
||||
// for this symbol.
|
||||
if (!PrevT) {
|
||||
const Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
|
||||
const Stmt *S = cast<PostStmt>(N->getLocation()).getStmt();
|
||||
|
||||
if (const CallExpr *CE = dyn_cast<CallExpr>(S)) {
|
||||
// Get the name of the callee (if it is available).
|
||||
SVal X = CurrSt->getSValAsScalarOrLoc(CE->getCallee());
|
||||
if (const FunctionDecl* FD = X.getAsFunctionDecl())
|
||||
if (const FunctionDecl *FD = X.getAsFunctionDecl())
|
||||
os << "Call to function '" << FD << '\'';
|
||||
else
|
||||
os << "function call";
|
||||
@@ -2127,7 +2127,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N,
|
||||
TF.getSummaryOfNode(BRC.getNodeResolver().getOriginalNode(N))) {
|
||||
// We only have summaries attached to nodes after evaluating CallExpr and
|
||||
// ObjCMessageExprs.
|
||||
const Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
|
||||
const Stmt *S = cast<PostStmt>(N->getLocation()).getStmt();
|
||||
|
||||
if (const CallExpr *CE = dyn_cast<CallExpr>(S)) {
|
||||
// Iterate through the parameter expressions and see if the symbol
|
||||
@@ -2175,9 +2175,9 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N,
|
||||
// Specially handle CFMakeCollectable and friends.
|
||||
if (contains(AEffects, MakeCollectable)) {
|
||||
// Get the name of the function.
|
||||
const Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
|
||||
const Stmt *S = cast<PostStmt>(N->getLocation()).getStmt();
|
||||
SVal X = CurrSt->getSValAsScalarOrLoc(cast<CallExpr>(S)->getCallee());
|
||||
const FunctionDecl* FD = X.getAsFunctionDecl();
|
||||
const FunctionDecl *FD = X.getAsFunctionDecl();
|
||||
const std::string& FName = FD->getNameAsString();
|
||||
|
||||
if (TF.isGCEnabled()) {
|
||||
@@ -2279,15 +2279,15 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N,
|
||||
if (os.str().empty())
|
||||
return 0; // We have nothing to say!
|
||||
|
||||
const Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
|
||||
const Stmt *S = cast<PostStmt>(N->getLocation()).getStmt();
|
||||
PathDiagnosticLocation Pos(S, BRC.getSourceManager());
|
||||
PathDiagnosticPiece* P = new PathDiagnosticEventPiece(Pos, os.str());
|
||||
PathDiagnosticPiece *P = new PathDiagnosticEventPiece(Pos, os.str());
|
||||
|
||||
// Add the range by scanning the children of the statement for any bindings
|
||||
// to Sym.
|
||||
for (Stmt::const_child_iterator I = S->child_begin(), E = S->child_end();
|
||||
I!=E; ++I)
|
||||
if (const Expr* Exp = dyn_cast_or_null<Expr>(*I))
|
||||
if (const Expr *Exp = dyn_cast_or_null<Expr>(*I))
|
||||
if (CurrSt->getSValAsScalarOrLoc(Exp).getAsLocSymbol() == Sym) {
|
||||
P->addRange(Exp->getSourceRange());
|
||||
break;
|
||||
@@ -2329,16 +2329,16 @@ namespace {
|
||||
}
|
||||
|
||||
static std::pair<const ExplodedNode*,const MemRegion*>
|
||||
GetAllocationSite(GRStateManager& StateMgr, const ExplodedNode* N,
|
||||
GetAllocationSite(GRStateManager& StateMgr, const ExplodedNode *N,
|
||||
SymbolRef Sym) {
|
||||
|
||||
// Find both first node that referred to the tracked symbol and the
|
||||
// memory location that value was store to.
|
||||
const ExplodedNode* Last = N;
|
||||
const ExplodedNode *Last = N;
|
||||
const MemRegion* FirstBinding = 0;
|
||||
|
||||
while (N) {
|
||||
const GRState* St = N->getState();
|
||||
const GRState *St = N->getState();
|
||||
RefBindings B = St->get<RefBindings>();
|
||||
|
||||
if (!B.lookup(Sym))
|
||||
@@ -2356,8 +2356,8 @@ GetAllocationSite(GRStateManager& StateMgr, const ExplodedNode* N,
|
||||
}
|
||||
|
||||
PathDiagnosticPiece*
|
||||
CFRefReport::getEndPath(BugReporterContext& BRC,
|
||||
const ExplodedNode* EndN) {
|
||||
CFRefReport::getEndPath(BugReporterContext &BRC,
|
||||
const ExplodedNode *EndN) {
|
||||
// Tell the BugReporterContext to report cases when the tracked symbol is
|
||||
// assigned to different variables, etc.
|
||||
BRC.addNotableSymbol(Sym);
|
||||
@@ -2365,8 +2365,8 @@ CFRefReport::getEndPath(BugReporterContext& BRC,
|
||||
}
|
||||
|
||||
PathDiagnosticPiece*
|
||||
CFRefLeakReport::getEndPath(BugReporterContext& BRC,
|
||||
const ExplodedNode* EndN){
|
||||
CFRefLeakReport::getEndPath(BugReporterContext &BRC,
|
||||
const ExplodedNode *EndN){
|
||||
|
||||
// Tell the BugReporterContext to report cases when the tracked symbol is
|
||||
// assigned to different variables, etc.
|
||||
@@ -2375,7 +2375,7 @@ CFRefLeakReport::getEndPath(BugReporterContext& BRC,
|
||||
// We are reporting a leak. Walk up the graph to get to the first node where
|
||||
// the symbol appeared, and also get the first VarDecl that tracked object
|
||||
// is stored to.
|
||||
const ExplodedNode* AllocNode = 0;
|
||||
const ExplodedNode *AllocNode = 0;
|
||||
const MemRegion* FirstBinding = 0;
|
||||
|
||||
llvm::tie(AllocNode, FirstBinding) =
|
||||
@@ -2386,7 +2386,7 @@ CFRefLeakReport::getEndPath(BugReporterContext& BRC,
|
||||
// Compute an actual location for the leak. Sometimes a leak doesn't
|
||||
// occur at an actual statement (e.g., transition between blocks; end
|
||||
// of function) so we need to walk the graph and compute a real location.
|
||||
const ExplodedNode* LeakN = EndN;
|
||||
const ExplodedNode *LeakN = EndN;
|
||||
PathDiagnosticLocation L;
|
||||
|
||||
while (LeakN) {
|
||||
@@ -2397,7 +2397,7 @@ CFRefLeakReport::getEndPath(BugReporterContext& BRC,
|
||||
break;
|
||||
}
|
||||
else if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) {
|
||||
if (const Stmt* Term = BE->getSrc()->getTerminator()) {
|
||||
if (const Stmt *Term = BE->getSrc()->getTerminator()) {
|
||||
L = PathDiagnosticLocation(Term->getLocStart(), SMgr);
|
||||
break;
|
||||
}
|
||||
@@ -2448,7 +2448,7 @@ CFRefLeakReport::getEndPath(BugReporterContext& BRC,
|
||||
}
|
||||
}
|
||||
else if (RV->getKind() == RefVal::ErrorGCLeakReturned) {
|
||||
ObjCMethodDecl& MD = cast<ObjCMethodDecl>(EndN->getCodeDecl());
|
||||
ObjCMethodDecl &MD = cast<ObjCMethodDecl>(EndN->getCodeDecl());
|
||||
os << " and returned from method '" << MD.getSelector().getAsString()
|
||||
<< "' is potentially leaked when using garbage collection. Callers "
|
||||
"of this method do not expect a returned object with a +1 retain "
|
||||
@@ -2475,7 +2475,7 @@ CFRefLeakReport::CFRefLeakReport(CFRefBug& D, const CFRefCount &tf,
|
||||
// Note that this is *not* the trimmed graph; we are guaranteed, however,
|
||||
// that all ancestor nodes that represent the allocation site have the
|
||||
// same SourceLocation.
|
||||
const ExplodedNode* AllocNode = 0;
|
||||
const ExplodedNode *AllocNode = 0;
|
||||
|
||||
llvm::tie(AllocNode, AllocBinding) = // Set AllocBinding.
|
||||
GetAllocationSite(Eng.getStateManager(), getErrorNode(), getSymbol());
|
||||
@@ -2509,7 +2509,7 @@ CFRefLeakReport::CFRefLeakReport(CFRefBug& D, const CFRefCount &tf,
|
||||
/// While the the return type can be queried directly from RetEx, when
|
||||
/// invoking class methods we augment to the return type to be that of
|
||||
/// a pointer to the class (as opposed it just being id).
|
||||
static QualType GetReturnType(const Expr* RetE, ASTContext& Ctx) {
|
||||
static QualType GetReturnType(const Expr *RetE, ASTContext &Ctx) {
|
||||
QualType RetTy = RetE->getType();
|
||||
// If RetE is not a message expression just return its type.
|
||||
// If RetE is a message expression, return its types if it is something
|
||||
@@ -2547,15 +2547,15 @@ struct ResetWhiteList {
|
||||
};
|
||||
}
|
||||
|
||||
void CFRefCount::evalSummary(ExplodedNodeSet& Dst,
|
||||
void CFRefCount::evalSummary(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Eng,
|
||||
StmtNodeBuilder& Builder,
|
||||
const Expr* Ex,
|
||||
const Expr *Ex,
|
||||
const CallOrObjCMessage &callOrMsg,
|
||||
InstanceReceiver Receiver,
|
||||
const RetainSummary& Summ,
|
||||
const MemRegion *Callee,
|
||||
ExplodedNode* Pred, const GRState *state) {
|
||||
ExplodedNode *Pred, const GRState *state) {
|
||||
|
||||
// Evaluate the effect of the arguments.
|
||||
RefVal::Kind hasErr = (RefVal::Kind) 0;
|
||||
@@ -2812,11 +2812,11 @@ void CFRefCount::evalSummary(ExplodedNodeSet& Dst,
|
||||
}
|
||||
|
||||
|
||||
void CFRefCount::evalCall(ExplodedNodeSet& Dst,
|
||||
void CFRefCount::evalCall(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Eng,
|
||||
StmtNodeBuilder& Builder,
|
||||
const CallExpr* CE, SVal L,
|
||||
ExplodedNode* Pred) {
|
||||
const CallExpr *CE, SVal L,
|
||||
ExplodedNode *Pred) {
|
||||
|
||||
RetainSummary *Summ = 0;
|
||||
|
||||
@@ -2826,7 +2826,7 @@ void CFRefCount::evalCall(ExplodedNodeSet& Dst,
|
||||
if (dyn_cast_or_null<BlockDataRegion>(L.getAsRegion())) {
|
||||
Summ = Summaries.getPersistentStopSummary();
|
||||
}
|
||||
else if (const FunctionDecl* FD = L.getAsFunctionDecl()) {
|
||||
else if (const FunctionDecl *FD = L.getAsFunctionDecl()) {
|
||||
Summ = Summaries.getSummary(FD);
|
||||
}
|
||||
else if (const CXXMemberCallExpr *me = dyn_cast<CXXMemberCallExpr>(CE)) {
|
||||
@@ -2845,11 +2845,11 @@ void CFRefCount::evalCall(ExplodedNodeSet& Dst,
|
||||
Pred, Pred->getState());
|
||||
}
|
||||
|
||||
void CFRefCount::evalObjCMessage(ExplodedNodeSet& Dst,
|
||||
void CFRefCount::evalObjCMessage(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Eng,
|
||||
StmtNodeBuilder& Builder,
|
||||
ObjCMessage msg,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *state) {
|
||||
RetainSummary *Summ =
|
||||
msg.isInstanceMessage()
|
||||
@@ -2917,13 +2917,13 @@ void CFRefCount::evalBind(StmtNodeBuilderRef& B, SVal location, SVal val) {
|
||||
|
||||
// Return statements.
|
||||
|
||||
void CFRefCount::evalReturn(ExplodedNodeSet& Dst,
|
||||
void CFRefCount::evalReturn(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Eng,
|
||||
StmtNodeBuilder& Builder,
|
||||
const ReturnStmt* S,
|
||||
ExplodedNode* Pred) {
|
||||
const ReturnStmt *S,
|
||||
ExplodedNode *Pred) {
|
||||
|
||||
const Expr* RetE = S->getRetValue();
|
||||
const Expr *RetE = S->getRetValue();
|
||||
if (!RetE)
|
||||
return;
|
||||
|
||||
@@ -2994,7 +2994,7 @@ void CFRefCount::evalReturn(ExplodedNodeSet& Dst,
|
||||
// Consult the summary of the enclosing method.
|
||||
Decl const *CD = &Pred->getCodeDecl();
|
||||
|
||||
if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(CD)) {
|
||||
if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(CD)) {
|
||||
const RetainSummary &Summ = *Summaries.getMethodSummary(MD);
|
||||
return evalReturnWithRetEffect(Dst, Eng, Builder, S,
|
||||
Pred, Summ.getRetEffect(), X,
|
||||
@@ -3078,7 +3078,7 @@ void CFRefCount::evalReturnWithRetEffect(ExplodedNodeSet &Dst,
|
||||
|
||||
// Assumptions.
|
||||
|
||||
const GRState* CFRefCount::evalAssume(const GRState *state,
|
||||
const GRState *CFRefCount::evalAssume(const GRState *state,
|
||||
SVal Cond, bool Assumption) {
|
||||
|
||||
// FIXME: We may add to the interface of evalAssume the list of symbols
|
||||
@@ -3253,7 +3253,7 @@ const GRState * CFRefCount::Update(const GRState * state, SymbolRef sym,
|
||||
std::pair<ExplodedNode*, const GRState *>
|
||||
CFRefCount::HandleAutoreleaseCounts(const GRState * state,
|
||||
GenericNodeBuilderRefCount Bd,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNode *Pred,
|
||||
ExprEngine &Eng,
|
||||
SymbolRef Sym, RefVal V, bool &stop) {
|
||||
|
||||
@@ -3395,11 +3395,11 @@ const ProgramPointTag *CFRefCount::getDeadSymbolTag(SymbolRef sym) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
void CFRefCount::evalDeadSymbols(ExplodedNodeSet& Dst,
|
||||
void CFRefCount::evalDeadSymbols(ExplodedNodeSet &Dst,
|
||||
ExprEngine& Eng,
|
||||
StmtNodeBuilder& Builder,
|
||||
ExplodedNode* Pred,
|
||||
const GRState* state,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *state,
|
||||
SymbolReaper& SymReaper) {
|
||||
const Stmt *S = Builder.getStmt();
|
||||
RefBindings B = state->get<RefBindings>();
|
||||
@@ -3449,12 +3449,12 @@ void CFRefCount::evalDeadSymbols(ExplodedNodeSet& Dst,
|
||||
Builder.MakeNode(Dst, S, Pred, state);
|
||||
}
|
||||
|
||||
void CFRefCount::ProcessNonLeakError(ExplodedNodeSet& Dst,
|
||||
void CFRefCount::ProcessNonLeakError(ExplodedNodeSet &Dst,
|
||||
StmtNodeBuilder& Builder,
|
||||
const Expr* NodeExpr,
|
||||
const Expr *NodeExpr,
|
||||
SourceRange ErrorRange,
|
||||
ExplodedNode* Pred,
|
||||
const GRState* St,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *St,
|
||||
RefVal::Kind hasErr, SymbolRef Sym) {
|
||||
Builder.BuildSinks = true;
|
||||
ExplodedNode *N = Builder.MakeNode(Dst, NodeExpr, Pred, St);
|
||||
@@ -3689,7 +3689,7 @@ void CFRefCount::RegisterChecks(ExprEngine& Eng) {
|
||||
Eng.getCheckerManager().registerChecker<RetainReleaseChecker>();
|
||||
}
|
||||
|
||||
TransferFuncs* ento::MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
|
||||
TransferFuncs* ento::MakeCFRefCountTF(ASTContext &Ctx, bool GCEnabled,
|
||||
const LangOptions& lopts) {
|
||||
return new CFRefCount(Ctx, GCEnabled, lopts);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ using namespace ento;
|
||||
// This should be removed in the future.
|
||||
namespace clang {
|
||||
namespace ento {
|
||||
TransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
|
||||
TransferFuncs* MakeCFRefCountTF(ASTContext &Ctx, bool GCEnabled,
|
||||
const LangOptions& lopts);
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ bool CoreEngine::ExecuteWorkList(const LocationContext *L, unsigned Steps,
|
||||
if (G->num_roots() == 0) { // Initialize the analysis by constructing
|
||||
// the root if none exists.
|
||||
|
||||
const CFGBlock* Entry = &(L->getCFG()->getEntry());
|
||||
const CFGBlock *Entry = &(L->getCFG()->getEntry());
|
||||
|
||||
assert (Entry->empty() &&
|
||||
"Entry block must be empty.");
|
||||
@@ -173,7 +173,7 @@ bool CoreEngine::ExecuteWorkList(const LocationContext *L, unsigned Steps,
|
||||
"Entry block must have 1 successor.");
|
||||
|
||||
// Get the solitary successor.
|
||||
const CFGBlock* Succ = *(Entry->succ_begin());
|
||||
const CFGBlock *Succ = *(Entry->succ_begin());
|
||||
|
||||
// Construct an edge representing the
|
||||
// starting location in the function.
|
||||
@@ -205,7 +205,7 @@ bool CoreEngine::ExecuteWorkList(const LocationContext *L, unsigned Steps,
|
||||
WList->setBlockCounter(WU.getBlockCounter());
|
||||
|
||||
// Retrieve the node.
|
||||
ExplodedNode* Node = WU.getNode();
|
||||
ExplodedNode *Node = WU.getNode();
|
||||
|
||||
// Dispatch on the location type.
|
||||
switch (Node->getLocation().getKind()) {
|
||||
@@ -265,9 +265,9 @@ void CoreEngine::HandleCallExit(const CallExit &L, ExplodedNode *Pred) {
|
||||
SubEng.processCallExit(Builder);
|
||||
}
|
||||
|
||||
void CoreEngine::HandleBlockEdge(const BlockEdge& L, ExplodedNode* Pred) {
|
||||
void CoreEngine::HandleBlockEdge(const BlockEdge &L, ExplodedNode *Pred) {
|
||||
|
||||
const CFGBlock* Blk = L.getDst();
|
||||
const CFGBlock *Blk = L.getDst();
|
||||
|
||||
// Check if we are entering the EXIT block.
|
||||
if (Blk == &(L.getLocationContext()->getCFG()->getExit())) {
|
||||
@@ -309,8 +309,8 @@ void CoreEngine::HandleBlockEdge(const BlockEdge& L, ExplodedNode* Pred) {
|
||||
}
|
||||
}
|
||||
|
||||
void CoreEngine::HandleBlockEntrance(const BlockEntrance& L,
|
||||
ExplodedNode* Pred) {
|
||||
void CoreEngine::HandleBlockEntrance(const BlockEntrance &L,
|
||||
ExplodedNode *Pred) {
|
||||
|
||||
// Increment the block counter.
|
||||
BlockCounter Counter = WList->getBlockCounter();
|
||||
@@ -329,9 +329,9 @@ void CoreEngine::HandleBlockEntrance(const BlockEntrance& L,
|
||||
HandleBlockExit(L.getBlock(), Pred);
|
||||
}
|
||||
|
||||
void CoreEngine::HandleBlockExit(const CFGBlock * B, ExplodedNode* Pred) {
|
||||
void CoreEngine::HandleBlockExit(const CFGBlock * B, ExplodedNode *Pred) {
|
||||
|
||||
if (const Stmt* Term = B->getTerminator()) {
|
||||
if (const Stmt *Term = B->getTerminator()) {
|
||||
switch (Term->getStmtClass()) {
|
||||
default:
|
||||
assert(false && "Analysis for this terminator not implemented.");
|
||||
@@ -419,16 +419,16 @@ void CoreEngine::HandleBlockExit(const CFGBlock * B, ExplodedNode* Pred) {
|
||||
Pred->State, Pred);
|
||||
}
|
||||
|
||||
void CoreEngine::HandleBranch(const Stmt* Cond, const Stmt* Term,
|
||||
const CFGBlock * B, ExplodedNode* Pred) {
|
||||
void CoreEngine::HandleBranch(const Stmt *Cond, const Stmt *Term,
|
||||
const CFGBlock * B, ExplodedNode *Pred) {
|
||||
assert(B->succ_size() == 2);
|
||||
BranchNodeBuilder Builder(B, *(B->succ_begin()), *(B->succ_begin()+1),
|
||||
Pred, this);
|
||||
SubEng.processBranch(Cond, Term, Builder);
|
||||
}
|
||||
|
||||
void CoreEngine::HandlePostStmt(const CFGBlock* B, unsigned StmtIdx,
|
||||
ExplodedNode* Pred) {
|
||||
void CoreEngine::HandlePostStmt(const CFGBlock *B, unsigned StmtIdx,
|
||||
ExplodedNode *Pred) {
|
||||
assert (!B->empty());
|
||||
|
||||
if (StmtIdx == B->size())
|
||||
@@ -442,11 +442,11 @@ void CoreEngine::HandlePostStmt(const CFGBlock* B, unsigned StmtIdx,
|
||||
|
||||
/// generateNode - Utility method to generate nodes, hook up successors,
|
||||
/// and add nodes to the worklist.
|
||||
void CoreEngine::generateNode(const ProgramPoint& Loc,
|
||||
const GRState* State, ExplodedNode* Pred) {
|
||||
void CoreEngine::generateNode(const ProgramPoint &Loc,
|
||||
const GRState *State, ExplodedNode *Pred) {
|
||||
|
||||
bool IsNew;
|
||||
ExplodedNode* Node = G->getNode(Loc, State, &IsNew);
|
||||
ExplodedNode *Node = G->getNode(Loc, State, &IsNew);
|
||||
|
||||
if (Pred)
|
||||
Node->addPredecessor(Pred, *G); // Link 'Node' with its predecessor.
|
||||
@@ -480,8 +480,8 @@ GenericNodeBuilderImpl::generateNodeImpl(const GRState *state,
|
||||
return 0;
|
||||
}
|
||||
|
||||
StmtNodeBuilder::StmtNodeBuilder(const CFGBlock* b, unsigned idx,
|
||||
ExplodedNode* N, CoreEngine* e,
|
||||
StmtNodeBuilder::StmtNodeBuilder(const CFGBlock *b, unsigned idx,
|
||||
ExplodedNode *N, CoreEngine* e,
|
||||
GRStateManager &mgr)
|
||||
: Eng(*e), B(*b), Idx(idx), Pred(N), Mgr(mgr),
|
||||
PurgingDeadSymbols(false), BuildSinks(false), hasGeneratedNode(false),
|
||||
@@ -495,7 +495,7 @@ StmtNodeBuilder::~StmtNodeBuilder() {
|
||||
GenerateAutoTransition(*I);
|
||||
}
|
||||
|
||||
void StmtNodeBuilder::GenerateAutoTransition(ExplodedNode* N) {
|
||||
void StmtNodeBuilder::GenerateAutoTransition(ExplodedNode *N) {
|
||||
assert (!N->isSink());
|
||||
|
||||
// Check if this node entered a callee.
|
||||
@@ -522,18 +522,18 @@ void StmtNodeBuilder::GenerateAutoTransition(ExplodedNode* N) {
|
||||
}
|
||||
|
||||
bool IsNew;
|
||||
ExplodedNode* Succ = Eng.G->getNode(Loc, N->State, &IsNew);
|
||||
ExplodedNode *Succ = Eng.G->getNode(Loc, N->State, &IsNew);
|
||||
Succ->addPredecessor(N, *Eng.G);
|
||||
|
||||
if (IsNew)
|
||||
Eng.WList->enqueue(Succ, &B, Idx+1);
|
||||
}
|
||||
|
||||
ExplodedNode* StmtNodeBuilder::MakeNode(ExplodedNodeSet& Dst, const Stmt* S,
|
||||
ExplodedNode* Pred, const GRState* St,
|
||||
ExplodedNode *StmtNodeBuilder::MakeNode(ExplodedNodeSet &Dst, const Stmt *S,
|
||||
ExplodedNode *Pred, const GRState *St,
|
||||
ProgramPoint::Kind K) {
|
||||
|
||||
ExplodedNode* N = generateNode(S, St, Pred, K);
|
||||
ExplodedNode *N = generateNode(S, St, Pred, K);
|
||||
|
||||
if (N) {
|
||||
if (BuildSinks)
|
||||
@@ -571,8 +571,8 @@ static ProgramPoint GetProgramPoint(const Stmt *S, ProgramPoint::Kind K,
|
||||
}
|
||||
|
||||
ExplodedNode*
|
||||
StmtNodeBuilder::generateNodeInternal(const Stmt* S, const GRState* state,
|
||||
ExplodedNode* Pred,
|
||||
StmtNodeBuilder::generateNodeInternal(const Stmt *S, const GRState *state,
|
||||
ExplodedNode *Pred,
|
||||
ProgramPoint::Kind K,
|
||||
const ProgramPointTag *tag) {
|
||||
|
||||
@@ -583,10 +583,10 @@ StmtNodeBuilder::generateNodeInternal(const Stmt* S, const GRState* state,
|
||||
|
||||
ExplodedNode*
|
||||
StmtNodeBuilder::generateNodeInternal(const ProgramPoint &Loc,
|
||||
const GRState* State,
|
||||
ExplodedNode* Pred) {
|
||||
const GRState *State,
|
||||
ExplodedNode *Pred) {
|
||||
bool IsNew;
|
||||
ExplodedNode* N = Eng.G->getNode(Loc, State, &IsNew);
|
||||
ExplodedNode *N = Eng.G->getNode(Loc, State, &IsNew);
|
||||
N->addPredecessor(Pred, *Eng.G);
|
||||
Deferred.erase(Pred);
|
||||
|
||||
@@ -599,11 +599,11 @@ StmtNodeBuilder::generateNodeInternal(const ProgramPoint &Loc,
|
||||
}
|
||||
|
||||
// This function generate a new ExplodedNode but not a new branch(block edge).
|
||||
ExplodedNode* BranchNodeBuilder::generateNode(const Stmt* Condition,
|
||||
const GRState* State) {
|
||||
ExplodedNode *BranchNodeBuilder::generateNode(const Stmt *Condition,
|
||||
const GRState *State) {
|
||||
bool IsNew;
|
||||
|
||||
ExplodedNode* Succ
|
||||
ExplodedNode *Succ
|
||||
= Eng.G->getNode(PostCondition(Condition, Pred->getLocationContext()), State,
|
||||
&IsNew);
|
||||
|
||||
@@ -617,7 +617,7 @@ ExplodedNode* BranchNodeBuilder::generateNode(const Stmt* Condition,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ExplodedNode* BranchNodeBuilder::generateNode(const GRState* State,
|
||||
ExplodedNode *BranchNodeBuilder::generateNode(const GRState *State,
|
||||
bool branch) {
|
||||
|
||||
// If the branch has been marked infeasible we should not generate a node.
|
||||
@@ -626,7 +626,7 @@ ExplodedNode* BranchNodeBuilder::generateNode(const GRState* State,
|
||||
|
||||
bool IsNew;
|
||||
|
||||
ExplodedNode* Succ =
|
||||
ExplodedNode *Succ =
|
||||
Eng.G->getNode(BlockEdge(Src,branch ? DstT:DstF,Pred->getLocationContext()),
|
||||
State, &IsNew);
|
||||
|
||||
@@ -655,11 +655,11 @@ BranchNodeBuilder::~BranchNodeBuilder() {
|
||||
|
||||
|
||||
ExplodedNode*
|
||||
IndirectGotoNodeBuilder::generateNode(const iterator& I, const GRState* St,
|
||||
IndirectGotoNodeBuilder::generateNode(const iterator &I, const GRState *St,
|
||||
bool isSink) {
|
||||
bool IsNew;
|
||||
|
||||
ExplodedNode* Succ = Eng.G->getNode(BlockEdge(Src, I.getBlock(),
|
||||
ExplodedNode *Succ = Eng.G->getNode(BlockEdge(Src, I.getBlock(),
|
||||
Pred->getLocationContext()), St, &IsNew);
|
||||
|
||||
Succ->addPredecessor(Pred, *Eng.G);
|
||||
@@ -679,11 +679,11 @@ IndirectGotoNodeBuilder::generateNode(const iterator& I, const GRState* St,
|
||||
|
||||
|
||||
ExplodedNode*
|
||||
SwitchNodeBuilder::generateCaseStmtNode(const iterator& I, const GRState* St){
|
||||
SwitchNodeBuilder::generateCaseStmtNode(const iterator &I, const GRState *St){
|
||||
|
||||
bool IsNew;
|
||||
|
||||
ExplodedNode* Succ = Eng.G->getNode(BlockEdge(Src, I.getBlock(),
|
||||
ExplodedNode *Succ = Eng.G->getNode(BlockEdge(Src, I.getBlock(),
|
||||
Pred->getLocationContext()), St, &IsNew);
|
||||
Succ->addPredecessor(Pred, *Eng.G);
|
||||
|
||||
@@ -697,15 +697,15 @@ SwitchNodeBuilder::generateCaseStmtNode(const iterator& I, const GRState* St){
|
||||
|
||||
|
||||
ExplodedNode*
|
||||
SwitchNodeBuilder::generateDefaultCaseNode(const GRState* St, bool isSink) {
|
||||
SwitchNodeBuilder::generateDefaultCaseNode(const GRState *St, bool isSink) {
|
||||
|
||||
// Get the block for the default case.
|
||||
assert (Src->succ_rbegin() != Src->succ_rend());
|
||||
CFGBlock* DefaultBlock = *Src->succ_rbegin();
|
||||
CFGBlock *DefaultBlock = *Src->succ_rbegin();
|
||||
|
||||
bool IsNew;
|
||||
|
||||
ExplodedNode* Succ = Eng.G->getNode(BlockEdge(Src, DefaultBlock,
|
||||
ExplodedNode *Succ = Eng.G->getNode(BlockEdge(Src, DefaultBlock,
|
||||
Pred->getLocationContext()), St, &IsNew);
|
||||
Succ->addPredecessor(Pred, *Eng.G);
|
||||
|
||||
@@ -733,13 +733,13 @@ EndOfFunctionNodeBuilder::~EndOfFunctionNodeBuilder() {
|
||||
}
|
||||
|
||||
ExplodedNode*
|
||||
EndOfFunctionNodeBuilder::generateNode(const GRState* State,
|
||||
ExplodedNode* P,
|
||||
EndOfFunctionNodeBuilder::generateNode(const GRState *State,
|
||||
ExplodedNode *P,
|
||||
const ProgramPointTag *tag) {
|
||||
hasGeneratedNode = true;
|
||||
bool IsNew;
|
||||
|
||||
ExplodedNode* Node = Eng.G->getNode(BlockEntrance(&B,
|
||||
ExplodedNode *Node = Eng.G->getNode(BlockEntrance(&B,
|
||||
Pred->getLocationContext(), tag ? tag : Tag),
|
||||
State, &IsNew);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
using namespace clang;
|
||||
using namespace ento;
|
||||
|
||||
SVal Environment::lookupExpr(const Stmt* E) const {
|
||||
SVal Environment::lookupExpr(const Stmt *E) const {
|
||||
const SVal* X = ExprBindings.lookup(E);
|
||||
if (X) {
|
||||
SVal V = *X;
|
||||
|
||||
@@ -134,11 +134,11 @@ void ExplodedGraph::reclaimRecentlyAllocatedNodes() {
|
||||
// ExplodedNode.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static inline BumpVector<ExplodedNode*>& getVector(void* P) {
|
||||
static inline BumpVector<ExplodedNode*>& getVector(void *P) {
|
||||
return *reinterpret_cast<BumpVector<ExplodedNode*>*>(P);
|
||||
}
|
||||
|
||||
void ExplodedNode::addPredecessor(ExplodedNode* V, ExplodedGraph &G) {
|
||||
void ExplodedNode::addPredecessor(ExplodedNode *V, ExplodedGraph &G) {
|
||||
assert (!V->isSink());
|
||||
Preds.addNode(V, G);
|
||||
V->Succs.addNode(this, G);
|
||||
@@ -153,12 +153,12 @@ void ExplodedNode::NodeGroup::replaceNode(ExplodedNode *node) {
|
||||
assert(getKind() == Size1);
|
||||
}
|
||||
|
||||
void ExplodedNode::NodeGroup::addNode(ExplodedNode* N, ExplodedGraph &G) {
|
||||
void ExplodedNode::NodeGroup::addNode(ExplodedNode *N, ExplodedGraph &G) {
|
||||
assert((reinterpret_cast<uintptr_t>(N) & Mask) == 0x0);
|
||||
assert(!getFlag());
|
||||
|
||||
if (getKind() == Size1) {
|
||||
if (ExplodedNode* NOld = getNode()) {
|
||||
if (ExplodedNode *NOld = getNode()) {
|
||||
BumpVectorContext &Ctx = G.getNodeAllocator();
|
||||
BumpVector<ExplodedNode*> *V =
|
||||
G.getAllocator().Allocate<BumpVector<ExplodedNode*> >();
|
||||
@@ -215,11 +215,11 @@ ExplodedNode** ExplodedNode::NodeGroup::end() const {
|
||||
}
|
||||
}
|
||||
|
||||
ExplodedNode *ExplodedGraph::getNode(const ProgramPoint& L,
|
||||
const GRState* State, bool* IsNew) {
|
||||
ExplodedNode *ExplodedGraph::getNode(const ProgramPoint &L,
|
||||
const GRState *State, bool* IsNew) {
|
||||
// Profile 'State' to determine if we already have an existing node.
|
||||
llvm::FoldingSetNodeID profile;
|
||||
void* InsertPos = 0;
|
||||
void *InsertPos = 0;
|
||||
|
||||
NodeTy::Profile(profile, L, State);
|
||||
NodeTy* V = Nodes.FindNodeOrInsertPos(profile, InsertPos);
|
||||
@@ -326,7 +326,7 @@ ExplodedGraph::TrimInternal(const ExplodedNode* const* BeginSources,
|
||||
|
||||
// ===- Pass 2 (forward DFS to construct the new graph) -===
|
||||
while (!WL2.empty()) {
|
||||
const ExplodedNode* N = WL2.back();
|
||||
const ExplodedNode *N = WL2.back();
|
||||
WL2.pop_back();
|
||||
|
||||
// Skip this node if we have already processed it.
|
||||
@@ -335,7 +335,7 @@ ExplodedGraph::TrimInternal(const ExplodedNode* const* BeginSources,
|
||||
|
||||
// Create the corresponding node in the new graph and record the mapping
|
||||
// from the old node to the new node.
|
||||
ExplodedNode* NewN = G->getNode(N->getLocation(), N->State, NULL);
|
||||
ExplodedNode *NewN = G->getNode(N->getLocation(), N->State, NULL);
|
||||
Pass2[N] = NewN;
|
||||
|
||||
// Also record the reverse mapping from the new node to the old node.
|
||||
@@ -383,7 +383,7 @@ ExplodedGraph::TrimInternal(const ExplodedNode* const* BeginSources,
|
||||
}
|
||||
|
||||
ExplodedNode*
|
||||
InterExplodedGraphMap::getMappedNode(const ExplodedNode* N) const {
|
||||
InterExplodedGraphMap::getMappedNode(const ExplodedNode *N) const {
|
||||
llvm::DenseMap<const ExplodedNode*, ExplodedNode*>::const_iterator I =
|
||||
M.find(N);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace {
|
||||
// Utility functions.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static inline Selector GetNullarySelector(const char* name, ASTContext& Ctx) {
|
||||
static inline Selector GetNullarySelector(const char* name, ASTContext &Ctx) {
|
||||
IdentifierInfo* II = &Ctx.Idents.get(name);
|
||||
return Ctx.Selectors.getSelector(0, &II);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ ExprEngine::~ExprEngine() {
|
||||
// Utility methods.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
const GRState* ExprEngine::getInitialState(const LocationContext *InitLoc) {
|
||||
const GRState *ExprEngine::getInitialState(const LocationContext *InitLoc) {
|
||||
const GRState *state = StateMgr.getInitialState(InitLoc);
|
||||
|
||||
// Preconditions.
|
||||
@@ -191,7 +191,7 @@ const GRState *ExprEngine::processAssume(const GRState *state, SVal cond,
|
||||
return TF->evalAssume(state, cond, assumption);
|
||||
}
|
||||
|
||||
bool ExprEngine::wantsRegionChangeUpdate(const GRState* state) {
|
||||
bool ExprEngine::wantsRegionChangeUpdate(const GRState *state) {
|
||||
return getCheckerManager().wantsRegionChangeUpdate(state);
|
||||
}
|
||||
|
||||
@@ -446,8 +446,8 @@ void ExprEngine::ProcessTemporaryDtor(const CFGTemporaryDtor D,
|
||||
StmtNodeBuilder &builder) {
|
||||
}
|
||||
|
||||
void ExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst) {
|
||||
PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
|
||||
S->getLocStart(),
|
||||
"Error evaluating statement");
|
||||
@@ -621,7 +621,7 @@ void ExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
|
||||
break;
|
||||
}
|
||||
else if (B->getOpcode() == BO_Comma) {
|
||||
const GRState* state = Pred->getState();
|
||||
const GRState *state = Pred->getState();
|
||||
MakeNode(Dst, B, Pred, state->BindExpr(B, state->getSVal(B->getRHS())));
|
||||
break;
|
||||
}
|
||||
@@ -668,7 +668,7 @@ void ExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
|
||||
// the CFG do not model them as explicit control-flow.
|
||||
|
||||
case Stmt::ChooseExprClass: { // __builtin_choose_expr
|
||||
const ChooseExpr* C = cast<ChooseExpr>(S);
|
||||
const ChooseExpr *C = cast<ChooseExpr>(S);
|
||||
VisitGuardedExpr(C, C->getLHS(), C->getRHS(), Pred, Dst);
|
||||
break;
|
||||
}
|
||||
@@ -711,7 +711,7 @@ void ExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
|
||||
case Stmt::CXXConstCastExprClass:
|
||||
case Stmt::CXXFunctionalCastExprClass:
|
||||
case Stmt::ObjCBridgedCastExprClass: {
|
||||
const CastExpr* C = cast<CastExpr>(S);
|
||||
const CastExpr *C = cast<CastExpr>(S);
|
||||
// Handle the previsit checks.
|
||||
ExplodedNodeSet dstPrevisit;
|
||||
getCheckerManager().runCheckersForPreStmt(dstPrevisit, Pred, C, *this);
|
||||
@@ -780,7 +780,7 @@ void ExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
|
||||
break;
|
||||
|
||||
case Stmt::StmtExprClass: {
|
||||
const StmtExpr* SE = cast<StmtExpr>(S);
|
||||
const StmtExpr *SE = cast<StmtExpr>(S);
|
||||
|
||||
if (SE->getSubStmt()->body_empty()) {
|
||||
// Empty statement expression.
|
||||
@@ -790,8 +790,8 @@ void ExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
|
||||
break;
|
||||
}
|
||||
|
||||
if (Expr* LastExpr = dyn_cast<Expr>(*SE->getSubStmt()->body_rbegin())) {
|
||||
const GRState* state = Pred->getState();
|
||||
if (Expr *LastExpr = dyn_cast<Expr>(*SE->getSubStmt()->body_rbegin())) {
|
||||
const GRState *state = Pred->getState();
|
||||
MakeNode(Dst, SE, Pred, state->BindExpr(SE, state->getSVal(LastExpr)));
|
||||
}
|
||||
else
|
||||
@@ -801,7 +801,7 @@ void ExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
|
||||
}
|
||||
|
||||
case Stmt::StringLiteralClass: {
|
||||
const GRState* state = Pred->getState();
|
||||
const GRState *state = Pred->getState();
|
||||
SVal V = state->getLValue(cast<StringLiteral>(S));
|
||||
MakeNode(Dst, S, Pred, state->BindExpr(S, V));
|
||||
return;
|
||||
@@ -844,8 +844,8 @@ void ExprEngine::processCFGBlockEntrance(ExplodedNodeSet &dstNodes,
|
||||
// Generic node creation.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ExplodedNode* ExprEngine::MakeNode(ExplodedNodeSet& Dst, const Stmt* S,
|
||||
ExplodedNode* Pred, const GRState* St,
|
||||
ExplodedNode *ExprEngine::MakeNode(ExplodedNodeSet &Dst, const Stmt *S,
|
||||
ExplodedNode *Pred, const GRState *St,
|
||||
ProgramPoint::Kind K,
|
||||
const ProgramPointTag *tag) {
|
||||
assert (Builder && "StmtNodeBuilder not present.");
|
||||
@@ -858,8 +858,8 @@ ExplodedNode* ExprEngine::MakeNode(ExplodedNodeSet& Dst, const Stmt* S,
|
||||
// Branch processing.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
const GRState* ExprEngine::MarkBranch(const GRState* state,
|
||||
const Stmt* Terminator,
|
||||
const GRState *ExprEngine::MarkBranch(const GRState *state,
|
||||
const Stmt *Terminator,
|
||||
bool branchTaken) {
|
||||
|
||||
switch (Terminator->getStmtClass()) {
|
||||
@@ -879,7 +879,7 @@ const GRState* ExprEngine::MarkBranch(const GRState* state,
|
||||
// For ||, if we take the false branch, then the value of the whole
|
||||
// expression is that of the RHS expression.
|
||||
|
||||
const Expr* Ex = (Op == BO_LAnd && branchTaken) ||
|
||||
const Expr *Ex = (Op == BO_LAnd && branchTaken) ||
|
||||
(Op == BO_LOr && !branchTaken)
|
||||
? B->getRHS() : B->getLHS();
|
||||
|
||||
@@ -894,7 +894,7 @@ const GRState* ExprEngine::MarkBranch(const GRState* state,
|
||||
// For ?, if branchTaken == true then the value is either the LHS or
|
||||
// the condition itself. (GNU extension).
|
||||
|
||||
const Expr* Ex;
|
||||
const Expr *Ex;
|
||||
|
||||
if (branchTaken)
|
||||
Ex = C->getTrueExpr();
|
||||
@@ -906,9 +906,9 @@ const GRState* ExprEngine::MarkBranch(const GRState* state,
|
||||
|
||||
case Stmt::ChooseExprClass: { // ?:
|
||||
|
||||
const ChooseExpr* C = cast<ChooseExpr>(Terminator);
|
||||
const ChooseExpr *C = cast<ChooseExpr>(Terminator);
|
||||
|
||||
const Expr* Ex = branchTaken ? C->getLHS() : C->getRHS();
|
||||
const Expr *Ex = branchTaken ? C->getLHS() : C->getRHS();
|
||||
return state->BindExpr(C, UndefinedVal(Ex));
|
||||
}
|
||||
}
|
||||
@@ -919,8 +919,8 @@ const GRState* ExprEngine::MarkBranch(const GRState* state,
|
||||
/// integers that promote their values (which are currently not tracked well).
|
||||
/// This function returns the SVal bound to Condition->IgnoreCasts if all the
|
||||
// cast(s) did was sign-extend the original value.
|
||||
static SVal RecoverCastedSymbol(GRStateManager& StateMgr, const GRState* state,
|
||||
const Stmt* Condition, ASTContext& Ctx) {
|
||||
static SVal RecoverCastedSymbol(GRStateManager& StateMgr, const GRState *state,
|
||||
const Stmt *Condition, ASTContext &Ctx) {
|
||||
|
||||
const Expr *Ex = dyn_cast<Expr>(Condition);
|
||||
if (!Ex)
|
||||
@@ -953,7 +953,7 @@ static SVal RecoverCastedSymbol(GRStateManager& StateMgr, const GRState* state,
|
||||
return state->getSVal(Ex);
|
||||
}
|
||||
|
||||
void ExprEngine::processBranch(const Stmt* Condition, const Stmt* Term,
|
||||
void ExprEngine::processBranch(const Stmt *Condition, const Stmt *Term,
|
||||
BranchNodeBuilder& builder) {
|
||||
|
||||
// Check for NULL conditions; e.g. "for(;;)"
|
||||
@@ -972,7 +972,7 @@ void ExprEngine::processBranch(const Stmt* Condition, const Stmt* Term,
|
||||
if (!builder.isFeasible(true) && !builder.isFeasible(false))
|
||||
return;
|
||||
|
||||
const GRState* PrevState = builder.getState();
|
||||
const GRState *PrevState = builder.getState();
|
||||
SVal X = PrevState->getSVal(Condition);
|
||||
|
||||
if (X.isUnknownOrUndef()) {
|
||||
@@ -1065,14 +1065,14 @@ void ExprEngine::processIndirectGoto(IndirectGotoNodeBuilder &builder) {
|
||||
}
|
||||
|
||||
|
||||
void ExprEngine::VisitGuardedExpr(const Expr* Ex, const Expr* L,
|
||||
const Expr* R,
|
||||
ExplodedNode* Pred, ExplodedNodeSet& Dst) {
|
||||
void ExprEngine::VisitGuardedExpr(const Expr *Ex, const Expr *L,
|
||||
const Expr *R,
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst) {
|
||||
|
||||
assert(Ex == currentStmt &&
|
||||
Pred->getLocationContext()->getCFG()->isBlkExpr(Ex));
|
||||
|
||||
const GRState* state = Pred->getState();
|
||||
const GRState *state = Pred->getState();
|
||||
SVal X = state->getSVal(Ex);
|
||||
|
||||
assert (X.isUndef());
|
||||
@@ -1097,8 +1097,8 @@ void ExprEngine::processEndOfFunction(EndOfFunctionNodeBuilder& builder) {
|
||||
/// nodes by processing the 'effects' of a switch statement.
|
||||
void ExprEngine::processSwitch(SwitchNodeBuilder& builder) {
|
||||
typedef SwitchNodeBuilder::iterator iterator;
|
||||
const GRState* state = builder.getState();
|
||||
const Expr* CondE = builder.getCondition();
|
||||
const GRState *state = builder.getState();
|
||||
const Expr *CondE = builder.getCondition();
|
||||
SVal CondV_untested = state->getSVal(CondE);
|
||||
|
||||
if (CondV_untested.isUndef()) {
|
||||
@@ -1120,7 +1120,7 @@ void ExprEngine::processSwitch(SwitchNodeBuilder& builder) {
|
||||
if (!I.getBlock())
|
||||
continue;
|
||||
|
||||
const CaseStmt* Case = I.getCase();
|
||||
const CaseStmt *Case = I.getCase();
|
||||
|
||||
// Evaluate the LHS of the case value.
|
||||
Expr::EvalResult V1;
|
||||
@@ -1136,7 +1136,7 @@ void ExprEngine::processSwitch(SwitchNodeBuilder& builder) {
|
||||
// Get the RHS of the case, if it exists.
|
||||
Expr::EvalResult V2;
|
||||
|
||||
if (const Expr* E = Case->getRHS()) {
|
||||
if (const Expr *E = Case->getRHS()) {
|
||||
b = E->Evaluate(V2, getContext());
|
||||
assert(b && V2.Val.isInt() && !V2.HasSideEffects
|
||||
&& "Case condition must evaluate to an integer constant.");
|
||||
@@ -1155,7 +1155,7 @@ void ExprEngine::processSwitch(SwitchNodeBuilder& builder) {
|
||||
CondV, CaseVal);
|
||||
|
||||
// Now "assume" that the case matches.
|
||||
if (const GRState* stateNew = state->assume(Res, true)) {
|
||||
if (const GRState *stateNew = state->assume(Res, true)) {
|
||||
builder.generateCaseStmtNode(I, stateNew);
|
||||
|
||||
// If CondV evaluates to a constant, then we know that this
|
||||
@@ -1246,15 +1246,15 @@ void ExprEngine::processCallExit(CallExitNodeBuilder &B) {
|
||||
// Transfer functions: logical operations ('&&', '||').
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ExprEngine::VisitLogicalExpr(const BinaryOperator* B, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
void ExprEngine::VisitLogicalExpr(const BinaryOperator* B, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst) {
|
||||
|
||||
assert(B->getOpcode() == BO_LAnd ||
|
||||
B->getOpcode() == BO_LOr);
|
||||
|
||||
assert(B==currentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(B));
|
||||
|
||||
const GRState* state = Pred->getState();
|
||||
const GRState *state = Pred->getState();
|
||||
SVal X = state->getSVal(B);
|
||||
assert(X.isUndef());
|
||||
|
||||
@@ -1321,7 +1321,7 @@ void ExprEngine::VisitCommonDeclRefExpr(const Expr *Ex, const NamedDecl *D,
|
||||
ExplodedNodeSet &Dst) {
|
||||
const GRState *state = Pred->getState();
|
||||
|
||||
if (const VarDecl* VD = dyn_cast<VarDecl>(D)) {
|
||||
if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
|
||||
assert(Ex->isLValue());
|
||||
SVal V = state->getLValue(VD, Pred->getLocationContext());
|
||||
|
||||
@@ -1338,13 +1338,13 @@ void ExprEngine::VisitCommonDeclRefExpr(const Expr *Ex, const NamedDecl *D,
|
||||
ProgramPoint::PostLValueKind);
|
||||
return;
|
||||
}
|
||||
if (const EnumConstantDecl* ED = dyn_cast<EnumConstantDecl>(D)) {
|
||||
if (const EnumConstantDecl *ED = dyn_cast<EnumConstantDecl>(D)) {
|
||||
assert(!Ex->isLValue());
|
||||
SVal V = svalBuilder.makeIntVal(ED->getInitVal());
|
||||
MakeNode(Dst, Ex, Pred, state->BindExpr(Ex, V));
|
||||
return;
|
||||
}
|
||||
if (const FunctionDecl* FD = dyn_cast<FunctionDecl>(D)) {
|
||||
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
|
||||
SVal V = svalBuilder.getFunctionPointer(FD);
|
||||
MakeNode(Dst, Ex, Pred, state->BindExpr(Ex, V),
|
||||
ProgramPoint::PostLValueKind);
|
||||
@@ -1355,12 +1355,12 @@ void ExprEngine::VisitCommonDeclRefExpr(const Expr *Ex, const NamedDecl *D,
|
||||
}
|
||||
|
||||
/// VisitArraySubscriptExpr - Transfer function for array accesses
|
||||
void ExprEngine::VisitLvalArraySubscriptExpr(const ArraySubscriptExpr* A,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst){
|
||||
void ExprEngine::VisitLvalArraySubscriptExpr(const ArraySubscriptExpr *A,
|
||||
ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst){
|
||||
|
||||
const Expr* Base = A->getBase()->IgnoreParens();
|
||||
const Expr* Idx = A->getIdx()->IgnoreParens();
|
||||
const Expr *Base = A->getBase()->IgnoreParens();
|
||||
const Expr *Idx = A->getIdx()->IgnoreParens();
|
||||
|
||||
|
||||
ExplodedNodeSet checkerPreStmt;
|
||||
@@ -1368,7 +1368,7 @@ void ExprEngine::VisitLvalArraySubscriptExpr(const ArraySubscriptExpr* A,
|
||||
|
||||
for (ExplodedNodeSet::iterator it = checkerPreStmt.begin(),
|
||||
ei = checkerPreStmt.end(); it != ei; ++it) {
|
||||
const GRState* state = (*it)->getState();
|
||||
const GRState *state = (*it)->getState();
|
||||
SVal V = state->getLValue(A->getType(), state->getSVal(Idx),
|
||||
state->getSVal(Base));
|
||||
assert(A->isLValue());
|
||||
@@ -1377,15 +1377,15 @@ void ExprEngine::VisitLvalArraySubscriptExpr(const ArraySubscriptExpr* A,
|
||||
}
|
||||
|
||||
/// VisitMemberExpr - Transfer function for member expressions.
|
||||
void ExprEngine::VisitMemberExpr(const MemberExpr* M, ExplodedNode *Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
void ExprEngine::VisitMemberExpr(const MemberExpr *M, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst) {
|
||||
|
||||
FieldDecl *field = dyn_cast<FieldDecl>(M->getMemberDecl());
|
||||
if (!field) // FIXME: skipping member expressions for non-fields
|
||||
return;
|
||||
|
||||
Expr *baseExpr = M->getBase()->IgnoreParens();
|
||||
const GRState* state = Pred->getState();
|
||||
const GRState *state = Pred->getState();
|
||||
SVal baseExprVal = state->getSVal(baseExpr);
|
||||
if (isa<nonloc::LazyCompoundVal>(baseExprVal) ||
|
||||
isa<nonloc::CompoundVal>(baseExprVal) ||
|
||||
@@ -1411,8 +1411,8 @@ void ExprEngine::VisitMemberExpr(const MemberExpr* M, ExplodedNode *Pred,
|
||||
|
||||
/// evalBind - Handle the semantics of binding a value to a specific location.
|
||||
/// This method is used by evalStore and (soon) VisitDeclStmt, and others.
|
||||
void ExprEngine::evalBind(ExplodedNodeSet& Dst, const Stmt* StoreE,
|
||||
ExplodedNode* Pred, const GRState* state,
|
||||
void ExprEngine::evalBind(ExplodedNodeSet &Dst, const Stmt *StoreE,
|
||||
ExplodedNode *Pred, const GRState *state,
|
||||
SVal location, SVal Val, bool atDeclInit) {
|
||||
|
||||
|
||||
@@ -1428,7 +1428,7 @@ void ExprEngine::evalBind(ExplodedNodeSet& Dst, const Stmt* StoreE,
|
||||
if (Pred != *I)
|
||||
state = (*I)->getState();
|
||||
|
||||
const GRState* newState = 0;
|
||||
const GRState *newState = 0;
|
||||
|
||||
if (atDeclInit) {
|
||||
const VarRegion *VR =
|
||||
@@ -1472,10 +1472,10 @@ void ExprEngine::evalBind(ExplodedNodeSet& Dst, const Stmt* StoreE,
|
||||
/// @param state The current simulation state
|
||||
/// @param location The location to store the value
|
||||
/// @param Val The value to be stored
|
||||
void ExprEngine::evalStore(ExplodedNodeSet& Dst, const Expr *AssignE,
|
||||
const Expr* LocationE,
|
||||
ExplodedNode* Pred,
|
||||
const GRState* state, SVal location, SVal Val,
|
||||
void ExprEngine::evalStore(ExplodedNodeSet &Dst, const Expr *AssignE,
|
||||
const Expr *LocationE,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *state, SVal location, SVal Val,
|
||||
const ProgramPointTag *tag) {
|
||||
|
||||
assert(Builder && "StmtNodeBuilder must be defined.");
|
||||
@@ -1507,9 +1507,9 @@ void ExprEngine::evalStore(ExplodedNodeSet& Dst, const Expr *AssignE,
|
||||
evalBind(Dst, StoreE, *NI, (*NI)->getState(), location, Val);
|
||||
}
|
||||
|
||||
void ExprEngine::evalLoad(ExplodedNodeSet& Dst, const Expr *Ex,
|
||||
ExplodedNode* Pred,
|
||||
const GRState* state, SVal location,
|
||||
void ExprEngine::evalLoad(ExplodedNodeSet &Dst, const Expr *Ex,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *state, SVal location,
|
||||
const ProgramPointTag *tag, QualType LoadTy) {
|
||||
assert(!isa<NonLoc>(location) && "location cannot be a NonLoc.");
|
||||
|
||||
@@ -1546,9 +1546,9 @@ void ExprEngine::evalLoad(ExplodedNodeSet& Dst, const Expr *Ex,
|
||||
evalLoadCommon(Dst, Ex, Pred, state, location, tag, LoadTy);
|
||||
}
|
||||
|
||||
void ExprEngine::evalLoadCommon(ExplodedNodeSet& Dst, const Expr *Ex,
|
||||
ExplodedNode* Pred,
|
||||
const GRState* state, SVal location,
|
||||
void ExprEngine::evalLoadCommon(ExplodedNodeSet &Dst, const Expr *Ex,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *state, SVal location,
|
||||
const ProgramPointTag *tag, QualType LoadTy) {
|
||||
|
||||
// Evaluate the location (checks for bad dereferences).
|
||||
@@ -1583,8 +1583,8 @@ void ExprEngine::evalLoadCommon(ExplodedNodeSet& Dst, const Expr *Ex,
|
||||
}
|
||||
|
||||
void ExprEngine::evalLocation(ExplodedNodeSet &Dst, const Stmt *S,
|
||||
ExplodedNode* Pred,
|
||||
const GRState* state, SVal location,
|
||||
ExplodedNode *Pred,
|
||||
const GRState *state, SVal location,
|
||||
const ProgramPointTag *tag, bool isLoad) {
|
||||
// Early checks for performance reason.
|
||||
if (location.isUnknown()) {
|
||||
@@ -1691,8 +1691,8 @@ bool ExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE,
|
||||
#endif
|
||||
}
|
||||
|
||||
void ExprEngine::VisitCallExpr(const CallExpr* CE, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& dst) {
|
||||
void ExprEngine::VisitCallExpr(const CallExpr *CE, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &dst) {
|
||||
// Perform the previsit of the CallExpr.
|
||||
ExplodedNodeSet dstPreVisit;
|
||||
getCheckerManager().runCheckersForPreStmt(dstPreVisit, Pred, CE, *this);
|
||||
@@ -1720,8 +1720,8 @@ void ExprEngine::VisitCallExpr(const CallExpr* CE, ExplodedNode* Pred,
|
||||
SaveOr OldHasGen(Builder.hasGeneratedNode);
|
||||
|
||||
// Dispatch to transfer function logic to handle the call itself.
|
||||
const Expr* Callee = CE->getCallee()->IgnoreParens();
|
||||
const GRState* state = Pred->getState();
|
||||
const Expr *Callee = CE->getCallee()->IgnoreParens();
|
||||
const GRState *state = Pred->getState();
|
||||
SVal L = state->getSVal(Callee);
|
||||
Eng.getTF().evalCall(Dst, Eng, Builder, CE, L, Pred);
|
||||
|
||||
@@ -1778,7 +1778,7 @@ void ExprEngine::evalEagerlyAssume(ExplodedNodeSet &Dst, ExplodedNodeSet &Src,
|
||||
continue;
|
||||
}
|
||||
|
||||
const GRState* state = Pred->getState();
|
||||
const GRState *state = Pred->getState();
|
||||
SVal V = state->getSVal(Ex);
|
||||
if (nonloc::SymExprVal *SEV = dyn_cast<nonloc::SymExprVal>(&V)) {
|
||||
// First assume that the condition is true.
|
||||
@@ -1818,9 +1818,9 @@ void ExprEngine::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S,
|
||||
// Transfer function: Objective-C ivar references.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ExprEngine::VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr* Ex,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
void ExprEngine::VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr *Ex,
|
||||
ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst) {
|
||||
|
||||
const GRState *state = Pred->getState();
|
||||
SVal baseVal = state->getSVal(Ex->getBase());
|
||||
@@ -1838,8 +1838,8 @@ void ExprEngine::VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr* Ex,
|
||||
// Transfer function: Objective-C fast enumeration 'for' statements.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ExprEngine::VisitObjCForCollectionStmt(const ObjCForCollectionStmt* S,
|
||||
ExplodedNode* Pred, ExplodedNodeSet& Dst) {
|
||||
void ExprEngine::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S,
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst) {
|
||||
|
||||
// ObjCForCollectionStmts are processed in two places. This method
|
||||
// handles the case where an ObjCForCollectionStmt* occurs as one of the
|
||||
@@ -1866,12 +1866,12 @@ void ExprEngine::VisitObjCForCollectionStmt(const ObjCForCollectionStmt* S,
|
||||
// container is empty. Thus this transfer function will by default
|
||||
// result in state splitting.
|
||||
|
||||
const Stmt* elem = S->getElement();
|
||||
const Stmt *elem = S->getElement();
|
||||
const GRState *state = Pred->getState();
|
||||
SVal elementV;
|
||||
|
||||
if (const DeclStmt* DS = dyn_cast<DeclStmt>(elem)) {
|
||||
const VarDecl* elemD = cast<VarDecl>(DS->getSingleDecl());
|
||||
if (const DeclStmt *DS = dyn_cast<DeclStmt>(elem)) {
|
||||
const VarDecl *elemD = cast<VarDecl>(DS->getSingleDecl());
|
||||
assert(elemD->getInit() == 0);
|
||||
elementV = state->getLValue(elemD, Pred->getLocationContext());
|
||||
}
|
||||
@@ -1927,7 +1927,7 @@ void ExprEngine::VisitObjCForCollectionStmt(const ObjCForCollectionStmt* S,
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ExprEngine::VisitObjCMessage(const ObjCMessage &msg,
|
||||
ExplodedNode *Pred, ExplodedNodeSet& Dst) {
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst) {
|
||||
|
||||
// Handle the previsits checks.
|
||||
ExplodedNodeSet dstPrevisit;
|
||||
@@ -1983,7 +1983,7 @@ void ExprEngine::VisitObjCMessage(const ObjCMessage &msg,
|
||||
|
||||
// Check for special instance methods.
|
||||
if (!NSExceptionII) {
|
||||
ASTContext& Ctx = getContext();
|
||||
ASTContext &Ctx = getContext();
|
||||
NSExceptionII = &Ctx.Idents.get("NSException");
|
||||
}
|
||||
|
||||
@@ -1992,7 +1992,7 @@ void ExprEngine::VisitObjCMessage(const ObjCMessage &msg,
|
||||
|
||||
// Lazily create a cache of the selectors.
|
||||
if (!NSExceptionInstanceRaiseSelectors) {
|
||||
ASTContext& Ctx = getContext();
|
||||
ASTContext &Ctx = getContext();
|
||||
NSExceptionInstanceRaiseSelectors =
|
||||
new Selector[NUM_RAISE_SELECTORS];
|
||||
SmallVector<IdentifierInfo*, NUM_RAISE_SELECTORS> II;
|
||||
@@ -2122,7 +2122,7 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
|
||||
case CK_AnyPointerToBlockPointerCast:
|
||||
case CK_ObjCObjectLValueCast: {
|
||||
// Delegate to SValBuilder to process.
|
||||
const GRState* state = Pred->getState();
|
||||
const GRState *state = Pred->getState();
|
||||
SVal V = state->getSVal(Ex);
|
||||
V = svalBuilder.evalCast(V, T, ExTy);
|
||||
state = state->BindExpr(CastE, V);
|
||||
@@ -2167,13 +2167,13 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
|
||||
}
|
||||
}
|
||||
|
||||
void ExprEngine::VisitCompoundLiteralExpr(const CompoundLiteralExpr* CL,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
const InitListExpr* ILE
|
||||
void ExprEngine::VisitCompoundLiteralExpr(const CompoundLiteralExpr *CL,
|
||||
ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst) {
|
||||
const InitListExpr *ILE
|
||||
= cast<InitListExpr>(CL->getInitializer()->IgnoreParens());
|
||||
|
||||
const GRState* state = Pred->getState();
|
||||
const GRState *state = Pred->getState();
|
||||
SVal ILV = state->getSVal(ILE);
|
||||
|
||||
const LocationContext *LC = Pred->getLocationContext();
|
||||
@@ -2187,14 +2187,14 @@ void ExprEngine::VisitCompoundLiteralExpr(const CompoundLiteralExpr* CL,
|
||||
}
|
||||
|
||||
void ExprEngine::VisitDeclStmt(const DeclStmt *DS, ExplodedNode *Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
ExplodedNodeSet &Dst) {
|
||||
|
||||
// FIXME: static variables may have an initializer, but the second
|
||||
// time a function is called those values may not be current.
|
||||
// This may need to be reflected in the CFG.
|
||||
|
||||
// Assumption: The CFG has one DeclStmt per Decl.
|
||||
const Decl* D = *DS->decl_begin();
|
||||
const Decl *D = *DS->decl_begin();
|
||||
|
||||
if (!D || !isa<VarDecl>(D))
|
||||
return;
|
||||
@@ -2244,9 +2244,9 @@ void ExprEngine::VisitDeclStmt(const DeclStmt *DS, ExplodedNode *Pred,
|
||||
}
|
||||
|
||||
void ExprEngine::VisitInitListExpr(const InitListExpr *IE, ExplodedNode *Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
ExplodedNodeSet &Dst) {
|
||||
|
||||
const GRState* state = Pred->getState();
|
||||
const GRState *state = Pred->getState();
|
||||
QualType T = getContext().getCanonicalType(IE->getType());
|
||||
unsigned NumInitElements = IE->getNumInits();
|
||||
|
||||
@@ -2283,9 +2283,9 @@ void ExprEngine::VisitInitListExpr(const InitListExpr *IE, ExplodedNode *Pred,
|
||||
|
||||
/// VisitUnaryExprOrTypeTraitExpr - Transfer function for sizeof(type).
|
||||
void ExprEngine::VisitUnaryExprOrTypeTraitExpr(
|
||||
const UnaryExprOrTypeTraitExpr* Ex,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
const UnaryExprOrTypeTraitExpr *Ex,
|
||||
ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst) {
|
||||
QualType T = Ex->getTypeOfArgument();
|
||||
|
||||
if (Ex->getKind() == UETT_SizeOf) {
|
||||
@@ -2336,8 +2336,8 @@ void ExprEngine::VisitUnaryExprOrTypeTraitExpr(
|
||||
svalBuilder.makeIntVal(amt.getQuantity(), Ex->getType())));
|
||||
}
|
||||
|
||||
void ExprEngine::VisitOffsetOfExpr(const OffsetOfExpr* OOE,
|
||||
ExplodedNode* Pred, ExplodedNodeSet& Dst) {
|
||||
void ExprEngine::VisitOffsetOfExpr(const OffsetOfExpr *OOE,
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst) {
|
||||
Expr::EvalResult Res;
|
||||
if (OOE->Evaluate(Res, getContext()) && Res.Val.isInt()) {
|
||||
const APSInt &IV = Res.Val.getInt();
|
||||
@@ -2353,8 +2353,8 @@ void ExprEngine::VisitOffsetOfExpr(const OffsetOfExpr* OOE,
|
||||
}
|
||||
|
||||
void ExprEngine::VisitUnaryOperator(const UnaryOperator* U,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst) {
|
||||
|
||||
switch (U->getOpcode()) {
|
||||
|
||||
@@ -2362,7 +2362,7 @@ void ExprEngine::VisitUnaryOperator(const UnaryOperator* U,
|
||||
break;
|
||||
|
||||
case UO_Real: {
|
||||
const Expr* Ex = U->getSubExpr()->IgnoreParens();
|
||||
const Expr *Ex = U->getSubExpr()->IgnoreParens();
|
||||
ExplodedNodeSet Tmp;
|
||||
Visit(Ex, Pred, Tmp);
|
||||
|
||||
@@ -2377,7 +2377,7 @@ void ExprEngine::VisitUnaryOperator(const UnaryOperator* U,
|
||||
|
||||
// For all other types, UO_Real is an identity operation.
|
||||
assert (U->getType() == Ex->getType());
|
||||
const GRState* state = (*I)->getState();
|
||||
const GRState *state = (*I)->getState();
|
||||
MakeNode(Dst, U, *I, state->BindExpr(U, state->getSVal(Ex)));
|
||||
}
|
||||
|
||||
@@ -2386,7 +2386,7 @@ void ExprEngine::VisitUnaryOperator(const UnaryOperator* U,
|
||||
|
||||
case UO_Imag: {
|
||||
|
||||
const Expr* Ex = U->getSubExpr()->IgnoreParens();
|
||||
const Expr *Ex = U->getSubExpr()->IgnoreParens();
|
||||
ExplodedNodeSet Tmp;
|
||||
Visit(Ex, Pred, Tmp);
|
||||
|
||||
@@ -2399,7 +2399,7 @@ void ExprEngine::VisitUnaryOperator(const UnaryOperator* U,
|
||||
}
|
||||
|
||||
// For all other types, UO_Imag returns 0.
|
||||
const GRState* state = (*I)->getState();
|
||||
const GRState *state = (*I)->getState();
|
||||
SVal X = svalBuilder.makeZeroVal(Ex->getType());
|
||||
MakeNode(Dst, U, *I, state->BindExpr(U, X));
|
||||
}
|
||||
@@ -2419,12 +2419,12 @@ void ExprEngine::VisitUnaryOperator(const UnaryOperator* U,
|
||||
// generate an extra node that just propagates the value of the
|
||||
// subexpression.
|
||||
|
||||
const Expr* Ex = U->getSubExpr()->IgnoreParens();
|
||||
const Expr *Ex = U->getSubExpr()->IgnoreParens();
|
||||
ExplodedNodeSet Tmp;
|
||||
Visit(Ex, Pred, Tmp);
|
||||
|
||||
for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
|
||||
const GRState* state = (*I)->getState();
|
||||
const GRState *state = (*I)->getState();
|
||||
MakeNode(Dst, U, *I, state->BindExpr(U, state->getSVal(Ex)));
|
||||
}
|
||||
|
||||
@@ -2435,12 +2435,12 @@ void ExprEngine::VisitUnaryOperator(const UnaryOperator* U,
|
||||
case UO_Minus:
|
||||
case UO_Not: {
|
||||
assert (!U->isLValue());
|
||||
const Expr* Ex = U->getSubExpr()->IgnoreParens();
|
||||
const Expr *Ex = U->getSubExpr()->IgnoreParens();
|
||||
ExplodedNodeSet Tmp;
|
||||
Visit(Ex, Pred, Tmp);
|
||||
|
||||
for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
|
||||
const GRState* state = (*I)->getState();
|
||||
const GRState *state = (*I)->getState();
|
||||
|
||||
// Get the value of the subexpression.
|
||||
SVal V = state->getSVal(Ex);
|
||||
@@ -2510,12 +2510,12 @@ void ExprEngine::VisitUnaryOperator(const UnaryOperator* U,
|
||||
// Handle ++ and -- (both pre- and post-increment).
|
||||
assert (U->isIncrementDecrementOp());
|
||||
ExplodedNodeSet Tmp;
|
||||
const Expr* Ex = U->getSubExpr()->IgnoreParens();
|
||||
const Expr *Ex = U->getSubExpr()->IgnoreParens();
|
||||
Visit(Ex, Pred, Tmp);
|
||||
|
||||
for (ExplodedNodeSet::iterator I = Tmp.begin(), E = Tmp.end(); I!=E; ++I) {
|
||||
|
||||
const GRState* state = (*I)->getState();
|
||||
const GRState *state = (*I)->getState();
|
||||
SVal loc = state->getSVal(Ex);
|
||||
|
||||
// Perform a load.
|
||||
@@ -2590,15 +2590,15 @@ void ExprEngine::VisitUnaryOperator(const UnaryOperator* U,
|
||||
}
|
||||
}
|
||||
|
||||
void ExprEngine::VisitAsmStmt(const AsmStmt* A, ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
void ExprEngine::VisitAsmStmt(const AsmStmt *A, ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst) {
|
||||
VisitAsmStmtHelperOutputs(A, A->begin_outputs(), A->end_outputs(), Pred, Dst);
|
||||
}
|
||||
|
||||
void ExprEngine::VisitAsmStmtHelperOutputs(const AsmStmt* A,
|
||||
void ExprEngine::VisitAsmStmtHelperOutputs(const AsmStmt *A,
|
||||
AsmStmt::const_outputs_iterator I,
|
||||
AsmStmt::const_outputs_iterator E,
|
||||
ExplodedNode* Pred, ExplodedNodeSet& Dst) {
|
||||
ExplodedNode *Pred, ExplodedNodeSet &Dst) {
|
||||
if (I == E) {
|
||||
VisitAsmStmtHelperInputs(A, A->begin_inputs(), A->end_inputs(), Pred, Dst);
|
||||
return;
|
||||
@@ -2612,11 +2612,11 @@ void ExprEngine::VisitAsmStmtHelperOutputs(const AsmStmt* A,
|
||||
VisitAsmStmtHelperOutputs(A, I, E, *NI, Dst);
|
||||
}
|
||||
|
||||
void ExprEngine::VisitAsmStmtHelperInputs(const AsmStmt* A,
|
||||
void ExprEngine::VisitAsmStmtHelperInputs(const AsmStmt *A,
|
||||
AsmStmt::const_inputs_iterator I,
|
||||
AsmStmt::const_inputs_iterator E,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst) {
|
||||
if (I == E) {
|
||||
|
||||
// We have processed both the inputs and the outputs. All of the outputs
|
||||
@@ -2626,7 +2626,7 @@ void ExprEngine::VisitAsmStmtHelperInputs(const AsmStmt* A,
|
||||
// which interprets the inline asm and stores proper results in the
|
||||
// outputs.
|
||||
|
||||
const GRState* state = Pred->getState();
|
||||
const GRState *state = Pred->getState();
|
||||
|
||||
for (AsmStmt::const_outputs_iterator OI = A->begin_outputs(),
|
||||
OE = A->end_outputs(); OI != OE; ++OI) {
|
||||
@@ -2699,11 +2699,11 @@ void ExprEngine::VisitReturnStmt(const ReturnStmt *RS, ExplodedNode *Pred,
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ExprEngine::VisitBinaryOperator(const BinaryOperator* B,
|
||||
ExplodedNode* Pred,
|
||||
ExplodedNodeSet& Dst) {
|
||||
ExplodedNode *Pred,
|
||||
ExplodedNodeSet &Dst) {
|
||||
ExplodedNodeSet Tmp1;
|
||||
Expr* LHS = B->getLHS()->IgnoreParens();
|
||||
Expr* RHS = B->getRHS()->IgnoreParens();
|
||||
Expr *LHS = B->getLHS()->IgnoreParens();
|
||||
Expr *RHS = B->getRHS()->IgnoreParens();
|
||||
|
||||
Visit(LHS, Pred, Tmp1);
|
||||
ExplodedNodeSet Tmp3;
|
||||
@@ -2861,7 +2861,7 @@ struct DOTGraphTraits<ExplodedNode*> :
|
||||
|
||||
// FIXME: Since we do not cache error nodes in ExprEngine now, this does not
|
||||
// work.
|
||||
static std::string getNodeAttributes(const ExplodedNode* N, void*) {
|
||||
static std::string getNodeAttributes(const ExplodedNode *N, void*) {
|
||||
|
||||
#if 0
|
||||
// FIXME: Replace with a general scheme to tell if the node is
|
||||
@@ -2882,7 +2882,7 @@ struct DOTGraphTraits<ExplodedNode*> :
|
||||
return "";
|
||||
}
|
||||
|
||||
static std::string getNodeLabel(const ExplodedNode* N, void*){
|
||||
static std::string getNodeLabel(const ExplodedNode *N, void*){
|
||||
|
||||
std::string sbuf;
|
||||
llvm::raw_string_ostream Out(sbuf);
|
||||
@@ -2910,7 +2910,7 @@ struct DOTGraphTraits<ExplodedNode*> :
|
||||
|
||||
default: {
|
||||
if (StmtPoint *L = dyn_cast<StmtPoint>(&Loc)) {
|
||||
const Stmt* S = L->getStmt();
|
||||
const Stmt *S = L->getStmt();
|
||||
SourceLocation SLoc = S->getLocStart();
|
||||
|
||||
Out << S->getStmtClassName() << ' ' << (void*) S << ' ';
|
||||
@@ -2958,11 +2958,11 @@ struct DOTGraphTraits<ExplodedNode*> :
|
||||
break;
|
||||
}
|
||||
|
||||
const BlockEdge& E = cast<BlockEdge>(Loc);
|
||||
const BlockEdge &E = cast<BlockEdge>(Loc);
|
||||
Out << "Edge: (B" << E.getSrc()->getBlockID() << ", B"
|
||||
<< E.getDst()->getBlockID() << ')';
|
||||
|
||||
if (const Stmt* T = E.getSrc()->getTerminator()) {
|
||||
if (const Stmt *T = E.getSrc()->getTerminator()) {
|
||||
|
||||
SourceLocation SLoc = T->getLocStart();
|
||||
|
||||
@@ -2978,15 +2978,15 @@ struct DOTGraphTraits<ExplodedNode*> :
|
||||
}
|
||||
|
||||
if (isa<SwitchStmt>(T)) {
|
||||
const Stmt* Label = E.getDst()->getLabel();
|
||||
const Stmt *Label = E.getDst()->getLabel();
|
||||
|
||||
if (Label) {
|
||||
if (const CaseStmt* C = dyn_cast<CaseStmt>(Label)) {
|
||||
if (const CaseStmt *C = dyn_cast<CaseStmt>(Label)) {
|
||||
Out << "\\lcase ";
|
||||
LangOptions LO; // FIXME.
|
||||
C->getLHS()->printPretty(Out, 0, PrintingPolicy(LO));
|
||||
|
||||
if (const Stmt* RHS = C->getRHS()) {
|
||||
if (const Stmt *RHS = C->getRHS()) {
|
||||
Out << " .. ";
|
||||
RHS->printPretty(Out, 0, PrintingPolicy(LO));
|
||||
}
|
||||
@@ -3044,7 +3044,7 @@ struct DOTGraphTraits<ExplodedNode*> :
|
||||
|
||||
#ifndef NDEBUG
|
||||
template <typename ITERATOR>
|
||||
ExplodedNode* GetGraphNode(ITERATOR I) { return *I; }
|
||||
ExplodedNode *GetGraphNode(ITERATOR I) { return *I; }
|
||||
|
||||
template <> ExplodedNode*
|
||||
GetGraphNode<llvm::DenseMap<ExplodedNode*, Expr*>::iterator>
|
||||
|
||||
@@ -35,7 +35,7 @@ GRState::GRState(GRStateManager *mgr, const Environment& env,
|
||||
stateMgr->getStoreManager().incrementReferenceCount(store);
|
||||
}
|
||||
|
||||
GRState::GRState(const GRState& RHS)
|
||||
GRState::GRState(const GRState &RHS)
|
||||
: llvm::FoldingSetNode(),
|
||||
stateMgr(RHS.stateMgr),
|
||||
Env(RHS.Env),
|
||||
@@ -61,7 +61,7 @@ GRStateManager::~GRStateManager() {
|
||||
}
|
||||
|
||||
const GRState*
|
||||
GRStateManager::removeDeadBindings(const GRState* state,
|
||||
GRStateManager::removeDeadBindings(const GRState *state,
|
||||
const StackFrameContext *LCtx,
|
||||
SymbolReaper& SymReaper) {
|
||||
|
||||
@@ -95,7 +95,7 @@ const GRState *GRStateManager::MarshalState(const GRState *state,
|
||||
return getPersistentState(State);
|
||||
}
|
||||
|
||||
const GRState *GRState::bindCompoundLiteral(const CompoundLiteralExpr* CL,
|
||||
const GRState *GRState::bindCompoundLiteral(const CompoundLiteralExpr *CL,
|
||||
const LocationContext *LC,
|
||||
SVal V) const {
|
||||
const StoreRef &newStore =
|
||||
@@ -246,7 +246,7 @@ SVal GRState::getSVal(Loc location, QualType T) const {
|
||||
return V;
|
||||
}
|
||||
|
||||
const GRState *GRState::BindExpr(const Stmt* S, SVal V, bool Invalidate) const{
|
||||
const GRState *GRState::BindExpr(const Stmt *S, SVal V, bool Invalidate) const{
|
||||
Environment NewEnv = getStateManager().EnvMgr.bindExpr(Env, S, V,
|
||||
Invalidate);
|
||||
if (NewEnv == Env)
|
||||
@@ -315,7 +315,7 @@ const GRState *GRState::assumeInBound(DefinedOrUnknownSVal Idx,
|
||||
return CM.assume(this, cast<DefinedSVal>(inBound), Assumption);
|
||||
}
|
||||
|
||||
const GRState* GRStateManager::getInitialState(const LocationContext *InitLoc) {
|
||||
const GRState *GRStateManager::getInitialState(const LocationContext *InitLoc) {
|
||||
GRState State(this,
|
||||
EnvMgr.getInitialEnvironment(),
|
||||
StoreMgr->getInitialStore(InitLoc),
|
||||
@@ -337,7 +337,7 @@ void GRStateManager::recycleUnusedStates() {
|
||||
recentlyAllocatedStates.clear();
|
||||
}
|
||||
|
||||
const GRState* GRStateManager::getPersistentStateWithGDM(
|
||||
const GRState *GRStateManager::getPersistentStateWithGDM(
|
||||
const GRState *FromState,
|
||||
const GRState *GDMState) {
|
||||
GRState NewState = *FromState;
|
||||
@@ -345,13 +345,13 @@ const GRState* GRStateManager::getPersistentStateWithGDM(
|
||||
return getPersistentState(NewState);
|
||||
}
|
||||
|
||||
const GRState* GRStateManager::getPersistentState(GRState& State) {
|
||||
const GRState *GRStateManager::getPersistentState(GRState &State) {
|
||||
|
||||
llvm::FoldingSetNodeID ID;
|
||||
State.Profile(ID);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
|
||||
if (GRState* I = StateSet.FindNodeOrInsertPos(ID, InsertPos))
|
||||
if (GRState *I = StateSet.FindNodeOrInsertPos(ID, InsertPos))
|
||||
return I;
|
||||
|
||||
GRState *newState = 0;
|
||||
@@ -368,7 +368,7 @@ const GRState* GRStateManager::getPersistentState(GRState& State) {
|
||||
return newState;
|
||||
}
|
||||
|
||||
const GRState* GRState::makeWithStore(const StoreRef &store) const {
|
||||
const GRState *GRState::makeWithStore(const StoreRef &store) const {
|
||||
GRState NewSt = *this;
|
||||
NewSt.setStore(store);
|
||||
return getStateManager().getPersistentState(NewSt);
|
||||
@@ -392,7 +392,7 @@ static bool IsEnvLoc(const Stmt *S) {
|
||||
return (bool) (((uintptr_t) S) & 0x1);
|
||||
}
|
||||
|
||||
void GRState::print(raw_ostream& Out, CFG &C, const char* nl,
|
||||
void GRState::print(raw_ostream &Out, CFG &C, const char* nl,
|
||||
const char* sep) const {
|
||||
// Print the store.
|
||||
GRStateManager &Mgr = getStateManager();
|
||||
@@ -467,7 +467,7 @@ void GRState::print(raw_ostream& Out, CFG &C, const char* nl,
|
||||
}
|
||||
}
|
||||
|
||||
void GRState::printDOT(raw_ostream& Out, CFG &C) const {
|
||||
void GRState::printDOT(raw_ostream &Out, CFG &C) const {
|
||||
print(Out, C, "\\l", "\\|");
|
||||
}
|
||||
|
||||
@@ -479,13 +479,13 @@ void GRState::printStdErr(CFG &C) const {
|
||||
// Generic Data Map.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void* const* GRState::FindGDM(void* K) const {
|
||||
void *const* GRState::FindGDM(void *K) const {
|
||||
return GDM.lookup(K);
|
||||
}
|
||||
|
||||
void*
|
||||
GRStateManager::FindGDMContext(void* K,
|
||||
void* (*CreateContext)(llvm::BumpPtrAllocator&),
|
||||
GRStateManager::FindGDMContext(void *K,
|
||||
void *(*CreateContext)(llvm::BumpPtrAllocator&),
|
||||
void (*DeleteContext)(void*)) {
|
||||
|
||||
std::pair<void*, void (*)(void*)>& p = GDMContexts[K];
|
||||
@@ -497,7 +497,7 @@ GRStateManager::FindGDMContext(void* K,
|
||||
return p.first;
|
||||
}
|
||||
|
||||
const GRState* GRStateManager::addGDM(const GRState* St, void* Key, void* Data){
|
||||
const GRState *GRStateManager::addGDM(const GRState *St, void *Key, void *Data){
|
||||
GRState::GenericDataMap M1 = St->getGDM();
|
||||
GRState::GenericDataMap M2 = GDMFactory.add(M1, Key, Data);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
return "HTMLDiagnostics";
|
||||
}
|
||||
|
||||
unsigned ProcessMacroPiece(raw_ostream& os,
|
||||
unsigned ProcessMacroPiece(raw_ostream &os,
|
||||
const PathDiagnosticMacroPiece& P,
|
||||
unsigned num);
|
||||
|
||||
@@ -504,7 +504,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
|
||||
#endif
|
||||
}
|
||||
|
||||
static void EmitAlphaCounter(raw_ostream& os, unsigned n) {
|
||||
static void EmitAlphaCounter(raw_ostream &os, unsigned n) {
|
||||
unsigned x = n % ('z' - 'a');
|
||||
n /= 'z' - 'a';
|
||||
|
||||
@@ -514,7 +514,7 @@ static void EmitAlphaCounter(raw_ostream& os, unsigned n) {
|
||||
os << char('a' + x);
|
||||
}
|
||||
|
||||
unsigned HTMLDiagnostics::ProcessMacroPiece(raw_ostream& os,
|
||||
unsigned HTMLDiagnostics::ProcessMacroPiece(raw_ostream &os,
|
||||
const PathDiagnosticMacroPiece& P,
|
||||
unsigned num) {
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ RegionTy* MemRegionManager::getRegion(const A1 a1) {
|
||||
|
||||
llvm::FoldingSetNodeID ID;
|
||||
RegionTy::ProfileRegion(ID, a1, superRegion);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
|
||||
InsertPos));
|
||||
|
||||
@@ -56,7 +56,7 @@ RegionTy* MemRegionManager::getSubRegion(const A1 a1,
|
||||
const MemRegion *superRegion) {
|
||||
llvm::FoldingSetNodeID ID;
|
||||
RegionTy::ProfileRegion(ID, a1, superRegion);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
|
||||
InsertPos));
|
||||
|
||||
@@ -77,7 +77,7 @@ RegionTy* MemRegionManager::getRegion(const A1 a1, const A2 a2) {
|
||||
|
||||
llvm::FoldingSetNodeID ID;
|
||||
RegionTy::ProfileRegion(ID, a1, a2, superRegion);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
|
||||
InsertPos));
|
||||
|
||||
@@ -96,7 +96,7 @@ RegionTy* MemRegionManager::getSubRegion(const A1 a1, const A2 a2,
|
||||
|
||||
llvm::FoldingSetNodeID ID;
|
||||
RegionTy::ProfileRegion(ID, a1, a2, superRegion);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
|
||||
InsertPos));
|
||||
|
||||
@@ -115,7 +115,7 @@ RegionTy* MemRegionManager::getSubRegion(const A1 a1, const A2 a2, const A3 a3,
|
||||
|
||||
llvm::FoldingSetNodeID ID;
|
||||
RegionTy::ProfileRegion(ID, a1, a2, a3, superRegion);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
|
||||
InsertPos));
|
||||
|
||||
@@ -178,7 +178,7 @@ const StackFrameContext *VarRegion::getStackFrame() const {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
DefinedOrUnknownSVal DeclRegion::getExtent(SValBuilder &svalBuilder) const {
|
||||
ASTContext& Ctx = svalBuilder.getContext();
|
||||
ASTContext &Ctx = svalBuilder.getContext();
|
||||
QualType T = getDesugaredValueType(Ctx);
|
||||
|
||||
if (isa<VariableArrayType>(T))
|
||||
@@ -250,7 +250,7 @@ void StringRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
|
||||
}
|
||||
|
||||
void AllocaRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
|
||||
const Expr* Ex, unsigned cnt,
|
||||
const Expr *Ex, unsigned cnt,
|
||||
const MemRegion *) {
|
||||
ID.AddInteger((unsigned) AllocaRegionKind);
|
||||
ID.AddPointer(Ex);
|
||||
@@ -266,7 +266,7 @@ void CompoundLiteralRegion::Profile(llvm::FoldingSetNodeID& ID) const {
|
||||
}
|
||||
|
||||
void CompoundLiteralRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
|
||||
const CompoundLiteralExpr* CL,
|
||||
const CompoundLiteralExpr *CL,
|
||||
const MemRegion* superRegion) {
|
||||
ID.AddInteger((unsigned) CompoundLiteralRegionKind);
|
||||
ID.AddPointer(CL);
|
||||
@@ -285,7 +285,7 @@ void CXXThisRegion::Profile(llvm::FoldingSetNodeID &ID) const {
|
||||
CXXThisRegion::ProfileRegion(ID, ThisPointerTy, superRegion);
|
||||
}
|
||||
|
||||
void DeclRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, const Decl* D,
|
||||
void DeclRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, const Decl *D,
|
||||
const MemRegion* superRegion, Kind k) {
|
||||
ID.AddInteger((unsigned) k);
|
||||
ID.AddPointer(D);
|
||||
@@ -398,27 +398,27 @@ std::string MemRegion::getString() const {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
void MemRegion::dumpToStream(raw_ostream& os) const {
|
||||
void MemRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << "<Unknown Region>";
|
||||
}
|
||||
|
||||
void AllocaRegion::dumpToStream(raw_ostream& os) const {
|
||||
void AllocaRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << "alloca{" << (void*) Ex << ',' << Cnt << '}';
|
||||
}
|
||||
|
||||
void FunctionTextRegion::dumpToStream(raw_ostream& os) const {
|
||||
void FunctionTextRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << "code{" << getDecl()->getDeclName().getAsString() << '}';
|
||||
}
|
||||
|
||||
void BlockTextRegion::dumpToStream(raw_ostream& os) const {
|
||||
void BlockTextRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << "block_code{" << (void*) this << '}';
|
||||
}
|
||||
|
||||
void BlockDataRegion::dumpToStream(raw_ostream& os) const {
|
||||
void BlockDataRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << "block_data{" << BC << '}';
|
||||
}
|
||||
|
||||
void CompoundLiteralRegion::dumpToStream(raw_ostream& os) const {
|
||||
void CompoundLiteralRegion::dumpToStream(raw_ostream &os) const {
|
||||
// FIXME: More elaborate pretty-printing.
|
||||
os << "{ " << (void*) CL << " }";
|
||||
}
|
||||
@@ -435,12 +435,12 @@ void CXXThisRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << "this";
|
||||
}
|
||||
|
||||
void ElementRegion::dumpToStream(raw_ostream& os) const {
|
||||
void ElementRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << "element{" << superRegion << ','
|
||||
<< Index << ',' << getElementType().getAsString() << '}';
|
||||
}
|
||||
|
||||
void FieldRegion::dumpToStream(raw_ostream& os) const {
|
||||
void FieldRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << superRegion << "->" << getDecl();
|
||||
}
|
||||
|
||||
@@ -448,19 +448,19 @@ void NonStaticGlobalSpaceRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << "NonStaticGlobalSpaceRegion";
|
||||
}
|
||||
|
||||
void ObjCIvarRegion::dumpToStream(raw_ostream& os) const {
|
||||
void ObjCIvarRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << "ivar{" << superRegion << ',' << getDecl() << '}';
|
||||
}
|
||||
|
||||
void StringRegion::dumpToStream(raw_ostream& os) const {
|
||||
void StringRegion::dumpToStream(raw_ostream &os) const {
|
||||
Str->printPretty(os, 0, PrintingPolicy(getContext().getLangOptions()));
|
||||
}
|
||||
|
||||
void SymbolicRegion::dumpToStream(raw_ostream& os) const {
|
||||
void SymbolicRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << "SymRegion{" << sym << '}';
|
||||
}
|
||||
|
||||
void VarRegion::dumpToStream(raw_ostream& os) const {
|
||||
void VarRegion::dumpToStream(raw_ostream &os) const {
|
||||
os << cast<VarDecl>(D);
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ void RegionRawOffset::dump() const {
|
||||
dumpToStream(llvm::errs());
|
||||
}
|
||||
|
||||
void RegionRawOffset::dumpToStream(raw_ostream& os) const {
|
||||
void RegionRawOffset::dumpToStream(raw_ostream &os) const {
|
||||
os << "raw_offset{" << getRegion() << ',' << getOffset().getQuantity() << '}';
|
||||
}
|
||||
|
||||
@@ -631,7 +631,7 @@ MemRegionManager::getBlockDataRegion(const BlockTextRegion *BC,
|
||||
}
|
||||
|
||||
const CompoundLiteralRegion*
|
||||
MemRegionManager::getCompoundLiteralRegion(const CompoundLiteralExpr* CL,
|
||||
MemRegionManager::getCompoundLiteralRegion(const CompoundLiteralExpr *CL,
|
||||
const LocationContext *LC) {
|
||||
|
||||
const MemRegion *sReg = 0;
|
||||
@@ -650,14 +650,14 @@ MemRegionManager::getCompoundLiteralRegion(const CompoundLiteralExpr* CL,
|
||||
const ElementRegion*
|
||||
MemRegionManager::getElementRegion(QualType elementType, NonLoc Idx,
|
||||
const MemRegion* superRegion,
|
||||
ASTContext& Ctx){
|
||||
ASTContext &Ctx){
|
||||
|
||||
QualType T = Ctx.getCanonicalType(elementType).getUnqualifiedType();
|
||||
|
||||
llvm::FoldingSetNodeID ID;
|
||||
ElementRegion::ProfileRegion(ID, T, Idx, superRegion);
|
||||
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
MemRegion* data = Regions.FindNodeOrInsertPos(ID, InsertPos);
|
||||
ElementRegion* R = cast_or_null<ElementRegion>(data);
|
||||
|
||||
@@ -688,13 +688,13 @@ const SymbolicRegion *MemRegionManager::getSymbolicRegion(SymbolRef sym) {
|
||||
}
|
||||
|
||||
const FieldRegion*
|
||||
MemRegionManager::getFieldRegion(const FieldDecl* d,
|
||||
MemRegionManager::getFieldRegion(const FieldDecl *d,
|
||||
const MemRegion* superRegion){
|
||||
return getSubRegion<FieldRegion>(d, superRegion);
|
||||
}
|
||||
|
||||
const ObjCIvarRegion*
|
||||
MemRegionManager::getObjCIvarRegion(const ObjCIvarDecl* d,
|
||||
MemRegionManager::getObjCIvarRegion(const ObjCIvarDecl *d,
|
||||
const MemRegion* superRegion) {
|
||||
return getSubRegion<ObjCIvarRegion>(d, superRegion);
|
||||
}
|
||||
@@ -724,7 +724,7 @@ MemRegionManager::getCXXThisRegion(QualType thisPointerTy,
|
||||
}
|
||||
|
||||
const AllocaRegion*
|
||||
MemRegionManager::getAllocaRegion(const Expr* E, unsigned cnt,
|
||||
MemRegionManager::getAllocaRegion(const Expr *E, unsigned cnt,
|
||||
const LocationContext *LC) {
|
||||
const StackFrameContext *STC = LC->getCurrentStackFrame();
|
||||
assert(STC);
|
||||
|
||||
@@ -124,12 +124,12 @@ static unsigned GetFID(const FIDMap& FIDs, const SourceManager &SM,
|
||||
return I->second;
|
||||
}
|
||||
|
||||
static raw_ostream& Indent(raw_ostream& o, const unsigned indent) {
|
||||
static raw_ostream &Indent(raw_ostream &o, const unsigned indent) {
|
||||
for (unsigned i = 0; i < indent; ++i) o << ' ';
|
||||
return o;
|
||||
}
|
||||
|
||||
static void EmitLocation(raw_ostream& o, const SourceManager &SM,
|
||||
static void EmitLocation(raw_ostream &o, const SourceManager &SM,
|
||||
const LangOptions &LangOpts,
|
||||
SourceLocation L, const FIDMap &FM,
|
||||
unsigned indent, bool extend = false) {
|
||||
@@ -150,14 +150,14 @@ static void EmitLocation(raw_ostream& o, const SourceManager &SM,
|
||||
Indent(o, indent) << "</dict>\n";
|
||||
}
|
||||
|
||||
static void EmitLocation(raw_ostream& o, const SourceManager &SM,
|
||||
static void EmitLocation(raw_ostream &o, const SourceManager &SM,
|
||||
const LangOptions &LangOpts,
|
||||
const PathDiagnosticLocation &L, const FIDMap& FM,
|
||||
unsigned indent, bool extend = false) {
|
||||
EmitLocation(o, SM, LangOpts, L.asLocation(), FM, indent, extend);
|
||||
}
|
||||
|
||||
static void EmitRange(raw_ostream& o, const SourceManager &SM,
|
||||
static void EmitRange(raw_ostream &o, const SourceManager &SM,
|
||||
const LangOptions &LangOpts,
|
||||
PathDiagnosticRange R, const FIDMap &FM,
|
||||
unsigned indent) {
|
||||
@@ -167,7 +167,7 @@ static void EmitRange(raw_ostream& o, const SourceManager &SM,
|
||||
Indent(o, indent) << "</array>\n";
|
||||
}
|
||||
|
||||
static raw_ostream& EmitString(raw_ostream& o,
|
||||
static raw_ostream &EmitString(raw_ostream &o,
|
||||
const std::string& s) {
|
||||
o << "<string>";
|
||||
for (std::string::const_iterator I=s.begin(), E=s.end(); I!=E; ++I) {
|
||||
@@ -185,7 +185,7 @@ static raw_ostream& EmitString(raw_ostream& o,
|
||||
return o;
|
||||
}
|
||||
|
||||
static void ReportControlFlow(raw_ostream& o,
|
||||
static void ReportControlFlow(raw_ostream &o,
|
||||
const PathDiagnosticControlFlowPiece& P,
|
||||
const FIDMap& FM,
|
||||
const SourceManager &SM,
|
||||
@@ -228,7 +228,7 @@ static void ReportControlFlow(raw_ostream& o,
|
||||
Indent(o, indent) << "</dict>\n";
|
||||
}
|
||||
|
||||
static void ReportEvent(raw_ostream& o, const PathDiagnosticPiece& P,
|
||||
static void ReportEvent(raw_ostream &o, const PathDiagnosticPiece& P,
|
||||
const FIDMap& FM,
|
||||
const SourceManager &SM,
|
||||
const LangOptions &LangOpts,
|
||||
@@ -275,7 +275,7 @@ static void ReportEvent(raw_ostream& o, const PathDiagnosticPiece& P,
|
||||
Indent(o, indent); o << "</dict>\n";
|
||||
}
|
||||
|
||||
static void ReportMacro(raw_ostream& o,
|
||||
static void ReportMacro(raw_ostream &o,
|
||||
const PathDiagnosticMacroPiece& P,
|
||||
const FIDMap& FM, const SourceManager &SM,
|
||||
const LangOptions &LangOpts,
|
||||
@@ -299,7 +299,7 @@ static void ReportMacro(raw_ostream& o,
|
||||
}
|
||||
}
|
||||
|
||||
static void ReportDiag(raw_ostream& o, const PathDiagnosticPiece& P,
|
||||
static void ReportDiag(raw_ostream &o, const PathDiagnosticPiece& P,
|
||||
const FIDMap& FM, const SourceManager &SM,
|
||||
const LangOptions &LangOpts) {
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace ento {
|
||||
template<>
|
||||
struct GRStateTrait<ConstraintRange>
|
||||
: public GRStatePartialTrait<ConstraintRangeTy> {
|
||||
static inline void* GDMIndex() { return &ConstraintRangeIndex; }
|
||||
static inline void *GDMIndex() { return &ConstraintRangeIndex; }
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -210,41 +210,41 @@ public:
|
||||
RangeConstraintManager(SubEngine &subengine)
|
||||
: SimpleConstraintManager(subengine) {}
|
||||
|
||||
const GRState *assumeSymNE(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymNE(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const GRState *assumeSymEQ(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymEQ(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const GRState *assumeSymLT(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymLT(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const GRState *assumeSymGT(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymGT(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const GRState *assumeSymGE(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymGE(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const GRState *assumeSymLE(const GRState* state, SymbolRef sym,
|
||||
const GRState *assumeSymLE(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment);
|
||||
|
||||
const llvm::APSInt* getSymVal(const GRState* St, SymbolRef sym) const;
|
||||
const llvm::APSInt* getSymVal(const GRState *St, SymbolRef sym) const;
|
||||
|
||||
// FIXME: Refactor into SimpleConstraintManager?
|
||||
bool isEqual(const GRState* St, SymbolRef sym, const llvm::APSInt& V) const {
|
||||
bool isEqual(const GRState *St, SymbolRef sym, const llvm::APSInt& V) const {
|
||||
const llvm::APSInt *i = getSymVal(St, sym);
|
||||
return i ? *i == V : false;
|
||||
}
|
||||
|
||||
const GRState* removeDeadBindings(const GRState* St, SymbolReaper& SymReaper);
|
||||
const GRState *removeDeadBindings(const GRState *St, SymbolReaper& SymReaper);
|
||||
|
||||
void print(const GRState* St, raw_ostream& Out,
|
||||
void print(const GRState *St, raw_ostream &Out,
|
||||
const char* nl, const char *sep);
|
||||
|
||||
private:
|
||||
@@ -258,7 +258,7 @@ ConstraintManager* ento::CreateRangeConstraintManager(GRStateManager&,
|
||||
return new RangeConstraintManager(subeng);
|
||||
}
|
||||
|
||||
const llvm::APSInt* RangeConstraintManager::getSymVal(const GRState* St,
|
||||
const llvm::APSInt* RangeConstraintManager::getSymVal(const GRState *St,
|
||||
SymbolRef sym) const {
|
||||
const ConstraintRangeTy::data_type *T = St->get<ConstraintRange>(sym);
|
||||
return T ? T->getConcreteValue() : NULL;
|
||||
@@ -267,7 +267,7 @@ const llvm::APSInt* RangeConstraintManager::getSymVal(const GRState* St,
|
||||
/// Scan all symbols referenced by the constraints. If the symbol is not alive
|
||||
/// as marked in LSymbols, mark it as dead in DSymbols.
|
||||
const GRState*
|
||||
RangeConstraintManager::removeDeadBindings(const GRState* state,
|
||||
RangeConstraintManager::removeDeadBindings(const GRState *state,
|
||||
SymbolReaper& SymReaper) {
|
||||
|
||||
ConstraintRangeTy CR = state->get<ConstraintRange>();
|
||||
@@ -307,7 +307,7 @@ RangeConstraintManager::GetRange(const GRState *state, SymbolRef sym) {
|
||||
// UINT_MAX, 0, 1, and 2.
|
||||
|
||||
const GRState*
|
||||
RangeConstraintManager::assumeSymNE(const GRState* state, SymbolRef sym,
|
||||
RangeConstraintManager::assumeSymNE(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment) {
|
||||
BasicValueFactory &BV = state->getBasicVals();
|
||||
@@ -324,7 +324,7 @@ RangeConstraintManager::assumeSymNE(const GRState* state, SymbolRef sym,
|
||||
}
|
||||
|
||||
const GRState*
|
||||
RangeConstraintManager::assumeSymEQ(const GRState* state, SymbolRef sym,
|
||||
RangeConstraintManager::assumeSymEQ(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment) {
|
||||
// [Int-Adjustment, Int-Adjustment]
|
||||
@@ -335,7 +335,7 @@ RangeConstraintManager::assumeSymEQ(const GRState* state, SymbolRef sym,
|
||||
}
|
||||
|
||||
const GRState*
|
||||
RangeConstraintManager::assumeSymLT(const GRState* state, SymbolRef sym,
|
||||
RangeConstraintManager::assumeSymLT(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment) {
|
||||
BasicValueFactory &BV = state->getBasicVals();
|
||||
@@ -356,7 +356,7 @@ RangeConstraintManager::assumeSymLT(const GRState* state, SymbolRef sym,
|
||||
}
|
||||
|
||||
const GRState*
|
||||
RangeConstraintManager::assumeSymGT(const GRState* state, SymbolRef sym,
|
||||
RangeConstraintManager::assumeSymGT(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment) {
|
||||
BasicValueFactory &BV = state->getBasicVals();
|
||||
@@ -377,7 +377,7 @@ RangeConstraintManager::assumeSymGT(const GRState* state, SymbolRef sym,
|
||||
}
|
||||
|
||||
const GRState*
|
||||
RangeConstraintManager::assumeSymGE(const GRState* state, SymbolRef sym,
|
||||
RangeConstraintManager::assumeSymGE(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment) {
|
||||
BasicValueFactory &BV = state->getBasicVals();
|
||||
@@ -399,7 +399,7 @@ RangeConstraintManager::assumeSymGE(const GRState* state, SymbolRef sym,
|
||||
}
|
||||
|
||||
const GRState*
|
||||
RangeConstraintManager::assumeSymLE(const GRState* state, SymbolRef sym,
|
||||
RangeConstraintManager::assumeSymLE(const GRState *state, SymbolRef sym,
|
||||
const llvm::APSInt& Int,
|
||||
const llvm::APSInt& Adjustment) {
|
||||
BasicValueFactory &BV = state->getBasicVals();
|
||||
@@ -424,7 +424,7 @@ RangeConstraintManager::assumeSymLE(const GRState* state, SymbolRef sym,
|
||||
// Pretty-printing.
|
||||
//===------------------------------------------------------------------------===/
|
||||
|
||||
void RangeConstraintManager::print(const GRState* St, raw_ostream& Out,
|
||||
void RangeConstraintManager::print(const GRState *St, raw_ostream &Out,
|
||||
const char* nl, const char *sep) {
|
||||
|
||||
ConstraintRangeTy Ranges = St->get<ConstraintRange>();
|
||||
|
||||
@@ -94,7 +94,7 @@ BindingKey BindingKey::Make(const MemRegion *R, Kind k) {
|
||||
|
||||
namespace llvm {
|
||||
static inline
|
||||
raw_ostream& operator<<(raw_ostream& os, BindingKey K) {
|
||||
raw_ostream &operator<<(raw_ostream &os, BindingKey K) {
|
||||
os << '(' << K.getRegion() << ',' << K.getOffset()
|
||||
<< ',' << (K.isDirect() ? "direct" : "default")
|
||||
<< ')';
|
||||
@@ -278,7 +278,7 @@ public: // Part of public interface to class.
|
||||
return StoreRef(addBinding(B, R, BindingKey::Default, V).getRootWithoutRetain(), *this);
|
||||
}
|
||||
|
||||
StoreRef BindCompoundLiteral(Store store, const CompoundLiteralExpr* CL,
|
||||
StoreRef BindCompoundLiteral(Store store, const CompoundLiteralExpr *CL,
|
||||
const LocationContext *LC, SVal V);
|
||||
|
||||
StoreRef BindDecl(Store store, const VarRegion *VR, SVal InitVal);
|
||||
@@ -395,7 +395,7 @@ public: // Part of public interface to class.
|
||||
return RegionBindings(static_cast<const RegionBindings::TreeTy*>(store));
|
||||
}
|
||||
|
||||
void print(Store store, raw_ostream& Out, const char* nl,
|
||||
void print(Store store, raw_ostream &Out, const char* nl,
|
||||
const char *sep);
|
||||
|
||||
void iterBindings(Store store, BindingsHandler& f) {
|
||||
@@ -1486,7 +1486,7 @@ StoreRef RegionStoreManager::BindStruct(Store store, const TypedValueRegion* R,
|
||||
assert(T->isStructureOrClassType());
|
||||
|
||||
const RecordType* RT = T->getAs<RecordType>();
|
||||
RecordDecl* RD = RT->getDecl();
|
||||
RecordDecl *RD = RT->getDecl();
|
||||
|
||||
if (!RD->isDefinition())
|
||||
return StoreRef(store, *this);
|
||||
@@ -1858,7 +1858,7 @@ StoreRef RegionStoreManager::enterStackFrame(const GRState *state,
|
||||
// Utility methods.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void RegionStoreManager::print(Store store, raw_ostream& OS,
|
||||
void RegionStoreManager::print(Store store, raw_ostream &OS,
|
||||
const char* nl, const char *sep) {
|
||||
RegionBindings B = GetRegionBindings(store);
|
||||
OS << "Store (direct and default bindings):" << nl;
|
||||
|
||||
@@ -147,7 +147,7 @@ SValBuilder::getDerivedRegionValueSymbolVal(SymbolRef parentSymbol,
|
||||
return nonloc::SymbolVal(sym);
|
||||
}
|
||||
|
||||
DefinedSVal SValBuilder::getFunctionPointer(const FunctionDecl* func) {
|
||||
DefinedSVal SValBuilder::getFunctionPointer(const FunctionDecl *func) {
|
||||
return loc::MemRegionVal(MemMgr.getFunctionTextRegion(func));
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ SVal::symbol_iterator::symbol_iterator(const SymExpr *SE) {
|
||||
while (!isa<SymbolData>(itr.back())) expand();
|
||||
}
|
||||
|
||||
SVal::symbol_iterator& SVal::symbol_iterator::operator++() {
|
||||
SVal::symbol_iterator &SVal::symbol_iterator::operator++() {
|
||||
assert(!itr.empty() && "attempting to iterate on an 'end' iterator");
|
||||
assert(isa<SymbolData>(itr.back()));
|
||||
itr.pop_back();
|
||||
@@ -267,7 +267,7 @@ SVal loc::ConcreteInt::evalBinOp(BasicValueFactory& BasicVals,
|
||||
|
||||
void SVal::dump() const { dumpToStream(llvm::errs()); }
|
||||
|
||||
void SVal::dumpToStream(raw_ostream& os) const {
|
||||
void SVal::dumpToStream(raw_ostream &os) const {
|
||||
switch (getBaseKind()) {
|
||||
case UnknownKind:
|
||||
os << "Unknown";
|
||||
@@ -286,7 +286,7 @@ void SVal::dumpToStream(raw_ostream& os) const {
|
||||
}
|
||||
}
|
||||
|
||||
void NonLoc::dumpToStream(raw_ostream& os) const {
|
||||
void NonLoc::dumpToStream(raw_ostream &os) const {
|
||||
switch (getSubKind()) {
|
||||
case nonloc::ConcreteIntKind: {
|
||||
const nonloc::ConcreteInt& C = *cast<nonloc::ConcreteInt>(this);
|
||||
@@ -341,7 +341,7 @@ void NonLoc::dumpToStream(raw_ostream& os) const {
|
||||
}
|
||||
}
|
||||
|
||||
void Loc::dumpToStream(raw_ostream& os) const {
|
||||
void Loc::dumpToStream(raw_ostream &os) const {
|
||||
switch (getSubKind()) {
|
||||
case loc::ConcreteIntKind:
|
||||
os << cast<loc::ConcreteInt>(this)->getValue().getZExtValue() << " (Loc)";
|
||||
|
||||
@@ -57,7 +57,7 @@ const ElementRegion *StoreManager::GetElementZeroRegion(const MemRegion *R,
|
||||
|
||||
const MemRegion *StoreManager::castRegion(const MemRegion *R, QualType CastToTy) {
|
||||
|
||||
ASTContext& Ctx = StateMgr.getContext();
|
||||
ASTContext &Ctx = StateMgr.getContext();
|
||||
|
||||
// Handle casts to Objective-C objects.
|
||||
if (CastToTy->isObjCObjectPointerType())
|
||||
@@ -237,7 +237,7 @@ SVal StoreManager::CastRetrievedVal(SVal V, const TypedValueRegion *R,
|
||||
return V;
|
||||
}
|
||||
|
||||
SVal StoreManager::getLValueFieldOrIvar(const Decl* D, SVal Base) {
|
||||
SVal StoreManager::getLValueFieldOrIvar(const Decl *D, SVal Base) {
|
||||
if (Base.isUnknownOrUndef())
|
||||
return Base;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ void SymExpr::dump() const {
|
||||
dumpToStream(llvm::errs());
|
||||
}
|
||||
|
||||
static void print(raw_ostream& os, BinaryOperator::Opcode Op) {
|
||||
static void print(raw_ostream &os, BinaryOperator::Opcode Op) {
|
||||
switch (Op) {
|
||||
default:
|
||||
assert(false && "operator printing not implemented");
|
||||
@@ -49,7 +49,7 @@ static void print(raw_ostream& os, BinaryOperator::Opcode Op) {
|
||||
}
|
||||
}
|
||||
|
||||
void SymIntExpr::dumpToStream(raw_ostream& os) const {
|
||||
void SymIntExpr::dumpToStream(raw_ostream &os) const {
|
||||
os << '(';
|
||||
getLHS()->dumpToStream(os);
|
||||
os << ") ";
|
||||
@@ -58,7 +58,7 @@ void SymIntExpr::dumpToStream(raw_ostream& os) const {
|
||||
if (getRHS().isUnsigned()) os << 'U';
|
||||
}
|
||||
|
||||
void SymSymExpr::dumpToStream(raw_ostream& os) const {
|
||||
void SymSymExpr::dumpToStream(raw_ostream &os) const {
|
||||
os << '(';
|
||||
getLHS()->dumpToStream(os);
|
||||
os << ") ";
|
||||
@@ -67,25 +67,25 @@ void SymSymExpr::dumpToStream(raw_ostream& os) const {
|
||||
os << ')';
|
||||
}
|
||||
|
||||
void SymbolConjured::dumpToStream(raw_ostream& os) const {
|
||||
void SymbolConjured::dumpToStream(raw_ostream &os) const {
|
||||
os << "conj_$" << getSymbolID() << '{' << T.getAsString() << '}';
|
||||
}
|
||||
|
||||
void SymbolDerived::dumpToStream(raw_ostream& os) const {
|
||||
void SymbolDerived::dumpToStream(raw_ostream &os) const {
|
||||
os << "derived_$" << getSymbolID() << '{'
|
||||
<< getParentSymbol() << ',' << getRegion() << '}';
|
||||
}
|
||||
|
||||
void SymbolExtent::dumpToStream(raw_ostream& os) const {
|
||||
void SymbolExtent::dumpToStream(raw_ostream &os) const {
|
||||
os << "extent_$" << getSymbolID() << '{' << getRegion() << '}';
|
||||
}
|
||||
|
||||
void SymbolMetadata::dumpToStream(raw_ostream& os) const {
|
||||
void SymbolMetadata::dumpToStream(raw_ostream &os) const {
|
||||
os << "meta_$" << getSymbolID() << '{'
|
||||
<< getRegion() << ',' << T.getAsString() << '}';
|
||||
}
|
||||
|
||||
void SymbolRegionValue::dumpToStream(raw_ostream& os) const {
|
||||
void SymbolRegionValue::dumpToStream(raw_ostream &os) const {
|
||||
os << "reg_$" << getSymbolID() << "<" << R << ">";
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ const SymbolRegionValue*
|
||||
SymbolManager::getRegionValueSymbol(const TypedValueRegion* R) {
|
||||
llvm::FoldingSetNodeID profile;
|
||||
SymbolRegionValue::Profile(profile, R);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
|
||||
if (!SD) {
|
||||
SD = (SymExpr*) BPAlloc.Allocate<SymbolRegionValue>();
|
||||
@@ -106,12 +106,12 @@ SymbolManager::getRegionValueSymbol(const TypedValueRegion* R) {
|
||||
}
|
||||
|
||||
const SymbolConjured*
|
||||
SymbolManager::getConjuredSymbol(const Stmt* E, QualType T, unsigned Count,
|
||||
const void* SymbolTag) {
|
||||
SymbolManager::getConjuredSymbol(const Stmt *E, QualType T, unsigned Count,
|
||||
const void *SymbolTag) {
|
||||
|
||||
llvm::FoldingSetNodeID profile;
|
||||
SymbolConjured::Profile(profile, E, T, Count, SymbolTag);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
|
||||
if (!SD) {
|
||||
SD = (SymExpr*) BPAlloc.Allocate<SymbolConjured>();
|
||||
@@ -129,7 +129,7 @@ SymbolManager::getDerivedSymbol(SymbolRef parentSymbol,
|
||||
|
||||
llvm::FoldingSetNodeID profile;
|
||||
SymbolDerived::Profile(profile, parentSymbol, R);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
|
||||
if (!SD) {
|
||||
SD = (SymExpr*) BPAlloc.Allocate<SymbolDerived>();
|
||||
@@ -145,7 +145,7 @@ const SymbolExtent*
|
||||
SymbolManager::getExtentSymbol(const SubRegion *R) {
|
||||
llvm::FoldingSetNodeID profile;
|
||||
SymbolExtent::Profile(profile, R);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
|
||||
if (!SD) {
|
||||
SD = (SymExpr*) BPAlloc.Allocate<SymbolExtent>();
|
||||
@@ -158,12 +158,12 @@ SymbolManager::getExtentSymbol(const SubRegion *R) {
|
||||
}
|
||||
|
||||
const SymbolMetadata*
|
||||
SymbolManager::getMetadataSymbol(const MemRegion* R, const Stmt* S, QualType T,
|
||||
unsigned Count, const void* SymbolTag) {
|
||||
SymbolManager::getMetadataSymbol(const MemRegion* R, const Stmt *S, QualType T,
|
||||
unsigned Count, const void *SymbolTag) {
|
||||
|
||||
llvm::FoldingSetNodeID profile;
|
||||
SymbolMetadata::Profile(profile, R, S, T, Count, SymbolTag);
|
||||
void* InsertPos;
|
||||
void *InsertPos;
|
||||
SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
|
||||
if (!SD) {
|
||||
SD = (SymExpr*) BPAlloc.Allocate<SymbolMetadata>();
|
||||
@@ -215,11 +215,11 @@ QualType SymbolConjured::getType(ASTContext&) const {
|
||||
return T;
|
||||
}
|
||||
|
||||
QualType SymbolDerived::getType(ASTContext& Ctx) const {
|
||||
QualType SymbolDerived::getType(ASTContext &Ctx) const {
|
||||
return R->getValueType();
|
||||
}
|
||||
|
||||
QualType SymbolExtent::getType(ASTContext& Ctx) const {
|
||||
QualType SymbolExtent::getType(ASTContext &Ctx) const {
|
||||
return Ctx.getSizeType();
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ QualType SymbolMetadata::getType(ASTContext&) const {
|
||||
return T;
|
||||
}
|
||||
|
||||
QualType SymbolRegionValue::getType(ASTContext& C) const {
|
||||
QualType SymbolRegionValue::getType(ASTContext &C) const {
|
||||
return R->getValueType();
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ bool SymbolReaper::isLive(SymbolRef sym) {
|
||||
return isa<SymbolRegionValue>(sym);
|
||||
}
|
||||
|
||||
bool SymbolReaper::isLive(const Stmt* ExprVal) const {
|
||||
bool SymbolReaper::isLive(const Stmt *ExprVal) const {
|
||||
return LCtx->getAnalysisContext()->getRelaxedLiveVariables()->
|
||||
isLive(Loc, ExprVal);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace {
|
||||
|
||||
class AnalysisConsumer : public ASTConsumer {
|
||||
public:
|
||||
ASTContext* Ctx;
|
||||
ASTContext *Ctx;
|
||||
const Preprocessor &PP;
|
||||
const std::string OutDir;
|
||||
AnalyzerOptions Opts;
|
||||
@@ -187,7 +187,7 @@ void AnalysisConsumer::HandleDeclContext(ASTContext &C, DeclContext *dc) {
|
||||
case Decl::CXXConversion:
|
||||
case Decl::CXXMethod:
|
||||
case Decl::Function: {
|
||||
FunctionDecl* FD = cast<FunctionDecl>(D);
|
||||
FunctionDecl *FD = cast<FunctionDecl>(D);
|
||||
// We skip function template definitions, as their semantics is
|
||||
// only determined when they are instantiated.
|
||||
if (FD->isThisDeclarationADefinition() &&
|
||||
@@ -203,7 +203,7 @@ void AnalysisConsumer::HandleDeclContext(ASTContext &C, DeclContext *dc) {
|
||||
|
||||
case Decl::ObjCCategoryImpl:
|
||||
case Decl::ObjCImplementation: {
|
||||
ObjCImplDecl* ID = cast<ObjCImplDecl>(*I);
|
||||
ObjCImplDecl *ID = cast<ObjCImplDecl>(*I);
|
||||
HandleCode(ID);
|
||||
|
||||
for (ObjCContainerDecl::method_iterator MI = ID->meth_begin(),
|
||||
@@ -391,12 +391,12 @@ class UbigraphViz : public ExplodedNode::Auditor {
|
||||
VMap M;
|
||||
|
||||
public:
|
||||
UbigraphViz(raw_ostream* out, llvm::sys::Path& dir,
|
||||
UbigraphViz(raw_ostream *out, llvm::sys::Path& dir,
|
||||
llvm::sys::Path& filename);
|
||||
|
||||
~UbigraphViz();
|
||||
|
||||
virtual void AddEdge(ExplodedNode* Src, ExplodedNode* Dst);
|
||||
virtual void AddEdge(ExplodedNode *Src, ExplodedNode *Dst);
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
@@ -426,7 +426,7 @@ static ExplodedNode::Auditor* CreateUbiViz() {
|
||||
return new UbigraphViz(Stream.take(), Dir, Filename);
|
||||
}
|
||||
|
||||
void UbigraphViz::AddEdge(ExplodedNode* Src, ExplodedNode* Dst) {
|
||||
void UbigraphViz::AddEdge(ExplodedNode *Src, ExplodedNode *Dst) {
|
||||
|
||||
assert (Src != Dst && "Self-edges are not allowed.");
|
||||
|
||||
@@ -460,7 +460,7 @@ void UbigraphViz::AddEdge(ExplodedNode* Src, ExplodedNode* Dst) {
|
||||
<< ", ('arrow','true'), ('oriented', 'true'))\n";
|
||||
}
|
||||
|
||||
UbigraphViz::UbigraphViz(raw_ostream* out, llvm::sys::Path& dir,
|
||||
UbigraphViz::UbigraphViz(raw_ostream *out, llvm::sys::Path& dir,
|
||||
llvm::sys::Path& filename)
|
||||
: Out(out), Dir(dir), Filename(filename), Cntr(0) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user