From: Ted Kremenek Date: Fri, 12 Aug 2011 23:37:29 +0000 (+0000) Subject: Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer and libSt... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c378f705405d37f49795d5e915989de774fe11f;p=clang Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137537 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/Analyses/LiveVariables.h b/include/clang/Analysis/Analyses/LiveVariables.h index 6a1bae03be..f5d6e51e8a 100644 --- a/include/clang/Analysis/Analyses/LiveVariables.h +++ b/include/clang/Analysis/Analyses/LiveVariables.h @@ -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. diff --git a/include/clang/Analysis/AnalysisContext.h b/include/clang/Analysis/AnalysisContext.h index 0d4446f8ed..e3d2c8df35 100644 --- a/include/clang/Analysis/AnalysisContext.h +++ b/include/clang/Analysis/AnalysisContext.h @@ -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; } }; diff --git a/include/clang/Analysis/CFG.h b/include/clang/Analysis/CFG.h index 2f6c4b3640..f995dab7a4 100644 --- a/include/clang/Analysis/CFG.h +++ b/include/clang/Analysis/CFG.h @@ -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(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 reverse_iterator; typedef std::reverse_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(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 > { // 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 - : public GraphTraits { + : public GraphTraits { typedef ::clang::CFG::const_iterator nodes_iterator; diff --git a/include/clang/Analysis/FlowSensitive/DataflowSolver.h b/include/clang/Analysis/FlowSensitive/DataflowSolver.h index c2e06b097d..017da636eb 100644 --- a/include/clang/Analysis/FlowSensitive/DataflowSolver.h +++ b/include/clang/Analysis/FlowSensitive/DataflowSolver.h @@ -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 { 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 { 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(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(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(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); diff --git a/include/clang/Analysis/FlowSensitive/DataflowValues.h b/include/clang/Analysis/FlowSensitive/DataflowValues.h index 7aa15c5b40..f86b2b0bfe 100644 --- a/include/clang/Analysis/FlowSensitive/DataflowValues.h +++ b/include/clang/Analysis/FlowSensitive/DataflowValues.h @@ -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(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(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(this)->getStmtData(S); } diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h index 71e27c6df0..e9cc208221 100644 --- a/include/clang/Analysis/ProgramPoint.h +++ b/include/clang/Analysis/ProgramPoint.h @@ -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(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(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(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* TaggedData,\ const LocationContext *L) : PostStmt(S, TaggedData, PostStmtCustomKind, L) {} @@ -219,9 +219,9 @@ public: *reinterpret_cast*>(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(getData1()); } - const CFGBlock* getDst() const { + const CFGBlock *getDst() const { return static_cast(getData2()); } @@ -420,12 +420,12 @@ static inline clang::ProgramPoint getTombstoneKey() { return clang::BlockEntrance(reinterpret_cast(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; } diff --git a/include/clang/Analysis/Support/BlkExprDeclBitVector.h b/include/clang/Analysis/Support/BlkExprDeclBitVector.h index 27ecc66e66..d25b84833c 100644 --- a/include/clang/Analysis/Support/BlkExprDeclBitVector.h +++ b/include/clang/Analysis/Support/BlkExprDeclBitVector.h @@ -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(*this)(S,AD); } diff --git a/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h b/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h index 95f4ace76e..9d7f8107db 100644 --- a/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h +++ b/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h @@ -28,8 +28,8 @@ static_cast(this)->Visit##CLASS##Decl( \ static_cast(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(this)->VisitVarDecl(D); } @@ -38,23 +38,23 @@ template class CFGRecStmtDeclVisitor : public CFGRecStmtVisitor { public: - void VisitDeclRefExpr(DeclRefExpr* DR) { + void VisitDeclRefExpr(DeclRefExpr *DR) { static_cast(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(this)->VisitDecl(D); // Visit the initializer. - if (VarDecl* VD = dyn_cast(D)) - if (Expr* I = VD->getInit()) + if (VarDecl *VD = dyn_cast(D)) + if (Expr *I = VD->getInit()) static_cast(this)->Visit(I); } } - void VisitDecl(Decl* D) { + void VisitDecl(Decl *D) { switch (D->getKind()) { DISPATCH_CASE(Function) DISPATCH_CASE(CXXMethod) diff --git a/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h b/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h index bb7cf0b97e..55212b463e 100644 --- a/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h +++ b/include/clang/Analysis/Visitors/CFGRecStmtVisitor.h @@ -22,7 +22,7 @@ template class CFGRecStmtVisitor : public CFGStmtVisitor { 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(this)->BlockStmt_Visit(S);} + void operator()(Stmt *S) { static_cast(this)->BlockStmt_Visit(S);} }; } // end namespace clang diff --git a/include/clang/Analysis/Visitors/CFGStmtVisitor.h b/include/clang/Analysis/Visitors/CFGStmtVisitor.h index 7fb4ab3eba..b354ba7b16 100644 --- a/include/clang/Analysis/Visitors/CFGStmtVisitor.h +++ b/include/clang/Analysis/Visitors/CFGStmtVisitor.h @@ -33,7 +33,7 @@ static_cast(this)->BlockStmt_Visit ## CLASS(static_cast(S)); template class CFGStmtVisitor : public StmtVisitor { - Stmt* CurrentBlkStmt; + Stmt *CurrentBlkStmt; struct NullifyStmt { Stmt*& S; @@ -45,9 +45,9 @@ class CFGStmtVisitor : public StmtVisitor { 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(this)->getCFG().isBlkExpr(S)) return StmtVisitor::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(this)->BlockStmt_VisitStmt(S); } - RetTy BlockStmt_VisitCXXForRangeStmt(CXXForRangeStmt* S) { + RetTy BlockStmt_VisitCXXForRangeStmt(CXXForRangeStmt *S) { return static_cast(this)->BlockStmt_VisitStmt(S); } - RetTy BlockStmt_VisitImplicitControlFlowExpr(Expr* E) { + RetTy BlockStmt_VisitImplicitControlFlowExpr(Expr *E) { return static_cast(this)->BlockStmt_VisitExpr(E); } - RetTy BlockStmt_VisitExpr(Expr* E) { + RetTy BlockStmt_VisitExpr(Expr *E) { return static_cast(this)->BlockStmt_VisitStmt(E); } - RetTy BlockStmt_VisitStmt(Stmt* S) { + RetTy BlockStmt_VisitStmt(Stmt *S) { return static_cast(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(S)->getSubStmt(); + CompoundStmt *CS = cast(S)->getSubStmt(); if (CS->body_empty()) return; static_cast(this)->Visit(CS->body_back()); return; diff --git a/include/clang/StaticAnalyzer/Checkers/LocalCheckers.h b/include/clang/StaticAnalyzer/Checkers/LocalCheckers.h index 2a3d43e223..7b098ce130 100644 --- a/include/clang/StaticAnalyzer/Checkers/LocalCheckers.h +++ b/include/clang/StaticAnalyzer/Checkers/LocalCheckers.h @@ -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); diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h index 3a9f0266fe..382b5a0baf 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -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 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::iterator impl; public: iterator(std::list::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::const_iterator impl; public: const_iterator(std::list::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); diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h index 44cfbefd41..bfac65bec1 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -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::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 reverse_iterator; diff --git a/include/clang/StaticAnalyzer/Core/CheckerManager.h b/include/clang/StaticAnalyzer/Core/CheckerManager.h index 42e6bd1b18..2faf10dfd5 100644 --- a/include/clang/StaticAnalyzer/Core/CheckerManager.h +++ b/include/clang/StaticAnalyzer/Core/CheckerManager.h @@ -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); diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h b/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h index 002d9605e3..b32215b5eb 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h @@ -68,25 +68,25 @@ class BasicValueFactory { typedef llvm::FoldingSet > APSIntSetTy; - ASTContext& Ctx; + ASTContext &Ctx; llvm::BumpPtrAllocator& BPAlloc; APSIntSetTy APSIntSet; - void* PersistentSVals; - void* PersistentSValPairs; + void * PersistentSVals; + void * PersistentSValPairs; llvm::ImmutableList::Factory SValListFactory; llvm::FoldingSet CompoundValDataSet; llvm::FoldingSet 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); diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h b/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h index 7d0fdfb5f1..09c3147cb0 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h @@ -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(); diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index 4b3df1262e..a4e99ff7d0 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h @@ -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) diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h index 8757b79139..77b09d3021 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h @@ -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) {} diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h index 31e862fdd0..3caa5290bf 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h @@ -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 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(); 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 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((*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((*I)->getLabel()); } - const CFGBlock* getBlock() const { + const CFGBlock *getBlock() const { return *I; } }; @@ -400,14 +400,14 @@ public: return llvm::cast(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(); } }; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h b/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h index 2a3960236c..66d82fec98 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h @@ -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 diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h index 41c0a6639f..d492a87c25 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h @@ -67,7 +67,7 @@ class ExplodedNode : public llvm::FoldingSetNode { return P & 0x1; } - void* getPtr() const { + void *getPtr() const { assert (!getFlag()); return reinterpret_cast(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(State)->incrementReferenceCount(); } @@ -142,13 +142,13 @@ public: return *getLocationContext()->getLiveVariables(); } - const GRState* getState() const { return State; } + const GRState *getState() const { return State; } template const T* getLocationAs() const { return llvm::dyn_cast(&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(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(N)->isSink()); Impl.insert(N); } ExplodedNodeSet() {} - inline void Add(ExplodedNode* N) { + inline void Add(ExplodedNode *N) { if (N && !static_cast(N)->isSink()) Impl.insert(N); } - ExplodedNodeSet& operator=(const ExplodedNodeSet &X) { + ExplodedNodeSet &operator=(const ExplodedNodeSet &X) { Impl = X.Impl; return *this; } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h index 5649f71b86..bb863c8bfc 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h @@ -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); diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngineBuilders.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngineBuilders.h index 18e39d999b..d3c203118e 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngineBuilders.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngineBuilders.h @@ -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 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), Pred, state); } }; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/GRState.h b/include/clang/StaticAnalyzer/Core/PathSensitive/GRState.h index 7571605193..69272ec80e 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/GRState.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/GRState.h @@ -47,9 +47,9 @@ template struct GRStatePartialTrait; template 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 const GRState *add(typename GRStateTrait::key_type K) const; @@ -307,7 +307,7 @@ public: template typename GRStateTrait::lookup_type get(typename GRStateTrait::key_type key) const { - void* const* d = FindGDM(GRStateTrait::GDMIndex()); + void *const* d = FindGDM(GRStateTrait::GDMIndex()); return GRStateTrait::Lookup(GRStateTrait::MakeData(d), key); } @@ -338,7 +338,7 @@ public: template bool contains(typename GRStateTrait::key_type key) const { - void* const* d = FindGDM(GRStateTrait::GDMIndex()); + void *const* d = FindGDM(GRStateTrait::GDMIndex()); return GRStateTrait::Contains(GRStateTrait::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 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 - const GRState* set(const GRState* st, typename GRStateTrait::data_type D) { + const GRState *set(const GRState *st, typename GRStateTrait::data_type D) { return addGDM(st, GRStateTrait::GDMIndex(), GRStateTrait::MakeVoidPtr(D)); } template - const GRState* set(const GRState* st, + const GRState *set(const GRState *st, typename GRStateTrait::key_type K, typename GRStateTrait::value_type V, typename GRStateTrait::context_type C) { @@ -591,7 +591,7 @@ public: } template - const GRState* add(const GRState* st, + const GRState *add(const GRState *st, typename GRStateTrait::key_type K, typename GRStateTrait::context_type C) { return addGDM(st, GRStateTrait::GDMIndex(), @@ -599,7 +599,7 @@ public: } template - const GRState* remove(const GRState* st, + const GRState *remove(const GRState *st, typename GRStateTrait::key_type K, typename GRStateTrait::context_type C) { @@ -612,24 +612,24 @@ public: return removeGDM(st, GRStateTrait::GDMIndex()); } - void* FindGDMContext(void* index, - void* (*CreateContext)(llvm::BumpPtrAllocator&), + void *FindGDMContext(void *index, + void *(*CreateContext)(llvm::BumpPtrAllocator&), void (*DeleteContext)(void*)); template typename GRStateTrait::context_type get_context() { - void* p = FindGDMContext(GRStateTrait::GDMIndex(), + void *p = FindGDMContext(GRStateTrait::GDMIndex(), GRStateTrait::CreateContext, GRStateTrait::DeleteContext); return GRStateTrait::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(LV) ? this : bindLoc(cast(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); } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h b/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h index de7b868406..c84609a732 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h @@ -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*) *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 { 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 { 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(); } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h b/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h index 973a1ee41a..1e26a1fcfe 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h @@ -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(D); } + const FieldDecl *getDecl() const { return cast(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(D); } + const ObjCIvarDecl *getDecl() const { return cast(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; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h index 20b86a8161..a5610337ab 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h @@ -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); } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h index 5b72ca6742..a30b537e36 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h @@ -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 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 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(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; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h b/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h index dc1049856b..34a7af4852 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h @@ -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); }; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h b/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h index 7be138588d..d5ba003a69 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h @@ -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; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h index 1f6ea3d8c7..821a0fa392 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h @@ -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); } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h index 1ed16ac311..8efac66d1f 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h @@ -84,7 +84,7 @@ public: SymbolID getSymbolID() const { return Sym; } // Implement isa 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 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 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 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 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 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 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 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; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/TransferFuncs.h b/include/clang/StaticAnalyzer/Core/PathSensitive/TransferFuncs.h index 23ed2be8c7..e0e573cfd0 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/TransferFuncs.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/TransferFuncs.h @@ -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; } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h b/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h index 6bc9fe56f8..fa340753e5 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h @@ -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), diff --git a/lib/Analysis/AnalysisContext.cpp b/lib/Analysis/AnalysisContext.cpp index 5a85899389..7078e799b6 100644 --- a/lib/Analysis/AnalysisContext.cpp +++ b/lib/Analysis/AnalysisContext.cpp @@ -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); diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index 1edb328d01..31a2931e1c 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -29,9 +29,9 @@ using namespace clang; namespace { -static SourceLocation GetEndLoc(Decl* D) { - if (VarDecl* VD = dyn_cast(D)) - if (Expr* Ex = VD->getInit()) +static SourceLocation GetEndLoc(Decl *D) { + if (VarDecl *VD = dyn_cast(D)) + if (Expr *Ex = VD->getInit()) return Ex->getSourceRange().getEnd(); return D->getLocation(); } @@ -121,16 +121,16 @@ public: *this = Scope->Prev; } - VarDecl* const* operator->() const { + VarDecl *const* operator->() const { assert (Scope && "Dereferencing invalid iterator is not allowed"); assert (VarIter != 0 && "Iterator has invalid value of VarIter member"); return &Scope->Vars[VarIter - 1]; } - VarDecl* operator*() const { + VarDecl *operator*() const { return *this->operator->(); } - const_iterator& operator++() { + const_iterator &operator++() { if (!Scope) return *this; @@ -146,10 +146,10 @@ public: return P; } - bool operator==(const const_iterator& rhs) const { + bool operator==(const const_iterator &rhs) const { return Scope == rhs.Scope && VarIter == rhs.VarIter; } - bool operator!=(const const_iterator& rhs) const { + bool operator!=(const const_iterator &rhs) const { return !(*this == rhs); } @@ -179,7 +179,7 @@ public: /// Begin of scope in direction of CFG building (backwards). const_iterator begin() const { return const_iterator(*this, Vars.size()); } - void addVar(VarDecl* VD) { + void addVar(VarDecl *VD) { Vars.push_back(VD, ctx); } }; @@ -205,7 +205,7 @@ int LocalScope::const_iterator::distance(LocalScope::const_iterator L) { /// and LocalScope::const_iterator that specifies position in LocalScope graph. struct BlockScopePosPair { BlockScopePosPair() : block(0) {} - BlockScopePosPair(CFGBlock* b, LocalScope::const_iterator scopePos) + BlockScopePosPair(CFGBlock *b, LocalScope::const_iterator scopePos) : block(b), scopePosition(scopePos) {} CFGBlock *block; @@ -252,13 +252,13 @@ class CFGBuilder { ASTContext *Context; llvm::OwningPtr cfg; - CFGBlock* Block; - CFGBlock* Succ; + CFGBlock *Block; + CFGBlock *Succ; JumpTarget ContinueJumpTarget; JumpTarget BreakJumpTarget; - CFGBlock* SwitchTerminatedBlock; - CFGBlock* DefaultCaseBlock; - CFGBlock* TryTerminatedBlock; + CFGBlock *SwitchTerminatedBlock; + CFGBlock *DefaultCaseBlock; + CFGBlock *TryTerminatedBlock; // Current position in local scope. LocalScope::const_iterator ScopePos; @@ -305,7 +305,7 @@ private: // Visitors to walk an AST and construct the CFG. CFGBlock *VisitAddrLabelExpr(AddrLabelExpr *A, AddStmtChoice asc); CFGBlock *VisitBinaryOperator(BinaryOperator *B, AddStmtChoice asc); - CFGBlock *VisitBlockExpr(BlockExpr* E, AddStmtChoice asc); + CFGBlock *VisitBlockExpr(BlockExpr *E, AddStmtChoice asc); CFGBlock *VisitBreakStmt(BreakStmt *B); CFGBlock *VisitCXXCatchStmt(CXXCatchStmt *S); CFGBlock *VisitExprWithCleanups(ExprWithCleanups *E, @@ -328,11 +328,11 @@ private: AddStmtChoice asc); CFGBlock *VisitContinueStmt(ContinueStmt *C); CFGBlock *VisitDeclStmt(DeclStmt *DS); - CFGBlock *VisitDeclSubExpr(DeclStmt* DS); + CFGBlock *VisitDeclSubExpr(DeclStmt *DS); CFGBlock *VisitDefaultStmt(DefaultStmt *D); CFGBlock *VisitDoStmt(DoStmt *D); CFGBlock *VisitForStmt(ForStmt *F); - CFGBlock *VisitGotoStmt(GotoStmt* G); + CFGBlock *VisitGotoStmt(GotoStmt *G); CFGBlock *VisitIfStmt(IfStmt *I); CFGBlock *VisitImplicitCastExpr(ImplicitCastExpr *E, AddStmtChoice asc); CFGBlock *VisitIndirectGotoStmt(IndirectGotoStmt *I); @@ -343,7 +343,7 @@ private: CFGBlock *VisitObjCAtThrowStmt(ObjCAtThrowStmt *S); CFGBlock *VisitObjCAtTryStmt(ObjCAtTryStmt *S); CFGBlock *VisitObjCForCollectionStmt(ObjCForCollectionStmt *S); - CFGBlock *VisitReturnStmt(ReturnStmt* R); + CFGBlock *VisitReturnStmt(ReturnStmt *R); CFGBlock *VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E, AddStmtChoice asc); CFGBlock *VisitStmtExpr(StmtExpr *S, AddStmtChoice asc); @@ -353,7 +353,7 @@ private: CFGBlock *Visit(Stmt *S, AddStmtChoice asc = AddStmtChoice::NotAlwaysAdd); CFGBlock *VisitStmt(Stmt *S, AddStmtChoice asc); - CFGBlock *VisitChildren(Stmt* S); + CFGBlock *VisitChildren(Stmt *S); // Visitors to walk an AST and generate destructors of temporaries in // full expression. @@ -367,7 +367,7 @@ private: bool BindToTemporary); // NYS == Not Yet Supported - CFGBlock* NYS() { + CFGBlock *NYS() { badCFG = true; return Block; } @@ -380,17 +380,17 @@ private: } CFGBlock *addInitializer(CXXCtorInitializer *I); void addAutomaticObjDtors(LocalScope::const_iterator B, - LocalScope::const_iterator E, Stmt* S); + LocalScope::const_iterator E, Stmt *S); void addImplicitDtorsForDestructor(const CXXDestructorDecl *DD); // Local scopes creation. LocalScope* createOrReuseLocalScope(LocalScope* Scope); - void addLocalScopeForStmt(Stmt* S); - LocalScope* addLocalScopeForDeclStmt(DeclStmt* DS, LocalScope* Scope = NULL); - LocalScope* addLocalScopeForVarDecl(VarDecl* VD, LocalScope* Scope = NULL); + void addLocalScopeForStmt(Stmt *S); + LocalScope* addLocalScopeForDeclStmt(DeclStmt *DS, LocalScope* Scope = NULL); + LocalScope* addLocalScopeForVarDecl(VarDecl *VD, LocalScope* Scope = NULL); - void addLocalScopeAndDtors(Stmt* S); + void addLocalScopeAndDtors(Stmt *S); // Interface to CFGBlock - adding CFGElements. void appendStmt(CFGBlock *B, const Stmt *S) { @@ -414,11 +414,11 @@ private: B->appendTemporaryDtor(E, cfg->getBumpVectorContext()); } - void insertAutomaticObjDtors(CFGBlock* Blk, CFGBlock::iterator I, - LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt* S); - void appendAutomaticObjDtors(CFGBlock* Blk, LocalScope::const_iterator B, - LocalScope::const_iterator E, Stmt* S); - void prependAutomaticObjDtorsWithTerminator(CFGBlock* Blk, + void insertAutomaticObjDtors(CFGBlock *Blk, CFGBlock::iterator I, + LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt *S); + void appendAutomaticObjDtors(CFGBlock *Blk, LocalScope::const_iterator B, + LocalScope::const_iterator E, Stmt *S); + void prependAutomaticObjDtorsWithTerminator(CFGBlock *Blk, LocalScope::const_iterator B, LocalScope::const_iterator E); void addSuccessor(CFGBlock *B, CFGBlock *S) { @@ -514,7 +514,7 @@ static const VariableArrayType *FindVA(const Type *t) { /// body (compound statement). The ownership of the returned CFG is /// transferred to the caller. If CFG construction fails, this method returns /// NULL. -CFG* CFGBuilder::buildCFG(const Decl *D, Stmt* Statement) { +CFG* CFGBuilder::buildCFG(const Decl *D, Stmt *Statement) { assert(cfg.get()); if (!Statement) return NULL; @@ -554,8 +554,8 @@ CFG* CFGBuilder::buildCFG(const Decl *D, Stmt* Statement) { for (BackpatchBlocksTy::iterator I = BackpatchBlocks.begin(), E = BackpatchBlocks.end(); I != E; ++I ) { - CFGBlock* B = I->block; - GotoStmt* G = cast(B->getTerminator()); + CFGBlock *B = I->block; + GotoStmt *G = cast(B->getTerminator()); LabelMapTy::iterator LI = LabelMap.find(G->getLabel()); // If there is no target for the goto, then we are looking at an @@ -569,7 +569,7 @@ CFG* CFGBuilder::buildCFG(const Decl *D, Stmt* Statement) { } // Add successors to the Indirect Goto Dispatch block (if we have one). - if (CFGBlock* B = cfg->getIndirectGotoBlock()) + if (CFGBlock *B = cfg->getIndirectGotoBlock()) for (LabelSetTy::iterator I = AddressTakenLabels.begin(), E = AddressTakenLabels.end(); I != E; ++I ) { @@ -591,8 +591,8 @@ CFG* CFGBuilder::buildCFG(const Decl *D, Stmt* Statement) { /// createBlock - Used to lazily create blocks that are connected /// to the current (global) succcessor. -CFGBlock* CFGBuilder::createBlock(bool add_successor) { - CFGBlock* B = cfg->createBlock(); +CFGBlock *CFGBuilder::createBlock(bool add_successor) { + CFGBlock *B = cfg->createBlock(); if (add_successor && Succ) addSuccessor(B, Succ); return B; @@ -640,7 +640,7 @@ CFGBlock *CFGBuilder::addInitializer(CXXCtorInitializer *I) { /// for objects in range of local scope positions. Use S as trigger statement /// for destructors. void CFGBuilder::addAutomaticObjDtors(LocalScope::const_iterator B, - LocalScope::const_iterator E, Stmt* S) { + LocalScope::const_iterator E, Stmt *S) { if (!BuildOpts.AddImplicitDtors) return; @@ -713,7 +713,7 @@ LocalScope* CFGBuilder::createOrReuseLocalScope(LocalScope* Scope) { /// addLocalScopeForStmt - Add LocalScope to local scopes tree for statement /// that should create implicit scope (e.g. if/else substatements). -void CFGBuilder::addLocalScopeForStmt(Stmt* S) { +void CFGBuilder::addLocalScopeForStmt(Stmt *S) { if (!BuildOpts.AddImplicitDtors) return; @@ -742,14 +742,14 @@ void CFGBuilder::addLocalScopeForStmt(Stmt* S) { /// addLocalScopeForDeclStmt - Add LocalScope for declaration statement. Will /// reuse Scope if not NULL. -LocalScope* CFGBuilder::addLocalScopeForDeclStmt(DeclStmt* DS, +LocalScope* CFGBuilder::addLocalScopeForDeclStmt(DeclStmt *DS, LocalScope* Scope) { if (!BuildOpts.AddImplicitDtors) return Scope; for (DeclStmt::decl_iterator DI = DS->decl_begin(), DE = DS->decl_end() ; DI != DE; ++DI) { - if (VarDecl* VD = dyn_cast(*DI)) + if (VarDecl *VD = dyn_cast(*DI)) Scope = addLocalScopeForVarDecl(VD, Scope); } return Scope; @@ -758,7 +758,7 @@ LocalScope* CFGBuilder::addLocalScopeForDeclStmt(DeclStmt* DS, /// addLocalScopeForVarDecl - Add LocalScope for variable declaration. It will /// create add scope for automatic objects and temporary objects bound to /// const reference. Will reuse Scope if not NULL. -LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl* VD, +LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl *VD, LocalScope* Scope) { if (!BuildOpts.AddImplicitDtors) return Scope; @@ -790,7 +790,7 @@ LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl* VD, } // Check if type is a C++ class with non-trivial destructor. - if (const CXXRecordDecl* CD = QT->getAsCXXRecordDecl()) + if (const CXXRecordDecl *CD = QT->getAsCXXRecordDecl()) if (!CD->hasTrivialDestructor()) { // Add the variable to scope Scope = createOrReuseLocalScope(Scope); @@ -802,7 +802,7 @@ LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl* VD, /// addLocalScopeAndDtors - For given statement add local scope for it and /// add destructors that will cleanup the scope. Will reuse Scope if not NULL. -void CFGBuilder::addLocalScopeAndDtors(Stmt* S) { +void CFGBuilder::addLocalScopeAndDtors(Stmt *S) { if (!BuildOpts.AddImplicitDtors) return; @@ -814,9 +814,9 @@ void CFGBuilder::addLocalScopeAndDtors(Stmt* S) { /// insertAutomaticObjDtors - Insert destructor CFGElements for variables with /// automatic storage duration to CFGBlock's elements vector. Insertion will be /// performed in place specified with iterator. -void CFGBuilder::insertAutomaticObjDtors(CFGBlock* Blk, CFGBlock::iterator I, - LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt* S) { - BumpVectorContext& C = cfg->getBumpVectorContext(); +void CFGBuilder::insertAutomaticObjDtors(CFGBlock *Blk, CFGBlock::iterator I, + LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt *S) { + BumpVectorContext &C = cfg->getBumpVectorContext(); I = Blk->beginAutomaticObjDtorsInsert(I, B.distance(E), C); while (B != E) I = Blk->insertAutomaticObjDtor(I, *B++, S); @@ -826,8 +826,8 @@ void CFGBuilder::insertAutomaticObjDtors(CFGBlock* Blk, CFGBlock::iterator I, /// automatic storage duration to CFGBlock's elements vector. Elements will be /// appended to physical end of the vector which happens to be logical /// beginning. -void CFGBuilder::appendAutomaticObjDtors(CFGBlock* Blk, - LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt* S) { +void CFGBuilder::appendAutomaticObjDtors(CFGBlock *Blk, + LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt *S) { insertAutomaticObjDtors(Blk, Blk->begin(), B, E, S); } @@ -836,7 +836,7 @@ void CFGBuilder::appendAutomaticObjDtors(CFGBlock* Blk, /// Elements will be prepended to physical beginning of the vector which /// happens to be logical end. Use blocks terminator as statement that specifies /// destructors call site. -void CFGBuilder::prependAutomaticObjDtorsWithTerminator(CFGBlock* Blk, +void CFGBuilder::prependAutomaticObjDtorsWithTerminator(CFGBlock *Blk, LocalScope::const_iterator B, LocalScope::const_iterator E) { insertAutomaticObjDtors(Blk, Blk->end(), B, E, Blk->getTerminator()); } @@ -844,7 +844,7 @@ void CFGBuilder::prependAutomaticObjDtorsWithTerminator(CFGBlock* Blk, /// Visit - Walk the subtree of a statement and add extra /// blocks for ternary operators, &&, and ||. We also process "," and /// DeclStmts (which may contain nested control-flow). -CFGBlock* CFGBuilder::Visit(Stmt * S, AddStmtChoice asc) { +CFGBlock *CFGBuilder::Visit(Stmt * S, AddStmtChoice asc) { if (!S) { badCFG = true; return 0; @@ -998,7 +998,7 @@ CFGBlock *CFGBuilder::VisitStmt(Stmt *S, AddStmtChoice asc) { } /// VisitChildren - Visit the children of a Stmt. -CFGBlock *CFGBuilder::VisitChildren(Stmt* Terminator) { +CFGBlock *CFGBuilder::VisitChildren(Stmt *Terminator) { CFGBlock *lastBlock = Block; for (Stmt::child_range I = Terminator->children(); I; ++I) if (Stmt *child = *I) @@ -1033,20 +1033,20 @@ CFGBlock *CFGBuilder::VisitUnaryOperator(UnaryOperator *U, CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B, AddStmtChoice asc) { if (B->isLogicalOp()) { // && or || - CFGBlock* ConfluenceBlock = Block ? Block : createBlock(); + CFGBlock *ConfluenceBlock = Block ? Block : createBlock(); appendStmt(ConfluenceBlock, B); if (badCFG) return 0; // create the block evaluating the LHS - CFGBlock* LHSBlock = createBlock(false); + CFGBlock *LHSBlock = createBlock(false); LHSBlock->setTerminator(B); // create the block evaluating the RHS Succ = ConfluenceBlock; Block = NULL; - CFGBlock* RHSBlock = addStmt(B->getRHS()); + CFGBlock *RHSBlock = addStmt(B->getRHS()); if (RHSBlock) { if (badCFG) @@ -1213,7 +1213,7 @@ CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, AddStmtChoice asc) { CFGBlock *CFGBuilder::VisitChooseExpr(ChooseExpr *C, AddStmtChoice asc) { - CFGBlock* ConfluenceBlock = Block ? Block : createBlock(); + CFGBlock *ConfluenceBlock = Block ? Block : createBlock(); appendStmt(ConfluenceBlock, C); if (badCFG) return 0; @@ -1221,13 +1221,13 @@ CFGBlock *CFGBuilder::VisitChooseExpr(ChooseExpr *C, AddStmtChoice alwaysAdd = asc.withAlwaysAdd(true); Succ = ConfluenceBlock; Block = NULL; - CFGBlock* LHSBlock = Visit(C->getLHS(), alwaysAdd); + CFGBlock *LHSBlock = Visit(C->getLHS(), alwaysAdd); if (badCFG) return 0; Succ = ConfluenceBlock; Block = NULL; - CFGBlock* RHSBlock = Visit(C->getRHS(), alwaysAdd); + CFGBlock *RHSBlock = Visit(C->getRHS(), alwaysAdd); if (badCFG) return 0; @@ -1241,9 +1241,9 @@ CFGBlock *CFGBuilder::VisitChooseExpr(ChooseExpr *C, } -CFGBlock* CFGBuilder::VisitCompoundStmt(CompoundStmt* C) { +CFGBlock *CFGBuilder::VisitCompoundStmt(CompoundStmt *C) { addLocalScopeAndDtors(C); - CFGBlock* LastBlock = Block; + CFGBlock *LastBlock = Block; for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), E=C->body_rend(); I != E; ++I ) { @@ -1266,7 +1266,7 @@ CFGBlock *CFGBuilder::VisitConditionalOperator(AbstractConditionalOperator *C, // Create the confluence block that will "merge" the results of the ternary // expression. - CFGBlock* ConfluenceBlock = Block ? Block : createBlock(); + CFGBlock *ConfluenceBlock = Block ? Block : createBlock(); appendStmt(ConfluenceBlock, C); if (badCFG) return 0; @@ -1279,7 +1279,7 @@ CFGBlock *CFGBuilder::VisitConditionalOperator(AbstractConditionalOperator *C, // e.g: x ?: y is shorthand for: x ? x : y; Succ = ConfluenceBlock; Block = NULL; - CFGBlock* LHSBlock = 0; + CFGBlock *LHSBlock = 0; const Expr *trueExpr = C->getTrueExpr(); if (trueExpr != opaqueValue) { LHSBlock = Visit(C->getTrueExpr(), alwaysAdd); @@ -1292,7 +1292,7 @@ CFGBlock *CFGBuilder::VisitConditionalOperator(AbstractConditionalOperator *C, // Create the block for the RHS expression. Succ = ConfluenceBlock; - CFGBlock* RHSBlock = Visit(C->getFalseExpr(), alwaysAdd); + CFGBlock *RHSBlock = Visit(C->getFalseExpr(), alwaysAdd); if (badCFG) return 0; @@ -1357,7 +1357,7 @@ CFGBlock *CFGBuilder::VisitDeclStmt(DeclStmt *DS) { /// VisitDeclSubExpr - Utility method to add block-level expressions for /// DeclStmts and initializers in them. -CFGBlock *CFGBuilder::VisitDeclSubExpr(DeclStmt* DS) { +CFGBlock *CFGBuilder::VisitDeclSubExpr(DeclStmt *DS) { assert(DS->isSingleDecl() && "Can handle single declarations only."); Decl *D = DS->getSingleDecl(); @@ -1416,7 +1416,7 @@ CFGBlock *CFGBuilder::VisitDeclSubExpr(DeclStmt* DS) { return Block; } -CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) { +CFGBlock *CFGBuilder::VisitIfStmt(IfStmt *I) { // We may see an if statement in the middle of a basic block, or it may be the // first statement we are processing. In either case, we create a new basic // block. First, we create the blocks for the then...else statements, and @@ -1430,7 +1430,7 @@ CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) { // Create local scope for possible condition variable. // Store scope position. Add implicit destructor. - if (VarDecl* VD = I->getConditionVariable()) { + if (VarDecl *VD = I->getConditionVariable()) { LocalScope::const_iterator BeginScopePos = ScopePos; addLocalScopeForVarDecl(VD); addAutomaticObjDtors(ScopePos, BeginScopePos, I); @@ -1445,9 +1445,9 @@ CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) { } // Process the false branch. - CFGBlock* ElseBlock = Succ; + CFGBlock *ElseBlock = Succ; - if (Stmt* Else = I->getElse()) { + if (Stmt *Else = I->getElse()) { SaveAndRestore sv(Succ); // NULL out Block so that the recursive call to Visit will @@ -1470,9 +1470,9 @@ CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) { } // Process the true branch. - CFGBlock* ThenBlock; + CFGBlock *ThenBlock; { - Stmt* Then = I->getThen(); + Stmt *Then = I->getThen(); assert(Then); SaveAndRestore sv(Succ); Block = NULL; @@ -1528,7 +1528,7 @@ CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) { } -CFGBlock* CFGBuilder::VisitReturnStmt(ReturnStmt* R) { +CFGBlock *CFGBuilder::VisitReturnStmt(ReturnStmt *R) { // If we were in the middle of a block we stop processing that block. // // NOTE: If a "return" appears in the middle of a block, this means that the @@ -1548,7 +1548,7 @@ CFGBlock* CFGBuilder::VisitReturnStmt(ReturnStmt* R) { return VisitStmt(R, AddStmtChoice::AlwaysAdd); } -CFGBlock* CFGBuilder::VisitLabelStmt(LabelStmt *L) { +CFGBlock *CFGBuilder::VisitLabelStmt(LabelStmt *L) { // Get the block of the labeled statement. Add it to our map. addStmt(L->getSubStmt()); CFGBlock *LabelBlock = Block; @@ -1577,7 +1577,7 @@ CFGBlock* CFGBuilder::VisitLabelStmt(LabelStmt *L) { return LabelBlock; } -CFGBlock* CFGBuilder::VisitGotoStmt(GotoStmt* G) { +CFGBlock *CFGBuilder::VisitGotoStmt(GotoStmt *G) { // Goto is a control-flow statement. Thus we stop processing the current // block and create a new one. @@ -1599,8 +1599,8 @@ CFGBlock* CFGBuilder::VisitGotoStmt(GotoStmt* G) { return Block; } -CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) { - CFGBlock* LoopSuccessor = NULL; +CFGBlock *CFGBuilder::VisitForStmt(ForStmt *F) { + CFGBlock *LoopSuccessor = NULL; // Save local scope position because in case of condition variable ScopePos // won't be restored when traversing AST. @@ -1609,11 +1609,11 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) { // Create local scope for init statement and possible condition variable. // Add destructor for init statement and condition variable. // Store scope position for continue statement. - if (Stmt* Init = F->getInit()) + if (Stmt *Init = F->getInit()) addLocalScopeForStmt(Init); LocalScope::const_iterator LoopBeginScopePos = ScopePos; - if (VarDecl* VD = F->getConditionVariable()) + if (VarDecl *VD = F->getConditionVariable()) addLocalScopeForVarDecl(VD); LocalScope::const_iterator ContinueScopePos = ScopePos; @@ -1636,15 +1636,15 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) { // Because of short-circuit evaluation, the condition of the loop can span // multiple basic blocks. Thus we need the "Entry" and "Exit" blocks that // evaluate the condition. - CFGBlock* ExitConditionBlock = createBlock(false); - CFGBlock* EntryConditionBlock = ExitConditionBlock; + CFGBlock *ExitConditionBlock = createBlock(false); + CFGBlock *EntryConditionBlock = ExitConditionBlock; // Set the terminator for the "exit" condition block. ExitConditionBlock->setTerminator(F); // Now add the actual condition to the condition block. Because the condition // itself may contain control-flow, new blocks may be created. - if (Stmt* C = F->getCond()) { + if (Stmt *C = F->getCond()) { Block = ExitConditionBlock; EntryConditionBlock = addStmt(C); if (badCFG) @@ -1693,7 +1693,7 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) { // Loop body should end with destructor of Condition variable (if any). addAutomaticObjDtors(ScopePos, LoopBeginScopePos, F); - if (Stmt* I = F->getInc()) { + if (Stmt *I = F->getInc()) { // Generate increment code in its own basic block. This is the target of // continue statements. Succ = addStmt(I); @@ -1725,7 +1725,7 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) { // Now populate the body block, and in the process create new blocks as we // walk the body of the loop. - CFGBlock* BodyBlock = addStmt(F->getBody()); + CFGBlock *BodyBlock = addStmt(F->getBody()); if (!BodyBlock) BodyBlock = ContinueJumpTarget.block;//can happen for "for (...;...;...);" @@ -1742,7 +1742,7 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) { // If the loop contains initialization, create a new block for those // statements. This block can also contain statements that precede the loop. - if (Stmt* I = F->getInit()) { + if (Stmt *I = F->getInit()) { Block = createBlock(); return addStmt(I); } @@ -1762,7 +1762,7 @@ CFGBlock *CFGBuilder::VisitMemberExpr(MemberExpr *M, AddStmtChoice asc) { return Visit(M->getBase()); } -CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) { +CFGBlock *CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) { // Objective-C fast enumeration 'for' statements: // http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC // @@ -1795,7 +1795,7 @@ CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) { // a DeclStmt and the other returns a DeclRefExpr. // - CFGBlock* LoopSuccessor = 0; + CFGBlock *LoopSuccessor = 0; if (Block) { if (badCFG) @@ -1806,8 +1806,8 @@ CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) { LoopSuccessor = Succ; // Build the condition blocks. - CFGBlock* ExitConditionBlock = createBlock(false); - CFGBlock* EntryConditionBlock = ExitConditionBlock; + CFGBlock *ExitConditionBlock = createBlock(false); + CFGBlock *EntryConditionBlock = ExitConditionBlock; // Set the terminator for the "exit" condition block. ExitConditionBlock->setTerminator(S); @@ -1842,7 +1842,7 @@ CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) { BreakJumpTarget = JumpTarget(LoopSuccessor, ScopePos); ContinueJumpTarget = JumpTarget(EntryConditionBlock, ScopePos); - CFGBlock* BodyBlock = addStmt(S->getBody()); + CFGBlock *BodyBlock = addStmt(S->getBody()); if (!BodyBlock) BodyBlock = EntryConditionBlock; // can happen for "for (X in Y) ;" @@ -1864,7 +1864,7 @@ CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) { return addStmt(S->getCollection()); } -CFGBlock* CFGBuilder::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt* S) { +CFGBlock *CFGBuilder::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) { // FIXME: Add locking 'primitives' to CFG for @synchronized. // Inline the body. @@ -1888,13 +1888,13 @@ CFGBlock* CFGBuilder::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt* S) { return addStmt(S->getSynchExpr()); } -CFGBlock* CFGBuilder::VisitObjCAtTryStmt(ObjCAtTryStmt* S) { +CFGBlock *CFGBuilder::VisitObjCAtTryStmt(ObjCAtTryStmt *S) { // FIXME return NYS(); } -CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) { - CFGBlock* LoopSuccessor = NULL; +CFGBlock *CFGBuilder::VisitWhileStmt(WhileStmt *W) { + CFGBlock *LoopSuccessor = NULL; // Save local scope position because in case of condition variable ScopePos // won't be restored when traversing AST. @@ -1903,7 +1903,7 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) { // Create local scope for possible condition variable. // Store scope position for continue statement. LocalScope::const_iterator LoopBeginScopePos = ScopePos; - if (VarDecl* VD = W->getConditionVariable()) { + if (VarDecl *VD = W->getConditionVariable()) { addLocalScopeForVarDecl(VD); addAutomaticObjDtors(ScopePos, LoopBeginScopePos, W); } @@ -1921,8 +1921,8 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) { // Because of short-circuit evaluation, the condition of the loop can span // multiple basic blocks. Thus we need the "Entry" and "Exit" blocks that // evaluate the condition. - CFGBlock* ExitConditionBlock = createBlock(false); - CFGBlock* EntryConditionBlock = ExitConditionBlock; + CFGBlock *ExitConditionBlock = createBlock(false); + CFGBlock *EntryConditionBlock = ExitConditionBlock; // Set the terminator for the "exit" condition block. ExitConditionBlock->setTerminator(W); @@ -1930,7 +1930,7 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) { // Now add the actual condition to the condition block. Because the condition // itself may contain control-flow, new blocks may be created. Thus we update // "Succ" after adding the condition. - if (Stmt* C = W->getCond()) { + if (Stmt *C = W->getCond()) { Block = ExitConditionBlock; EntryConditionBlock = addStmt(C); // The condition might finish the current 'Block'. @@ -1992,7 +1992,7 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) { addLocalScopeAndDtors(W->getBody()); // Create the body. The returned block is the entry to the loop body. - CFGBlock* BodyBlock = addStmt(W->getBody()); + CFGBlock *BodyBlock = addStmt(W->getBody()); if (!BodyBlock) BodyBlock = ContinueJumpTarget.block; // can happen for "while(...) ;" @@ -2019,13 +2019,13 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) { } -CFGBlock *CFGBuilder::VisitObjCAtCatchStmt(ObjCAtCatchStmt* S) { +CFGBlock *CFGBuilder::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) { // FIXME: For now we pretend that @catch and the code it contains does not // exit. return Block; } -CFGBlock* CFGBuilder::VisitObjCAtThrowStmt(ObjCAtThrowStmt* S) { +CFGBlock *CFGBuilder::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) { // FIXME: This isn't complete. We basically treat @throw like a return // statement. @@ -2044,7 +2044,7 @@ CFGBlock* CFGBuilder::VisitObjCAtThrowStmt(ObjCAtThrowStmt* S) { return VisitStmt(S, AddStmtChoice::AlwaysAdd); } -CFGBlock* CFGBuilder::VisitCXXThrowExpr(CXXThrowExpr* T) { +CFGBlock *CFGBuilder::VisitCXXThrowExpr(CXXThrowExpr *T) { // If we were in the middle of a block we stop processing that block. if (badCFG) return 0; @@ -2064,8 +2064,8 @@ CFGBlock* CFGBuilder::VisitCXXThrowExpr(CXXThrowExpr* T) { return VisitStmt(T, AddStmtChoice::AlwaysAdd); } -CFGBlock *CFGBuilder::VisitDoStmt(DoStmt* D) { - CFGBlock* LoopSuccessor = NULL; +CFGBlock *CFGBuilder::VisitDoStmt(DoStmt *D) { + CFGBlock *LoopSuccessor = NULL; // "do...while" is a control-flow statement. Thus we stop processing the // current block. @@ -2079,15 +2079,15 @@ CFGBlock *CFGBuilder::VisitDoStmt(DoStmt* D) { // Because of short-circuit evaluation, the condition of the loop can span // multiple basic blocks. Thus we need the "Entry" and "Exit" blocks that // evaluate the condition. - CFGBlock* ExitConditionBlock = createBlock(false); - CFGBlock* EntryConditionBlock = ExitConditionBlock; + CFGBlock *ExitConditionBlock = createBlock(false); + CFGBlock *EntryConditionBlock = ExitConditionBlock; // Set the terminator for the "exit" condition block. ExitConditionBlock->setTerminator(D); // Now add the actual condition to the condition block. Because the condition // itself may contain control-flow, new blocks may be created. - if (Stmt* C = D->getCond()) { + if (Stmt *C = D->getCond()) { Block = ExitConditionBlock; EntryConditionBlock = addStmt(C); if (Block) { @@ -2103,7 +2103,7 @@ CFGBlock *CFGBuilder::VisitDoStmt(DoStmt* D) { const TryResult &KnownVal = tryEvaluateBool(D->getCond()); // Process the loop body. - CFGBlock* BodyBlock = NULL; + CFGBlock *BodyBlock = NULL; { assert(D->getBody()); @@ -2167,7 +2167,7 @@ CFGBlock *CFGBuilder::VisitDoStmt(DoStmt* D) { return BodyBlock; } -CFGBlock* CFGBuilder::VisitContinueStmt(ContinueStmt* C) { +CFGBlock *CFGBuilder::VisitContinueStmt(ContinueStmt *C) { // "continue" is a control-flow statement. Thus we stop processing the // current block. if (badCFG) @@ -2219,7 +2219,7 @@ CFGBlock *CFGBuilder::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E, /// VisitStmtExpr - Utility method to handle (nested) statement /// expressions (a GCC extension). -CFGBlock* CFGBuilder::VisitStmtExpr(StmtExpr *SE, AddStmtChoice asc) { +CFGBlock *CFGBuilder::VisitStmtExpr(StmtExpr *SE, AddStmtChoice asc) { if (asc.alwaysAdd(*this, SE)) { autoCreateBlock(); appendStmt(Block, SE); @@ -2227,10 +2227,10 @@ CFGBlock* CFGBuilder::VisitStmtExpr(StmtExpr *SE, AddStmtChoice asc) { return VisitCompoundStmt(SE->getSubStmt()); } -CFGBlock* CFGBuilder::VisitSwitchStmt(SwitchStmt* Terminator) { +CFGBlock *CFGBuilder::VisitSwitchStmt(SwitchStmt *Terminator) { // "switch" is a control-flow statement. Thus we stop processing the current // block. - CFGBlock* SwitchSuccessor = NULL; + CFGBlock *SwitchSuccessor = NULL; // Save local scope position because in case of condition variable ScopePos // won't be restored when traversing AST. @@ -2238,7 +2238,7 @@ CFGBlock* CFGBuilder::VisitSwitchStmt(SwitchStmt* Terminator) { // Create local scope for possible condition variable. // Store scope position. Add implicit destructor. - if (VarDecl* VD = Terminator->getConditionVariable()) { + if (VarDecl *VD = Terminator->getConditionVariable()) { LocalScope::const_iterator SwitchBeginScopePos = ScopePos; addLocalScopeForVarDecl(VD); addAutomaticObjDtors(ScopePos, SwitchBeginScopePos, Terminator); @@ -2363,7 +2363,7 @@ static bool shouldAddCase(bool &switchExclusivelyCovered, return addCase; } -CFGBlock* CFGBuilder::VisitCaseStmt(CaseStmt* CS) { +CFGBlock *CFGBuilder::VisitCaseStmt(CaseStmt *CS) { // CaseStmts are essentially labels, so they are the first statement in a // block. CFGBlock *TopBlock = 0, *LastBlock = 0; @@ -2394,7 +2394,7 @@ CFGBlock* CFGBuilder::VisitCaseStmt(CaseStmt* CS) { addStmt(Sub); } - CFGBlock* CaseBlock = Block; + CFGBlock *CaseBlock = Block; if (!CaseBlock) CaseBlock = createBlock(); @@ -2427,7 +2427,7 @@ CFGBlock* CFGBuilder::VisitCaseStmt(CaseStmt* CS) { return Succ; } -CFGBlock* CFGBuilder::VisitDefaultStmt(DefaultStmt* Terminator) { +CFGBlock *CFGBuilder::VisitDefaultStmt(DefaultStmt *Terminator) { if (Terminator->getSubStmt()) addStmt(Terminator->getSubStmt()); @@ -2461,7 +2461,7 @@ CFGBlock* CFGBuilder::VisitDefaultStmt(DefaultStmt* Terminator) { CFGBlock *CFGBuilder::VisitCXXTryStmt(CXXTryStmt *Terminator) { // "try"/"catch" is a control-flow statement. Thus we stop processing the // current block. - CFGBlock* TrySuccessor = NULL; + CFGBlock *TrySuccessor = NULL; if (Block) { if (badCFG) @@ -2512,7 +2512,7 @@ CFGBlock *CFGBuilder::VisitCXXTryStmt(CXXTryStmt *Terminator) { return Block; } -CFGBlock* CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt* CS) { +CFGBlock *CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt *CS) { // CXXCatchStmt are treated like labels, so they are the first statement in a // block. @@ -2522,7 +2522,7 @@ CFGBlock* CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt* CS) { // Create local scope for possible exception variable. // Store scope position. Add implicit destructor. - if (VarDecl* VD = CS->getExceptionDecl()) { + if (VarDecl *VD = CS->getExceptionDecl()) { LocalScope::const_iterator BeginScopePos = ScopePos; addLocalScopeForVarDecl(VD); addAutomaticObjDtors(ScopePos, BeginScopePos, CS); @@ -2531,7 +2531,7 @@ CFGBlock* CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt* CS) { if (CS->getHandlerBlock()) addStmt(CS->getHandlerBlock()); - CFGBlock* CatchBlock = Block; + CFGBlock *CatchBlock = Block; if (!CatchBlock) CatchBlock = createBlock(); @@ -2546,7 +2546,7 @@ CFGBlock* CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt* CS) { return CatchBlock; } -CFGBlock* CFGBuilder::VisitCXXForRangeStmt(CXXForRangeStmt* S) { +CFGBlock *CFGBuilder::VisitCXXForRangeStmt(CXXForRangeStmt *S) { // C++0x for-range statements are specified as [stmt.ranged]: // // { @@ -2574,7 +2574,7 @@ CFGBlock* CFGBuilder::VisitCXXForRangeStmt(CXXForRangeStmt* S) { // "for" is a control-flow statement. Thus we stop processing the current // block. - CFGBlock* LoopSuccessor = NULL; + CFGBlock *LoopSuccessor = NULL; if (Block) { if (badCFG) return 0; @@ -2588,7 +2588,7 @@ CFGBlock* CFGBuilder::VisitCXXForRangeStmt(CXXForRangeStmt* S) { BreakJumpTarget = JumpTarget(LoopSuccessor, ScopePos); // The block for the __begin != __end expression. - CFGBlock* ConditionBlock = createBlock(false); + CFGBlock *ConditionBlock = createBlock(false); ConditionBlock->setTerminator(S); // Now add the actual condition to the condition block. @@ -2724,9 +2724,9 @@ CFGBlock *CFGBuilder::VisitImplicitCastExpr(ImplicitCastExpr *E, return Visit(E->getSubExpr(), AddStmtChoice()); } -CFGBlock* CFGBuilder::VisitIndirectGotoStmt(IndirectGotoStmt* I) { +CFGBlock *CFGBuilder::VisitIndirectGotoStmt(IndirectGotoStmt *I) { // Lazily create the indirect-goto dispatch block if there isn't one already. - CFGBlock* IBlock = cfg->getIndirectGotoBlock(); + CFGBlock *IBlock = cfg->getIndirectGotoBlock(); if (!IBlock) { IBlock = createBlock(false); @@ -2948,7 +2948,7 @@ CFGBlock *CFGBuilder::VisitConditionalOperatorForTemporaryDtors( /// createBlock - Constructs and adds a new CFGBlock to the CFG. The block has /// no successors or predecessors. If this is the first block created in the /// CFG, it is automatically set to be the Entry and Exit of the CFG. -CFGBlock* CFG::createBlock() { +CFGBlock *CFG::createBlock() { bool first_block = begin() == end(); // Create the block. @@ -2966,7 +2966,7 @@ CFGBlock* CFG::createBlock() { /// buildCFG - Constructs a CFG from an AST. Ownership of the returned /// CFG is returned to the caller. -CFG* CFG::buildCFG(const Decl *D, Stmt* Statement, ASTContext *C, +CFG* CFG::buildCFG(const Decl *D, Stmt *Statement, ASTContext *C, const BuildOptions &BO) { CFGBuilder Builder(C, BO); return Builder.buildCFG(D, Statement); @@ -3064,7 +3064,7 @@ static BlkExprMapTy* PopulateBlkExprMap(CFG& cfg) { const CFGStmt *CS = BI->getAs(); if (!CS) continue; - if (Expr* Exp = dyn_cast(CS->getStmt())) { + if (Expr *Exp = dyn_cast(CS->getStmt())) { assert((Exp->IgnoreParens() == Exp) && "No parens on block-level exps"); if (BinaryOperator* B = dyn_cast(Exp)) { @@ -3073,10 +3073,10 @@ static BlkExprMapTy* PopulateBlkExprMap(CFG& cfg) { // another expression. if (B->isAssignmentOp() && !SubExprAssignments.count(Exp)) continue; - } else if (const StmtExpr* SE = dyn_cast(Exp)) { + } else if (const StmtExpr *SE = dyn_cast(Exp)) { // Special handling for statement expressions. The last statement in // the statement expression is also a block-level expr. - const CompoundStmt* C = SE->getSubStmt(); + const CompoundStmt *C = SE->getSubStmt(); if (!C->body_empty()) { const Stmt *Last = C->body_back(); if (const Expr *LastEx = dyn_cast(Last)) @@ -3093,7 +3093,7 @@ static BlkExprMapTy* PopulateBlkExprMap(CFG& cfg) { // Look at terminators. The condition is a block-level expression. - Stmt* S = (*I)->getTerminatorCondition(); + Stmt *S = (*I)->getTerminatorCondition(); if (S && M->find(S) == M->end()) { unsigned x = M->size(); @@ -3104,7 +3104,7 @@ static BlkExprMapTy* PopulateBlkExprMap(CFG& cfg) { return M; } -CFG::BlkExprNumTy CFG::getBlkExprNum(const Stmt* S) { +CFG::BlkExprNumTy CFG::getBlkExprNum(const Stmt *S) { assert(S != NULL); if (!BlkExprMap) { BlkExprMap = (void*) PopulateBlkExprMap(*this); } @@ -3234,7 +3234,7 @@ public: void setBlockID(signed i) { currentBlock = i; } void setStmtID(unsigned i) { currentStmt = i; } - virtual bool handledStmt(Stmt* S, raw_ostream& OS) { + virtual bool handledStmt(Stmt *S, raw_ostream &OS) { StmtMapTy::iterator I = StmtMap.find(S); if (I == StmtMap.end()) @@ -3249,7 +3249,7 @@ public: return true; } - bool handleDecl(const Decl* D, raw_ostream& OS) { + bool handleDecl(const Decl *D, raw_ostream &OS) { DeclMapTy::iterator I = DeclMap.find(D); if (I == DeclMap.end()) @@ -3271,30 +3271,30 @@ namespace { class CFGBlockTerminatorPrint : public StmtVisitor { - raw_ostream& OS; + raw_ostream &OS; StmtPrinterHelper* Helper; PrintingPolicy Policy; public: - CFGBlockTerminatorPrint(raw_ostream& os, StmtPrinterHelper* helper, + CFGBlockTerminatorPrint(raw_ostream &os, StmtPrinterHelper* helper, const PrintingPolicy &Policy) : OS(os), Helper(helper), Policy(Policy) {} - void VisitIfStmt(IfStmt* I) { + void VisitIfStmt(IfStmt *I) { OS << "if "; I->getCond()->printPretty(OS,Helper,Policy); } // Default case. - void VisitStmt(Stmt* Terminator) { + void VisitStmt(Stmt *Terminator) { Terminator->printPretty(OS, Helper, Policy); } - void VisitForStmt(ForStmt* F) { + void VisitForStmt(ForStmt *F) { OS << "for (" ; if (F->getInit()) OS << "..."; OS << "; "; - if (Stmt* C = F->getCond()) + if (Stmt *C = F->getCond()) C->printPretty(OS, Helper, Policy); OS << "; "; if (F->getInc()) @@ -3302,24 +3302,24 @@ public: OS << ")"; } - void VisitWhileStmt(WhileStmt* W) { + void VisitWhileStmt(WhileStmt *W) { OS << "while " ; - if (Stmt* C = W->getCond()) + if (Stmt *C = W->getCond()) C->printPretty(OS, Helper, Policy); } - void VisitDoStmt(DoStmt* D) { + void VisitDoStmt(DoStmt *D) { OS << "do ... while "; - if (Stmt* C = D->getCond()) + if (Stmt *C = D->getCond()) C->printPretty(OS, Helper, Policy); } - void VisitSwitchStmt(SwitchStmt* Terminator) { + void VisitSwitchStmt(SwitchStmt *Terminator) { OS << "switch "; Terminator->getCond()->printPretty(OS, Helper, Policy); } - void VisitCXXTryStmt(CXXTryStmt* CS) { + void VisitCXXTryStmt(CXXTryStmt *CS) { OS << "try ..."; } @@ -3328,13 +3328,13 @@ public: OS << " ? ... : ..."; } - void VisitChooseExpr(ChooseExpr* C) { + void VisitChooseExpr(ChooseExpr *C) { OS << "__builtin_choose_expr( "; C->getCond()->printPretty(OS, Helper, Policy); OS << " )"; } - void VisitIndirectGotoStmt(IndirectGotoStmt* I) { + void VisitIndirectGotoStmt(IndirectGotoStmt *I) { OS << "goto *"; I->getTarget()->printPretty(OS, Helper, Policy); } @@ -3359,7 +3359,7 @@ public: } } - void VisitExpr(Expr* E) { + void VisitExpr(Expr *E) { E->printPretty(OS, Helper, Policy); } }; @@ -3373,8 +3373,8 @@ static void print_elem(raw_ostream &OS, StmtPrinterHelper* Helper, if (Helper) { // special printing for statement-expressions. - if (StmtExpr* SE = dyn_cast(S)) { - CompoundStmt* Sub = SE->getSubStmt(); + if (StmtExpr *SE = dyn_cast(S)) { + CompoundStmt *Sub = SE->getSubStmt(); if (Sub->children()) { OS << "({ ... ; "; @@ -3412,7 +3412,7 @@ static void print_elem(raw_ostream &OS, StmtPrinterHelper* Helper, else OS << I->getAnyMember()->getName(); OS << "("; - if (Expr* IE = I->getInit()) + if (Expr *IE = I->getInit()) IE->printPretty(OS, Helper, PrintingPolicy(Helper->getLangOpts())); OS << ")"; @@ -3421,7 +3421,7 @@ static void print_elem(raw_ostream &OS, StmtPrinterHelper* Helper, else OS << " (Member initializer)\n"; } else if (const CFGAutomaticObjDtor *DE = E.getAs()){ - const VarDecl* VD = DE->getVarDecl(); + const VarDecl *VD = DE->getVarDecl(); Helper->handleDecl(VD, OS); const Type* T = VD->getType().getTypePtr(); @@ -3456,8 +3456,8 @@ static void print_elem(raw_ostream &OS, StmtPrinterHelper* Helper, } } -static void print_block(raw_ostream& OS, const CFG* cfg, - const CFGBlock& B, +static void print_block(raw_ostream &OS, const CFG* cfg, + const CFGBlock &B, StmtPrinterHelper* Helper, bool print_edges) { if (Helper) Helper->setBlockID(B.getBlockID()); @@ -3475,14 +3475,14 @@ static void print_block(raw_ostream& OS, const CFG* cfg, OS << " ]\n"; // Print the label of this block. - if (Stmt* Label = const_cast(B.getLabel())) { + if (Stmt *Label = const_cast(B.getLabel())) { if (print_edges) OS << " "; - if (LabelStmt* L = dyn_cast(Label)) + if (LabelStmt *L = dyn_cast(Label)) OS << L->getName(); - else if (CaseStmt* C = dyn_cast(Label)) { + else if (CaseStmt *C = dyn_cast(Label)) { OS << "case "; C->getLHS()->printPretty(OS, Helper, PrintingPolicy(Helper->getLangOpts())); @@ -3609,7 +3609,7 @@ void CFGBlock::dump(const CFG* cfg, const LangOptions &LO) const { /// print - A simple pretty printer of a CFGBlock that outputs to an ostream. /// Generally this will only be called from CFG::print. -void CFGBlock::print(raw_ostream& OS, const CFG* cfg, +void CFGBlock::print(raw_ostream &OS, const CFG* cfg, const LangOptions &LO) const { StmtPrinterHelper Helper(cfg, LO); print_block(OS, cfg, *this, &Helper, true); @@ -3622,12 +3622,12 @@ void CFGBlock::printTerminator(raw_ostream &OS, TPrinter.Visit(const_cast(getTerminator().getStmt())); } -Stmt* CFGBlock::getTerminatorCondition() { +Stmt *CFGBlock::getTerminatorCondition() { Stmt *Terminator = this->Terminator; if (!Terminator) return NULL; - Expr* E = NULL; + Expr *E = NULL; switch (Terminator->getStmtClass()) { default: @@ -3704,7 +3704,7 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { DOTGraphTraits (bool isSimple=false) : DefaultDOTGraphTraits(isSimple) {} - static std::string getNodeLabel(const CFGBlock* Node, const CFG* Graph) { + static std::string getNodeLabel(const CFGBlock *Node, const CFG* Graph) { #ifndef NDEBUG std::string OutSStr; diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index 71c1917c82..2a41bf863b 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -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(LHS)) + if (DeclRefExpr *DR = dyn_cast(LHS)) if (const VarDecl *VD = dyn_cast(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(*DI)) { + if (VarDecl *VD = dyn_cast(*DI)) { if (!isAlwaysAlive(VD)) val.liveDecls = LV.DSetFact.remove(val.liveDecls, VD); } diff --git a/lib/Analysis/PseudoConstantAnalysis.cpp b/lib/Analysis/PseudoConstantAnalysis.cpp index ff96eb4a0a..8f24c432b1 100644 --- a/lib/Analysis/PseudoConstantAnalysis.cpp +++ b/lib/Analysis/PseudoConstantAnalysis.cpp @@ -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(Head)) diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp index 8bc9506c85..751258362a 100644 --- a/lib/Analysis/UninitializedValues.cpp +++ b/lib/Analysis/UninitializedValues.cpp @@ -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(ex->IgnoreParenCasts())) +FindVarResult TransferFunctions::findBlockVarDecl(Expr *ex) { + if (DeclRefExpr *dr = dyn_cast(ex->IgnoreParenCasts())) if (VarDecl *vd = dyn_cast(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(element)) { + if (DeclStmt *ds = dyn_cast(element)) { vd = cast(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) diff --git a/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp b/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp index c723ffd6ff..3a10ab141a 100644 --- a/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp +++ b/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp @@ -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() << '}'; } diff --git a/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp b/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp index d88a111e9a..80ba26b441 100644 --- a/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp @@ -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; diff --git a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp index b2ac9ddc40..71e38e34ca 100644 --- a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp +++ b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp @@ -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 GetCFNumberSize(ASTContext& Ctx, uint64_t i) { +static Optional 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 > { 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; diff --git a/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/lib/StaticAnalyzer/Checkers/CStringChecker.cpp index 4b1a483309..b1389cff0b 100644 --- a/lib/StaticAnalyzer/Checkers/CStringChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/CStringChecker.cpp @@ -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(MR); diff --git a/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp b/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp index f1e7aaac80..e4b3292727 100644 --- a/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp @@ -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; } diff --git a/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp index 0c693a0bd1..48f5c8ba01 100644 --- a/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp +++ b/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp @@ -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(S)) + if (ObjCMessageExpr *ME = dyn_cast(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(S)) + if (ObjCMessageExpr *ME = dyn_cast(S)) if (ME->getSelector() == Release) if (ME->getInstanceReceiver()) - if (Expr* Receiver = ME->getInstanceReceiver()->IgnoreParenCasts()) - if (ObjCIvarRefExpr* E = dyn_cast(Receiver)) + if (Expr *Receiver = ME->getInstanceReceiver()->IgnoreParenCasts()) + if (ObjCIvarRefExpr *E = dyn_cast(Receiver)) if (E->getDecl() == ID) return true; // [self setMyIvar:nil]; - if (ObjCMessageExpr* ME = dyn_cast(S)) + if (ObjCMessageExpr *ME = dyn_cast(S)) if (ME->getInstanceReceiver()) - if (Expr* Receiver = ME->getInstanceReceiver()->IgnoreParenCasts()) - if (DeclRefExpr* E = dyn_cast(Receiver)) + if (Expr *Receiver = ME->getInstanceReceiver()->IgnoreParenCasts()) + if (DeclRefExpr *E = dyn_cast(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(S)) if (BO->isAssignmentOp()) - if (ObjCPropertyRefExpr* PRE = + if (ObjCPropertyRefExpr *PRE = dyn_cast(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; diff --git a/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp b/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp index fec06a9535..4621eab503 100644 --- a/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp +++ b/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp @@ -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 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); diff --git a/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp b/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp index 50b57d1ae4..c367e33742 100644 --- a/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp @@ -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()) { diff --git a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp index f86bf55c32..d369518148 100644 --- a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -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(DR->getDecl())) + if (const VarDecl *VD = dyn_cast(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(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(S)) { if (!B->isAssignmentOp()) return; // Skip non-assignments. - if (DeclRefExpr* DR = dyn_cast(B->getLHS())) + if (DeclRefExpr *DR = dyn_cast(B->getLHS())) if (VarDecl *VD = dyn_cast(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(RHS)) + if (DeclRefExpr *RhsDR = dyn_cast(RHS)) if (VD == dyn_cast(RhsDR->getDecl())) return; @@ -231,16 +231,16 @@ public: const Expr *Ex = U->getSubExpr()->IgnoreParenCasts(); - if (const DeclRefExpr* DR = dyn_cast(Ex)) + if (const DeclRefExpr *DR = dyn_cast(Ex)) CheckDeclRef(DR, U, DeadIncrement, Live); } - else if (const DeclStmt* DS = dyn_cast(S)) + else if (const DeclStmt *DS = dyn_cast(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(*DI); + VarDecl *V = dyn_cast(*DI); if (!V) continue; @@ -251,7 +251,7 @@ public: if (V->getType()->getAs()) return; - if (Expr* E = V->getInit()) { + if (Expr *E = V->getInit()) { while (ExprWithCleanups *exprClean = dyn_cast(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(E)) - if (VarDecl* VD = dyn_cast(DR->getDecl())) { + if (DeclRefExpr *DR = dyn_cast(E)) + if (VarDecl *VD = dyn_cast(DR->getDecl())) { Escaped.insert(VD); return; } diff --git a/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp b/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp index 4c3961faf0..14a1127d2c 100644 --- a/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp @@ -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(D); + const Decl *D = *DS->decl_begin(); + const VarDecl *VD = dyn_cast(D); // Only care about iterators. if (getTemplateKind(VD->getType()) != VectorIteratorKind) return; @@ -520,7 +520,7 @@ void IteratorsChecker::checkPreStmt(const DeclStmt *DS, state = state->set(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 diff --git a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp index 9ba6eb2fed..ba0d21cc0f 100644 --- a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -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(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(&V)) os << "an integer (" << IntVal->getValue() << ")"; else if (loc::ConcreteInt *ConstAddr = dyn_cast(&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: { diff --git a/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp b/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp index f11db6458c..e63d2b2082 100644 --- a/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp @@ -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")) diff --git a/lib/StaticAnalyzer/Checkers/OSAtomicChecker.cpp b/lib/StaticAnalyzer/Checkers/OSAtomicChecker.cpp index 72d064ef81..09bd8c5bc8 100644 --- a/lib/StaticAnalyzer/Checkers/OSAtomicChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/OSAtomicChecker.cpp @@ -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; diff --git a/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp b/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp index 4c05867631..9b4ad39e22 100644 --- a/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp @@ -110,7 +110,7 @@ namespace clang { namespace ento { template<> struct GRStateTrait : public GRStatePartialTrait { - static void* GDMIndex() { static int index = 0; return &index; } + static void *GDMIndex() { static int index = 0; return &index; } }; template <> struct GRStateTrait : public GRStatePartialTrait { @@ -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(); diff --git a/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp b/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp index d78e5ceb53..53909700e1 100644 --- a/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp @@ -29,7 +29,7 @@ using namespace ento; enum IVarState { Unused, Used }; typedef llvm::DenseMap 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 diff --git a/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp b/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp index 162dba890b..09a22ea5b4 100644 --- a/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp @@ -48,7 +48,7 @@ namespace clang { namespace ento { template <> struct GRStateTrait : public GRStatePartialTrait > { - static void* GDMIndex() { static int x = 0; return &x; } + static void *GDMIndex() { static int x = 0; return &x; } }; } // end GR namespace } // end clang namespace diff --git a/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp index 5e4c333e5b..9386bc108a 100644 --- a/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp @@ -50,7 +50,7 @@ SourceRange StackAddrEscapeChecker::GenName(raw_ostream &os, // Check if the region is a compound literal. if (const CompoundLiteralRegion* CR = dyn_cast(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(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 " diff --git a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp index 1fb181591b..541a724baa 100644 --- a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp @@ -28,25 +28,25 @@ class UndefBranchChecker : public Checker { 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(*I)) { - const Expr* E2 = FindExpr(ExI); + if (const Expr *ExI = dyn_cast_or_null(*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(N->getLocation()); - const Expr* Ex = cast(B.getSrc()->getTerminatorCondition()); + const Expr *Ex = cast(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(&P)) + if (PostStmt *PS = dyn_cast(&P)) if (PS->getStmt() == Ex) St = PrevN->getState(); diff --git a/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp b/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp index 28806e3db9..a839644feb 100644 --- a/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp @@ -67,7 +67,7 @@ void UndefinedAssignmentChecker::checkBind(SVal location, SVal val, } if (const DeclStmt *DS = dyn_cast(StoreE)) { - const VarDecl* VD = dyn_cast(DS->getSingleDecl()); + const VarDecl *VD = dyn_cast(DS->getSingleDecl()); ex = VD->getInit(); } diff --git a/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp b/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp index 875dce2e99..36d8daf769 100644 --- a/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp @@ -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")); diff --git a/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp b/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp index 0518740dad..b9f145ef08 100644 --- a/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp +++ b/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp @@ -35,12 +35,12 @@ namespace clang { namespace ento { template<> struct GRStateTrait : public GRStatePartialTrait { - static inline void* GDMIndex() { return &ConstNotEqIndex; } + static inline void *GDMIndex() { return &ConstNotEqIndex; } }; template<> struct GRStateTrait : public GRStatePartialTrait { - 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(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(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(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(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(); @@ -301,7 +301,7 @@ BasicConstraintManager::removeDeadBindings(const GRState* state, return state->set(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. diff --git a/lib/StaticAnalyzer/Core/BasicValueFactory.cpp b/lib/StaticAnalyzer/Core/BasicValueFactory.cpp index f08c1fdbdb..fe96700772 100644 --- a/lib/StaticAnalyzer/Core/BasicValueFactory.cpp +++ b/lib/StaticAnalyzer/Core/BasicValueFactory.cpp @@ -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 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); diff --git a/lib/StaticAnalyzer/Core/BlockCounter.cpp b/lib/StaticAnalyzer/Core/BlockCounter.cpp index ed52b6b012..74d761e1ec 100644 --- a/lib/StaticAnalyzer/Core/BlockCounter.cpp +++ b/lib/StaticAnalyzer/Core/BlockCounter.cpp @@ -48,11 +48,11 @@ public: typedef llvm::ImmutableMap CountMap; -static inline CountMap GetMap(void* D) { +static inline CountMap GetMap(void *D) { return CountMap(static_cast(D)); } -static inline CountMap::Factory& GetFactory(void* F) { +static inline CountMap::Factory& GetFactory(void *F) { return *static_cast(F); } diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index 0d0ea8b889..67a5e48a1e 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -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(&P)) return SP->getStmt(); - else if (const BlockEdge* BE = dyn_cast(&P)) + else if (const BlockEdge *BE = dyn_cast(&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(P)) continue; - const DeclRefExpr* DR = dyn_cast(cast(P).getStmt()); + const DeclRefExpr *DR = dyn_cast(cast(P).getStmt()); if (!DR) continue; @@ -367,7 +367,7 @@ GetMostRecentVarDeclBinding(const ExplodedNode* N, if (X != Y) continue; - const VarDecl* VD = dyn_cast(DR->getDecl()); + const VarDecl *VD = dyn_cast(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(B->getLHS()->IgnoreParenCasts()); + DeclRefExpr *DR = dyn_cast(B->getLHS()->IgnoreParenCasts()); if (!DR) return true; VD = dyn_cast(DR->getDecl()); } - else if (const DeclStmt* DS = dyn_cast(S)) { + else if (const DeclStmt *DS = dyn_cast(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 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(&P)) { - const CFGBlock* Src = BE->getSrc(); - const CFGBlock* Dst = BE->getDst(); - const Stmt* T = Src->getTerminator(); + if (const BlockEdge *BE = dyn_cast(&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(S); - const Expr* LHS = Case->getLHS()->IgnoreParenCasts(); + const CaseStmt *Case = cast(S); + const Expr *LHS = Case->getLHS()->IgnoreParenCasts(); // Determine if it is an enum. bool GetRawInt = true; - if (const DeclRefExpr* DR = dyn_cast(LHS)) { + if (const DeclRefExpr *DR = dyn_cast(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(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(&P)) { + if (const PostStmt *PS = dyn_cast(&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(&ProgP)) { + if (BlockEntrance *BE = dyn_cast(&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::getRanges() const { - if (const Expr* E = dyn_cast_or_null(getStmt())) { + if (const Expr *E = dyn_cast_or_null(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(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 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::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); diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index de4780e54d..e8500e3ba8 100644 --- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -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(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(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(); if (!P) diff --git a/lib/StaticAnalyzer/Core/CFRefCount.cpp b/lib/StaticAnalyzer/Core/CFRefCount.cpp index 46aacd473f..3b08fb7fdc 100644 --- a/lib/StaticAnalyzer/Core/CFRefCount.cpp +++ b/lib/StaticAnalyzer/Core/CFRefCount.cpp @@ -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 : public GRStatePartialTrait { - 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 : public GRStatePartialTrait { - static inline void* GDMIndex() { return &AutoRBIndex; } + static inline void *GDMIndex() { return &AutoRBIndex; } }; template<> struct GRStateTrait : public GRStatePartialTrait { - 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(); 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 &Leaked); - ExplodedNode* ProcessLeaks(const GRState * state, + ExplodedNode *ProcessLeaks(const GRState * state, SmallVectorImpl &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 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(); @@ -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 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& 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(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(N->getLocation()).getStmt(); + const Stmt *S = cast(N->getLocation()).getStmt(); if (const CallExpr *CE = dyn_cast(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(N->getLocation()).getStmt(); + const Stmt *S = cast(N->getLocation()).getStmt(); if (const CallExpr *CE = dyn_cast(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(N->getLocation()).getStmt(); + const Stmt *S = cast(N->getLocation()).getStmt(); SVal X = CurrSt->getSValAsScalarOrLoc(cast(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(N->getLocation()).getStmt(); + const Stmt *S = cast(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(*I)) + if (const Expr *Exp = dyn_cast_or_null(*I)) if (CurrSt->getSValAsScalarOrLoc(Exp).getAsLocSymbol() == Sym) { P->addRange(Exp->getSourceRange()); break; @@ -2329,16 +2329,16 @@ namespace { } static std::pair -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(); 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(&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(EndN->getCodeDecl()); + ObjCMethodDecl &MD = cast(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(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(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(CD)) { + if (const ObjCMethodDecl *MD = dyn_cast(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 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(); @@ -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(); } -TransferFuncs* ento::MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled, +TransferFuncs* ento::MakeCFRefCountTF(ASTContext &Ctx, bool GCEnabled, const LangOptions& lopts) { return new CFRefCount(Ctx, GCEnabled, lopts); } diff --git a/lib/StaticAnalyzer/Core/CoreEngine.cpp b/lib/StaticAnalyzer/Core/CoreEngine.cpp index 7a0dc412db..ea7b94c7c3 100644 --- a/lib/StaticAnalyzer/Core/CoreEngine.cpp +++ b/lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -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); diff --git a/lib/StaticAnalyzer/Core/Environment.cpp b/lib/StaticAnalyzer/Core/Environment.cpp index a695437f26..2572c12a14 100644 --- a/lib/StaticAnalyzer/Core/Environment.cpp +++ b/lib/StaticAnalyzer/Core/Environment.cpp @@ -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; diff --git a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp index 5cc0a97d93..503341e93a 100644 --- a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp +++ b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp @@ -134,11 +134,11 @@ void ExplodedGraph::reclaimRecentlyAllocatedNodes() { // ExplodedNode. //===----------------------------------------------------------------------===// -static inline BumpVector& getVector(void* P) { +static inline BumpVector& getVector(void *P) { return *reinterpret_cast*>(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(N) & Mask) == 0x0); assert(!getFlag()); if (getKind() == Size1) { - if (ExplodedNode* NOld = getNode()) { + if (ExplodedNode *NOld = getNode()) { BumpVectorContext &Ctx = G.getNodeAllocator(); BumpVector *V = G.getAllocator().Allocate >(); @@ -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_iterator I = M.find(N); diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp index f6ddf355eb..0e9544c03b 100644 --- a/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -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(S); + const ChooseExpr *C = cast(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(S); + const CastExpr *C = cast(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(S); + const StmtExpr *SE = cast(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(*SE->getSubStmt()->body_rbegin())) { - const GRState* state = Pred->getState(); + if (Expr *LastExpr = dyn_cast(*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(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(Terminator); + const ChooseExpr *C = cast(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(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(D)) { + if (const VarDecl *VD = dyn_cast(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(D)) { + if (const EnumConstantDecl *ED = dyn_cast(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(D)) { + if (const FunctionDecl *FD = dyn_cast(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(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(baseExprVal) || isa(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(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(&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(elem)) { - const VarDecl* elemD = cast(DS->getSingleDecl()); + if (const DeclStmt *DS = dyn_cast(elem)) { + const VarDecl *elemD = cast(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 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(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(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 : // 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 : 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 : default: { if (StmtPoint *L = dyn_cast(&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 : break; } - const BlockEdge& E = cast(Loc); + const BlockEdge &E = cast(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 : } if (isa(T)) { - const Stmt* Label = E.getDst()->getLabel(); + const Stmt *Label = E.getDst()->getLabel(); if (Label) { - if (const CaseStmt* C = dyn_cast(Label)) { + if (const CaseStmt *C = dyn_cast(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 : #ifndef NDEBUG template -ExplodedNode* GetGraphNode(ITERATOR I) { return *I; } +ExplodedNode *GetGraphNode(ITERATOR I) { return *I; } template <> ExplodedNode* GetGraphNode::iterator> diff --git a/lib/StaticAnalyzer/Core/GRState.cpp b/lib/StaticAnalyzer/Core/GRState.cpp index 525b7c7baa..bf6ec19ae8 100644 --- a/lib/StaticAnalyzer/Core/GRState.cpp +++ b/lib/StaticAnalyzer/Core/GRState.cpp @@ -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(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& 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); diff --git a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp index 9f8a989d8f..68a6618878 100644 --- a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -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) { diff --git a/lib/StaticAnalyzer/Core/MemRegion.cpp b/lib/StaticAnalyzer/Core/MemRegion.cpp index 420e486907..160935dde5 100644 --- a/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -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(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(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(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(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(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(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 << ""; } -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(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(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(d, superRegion); } const ObjCIvarRegion* -MemRegionManager::getObjCIvarRegion(const ObjCIvarDecl* d, +MemRegionManager::getObjCIvarRegion(const ObjCIvarDecl *d, const MemRegion* superRegion) { return getSubRegion(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); diff --git a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp index b244dea4e4..cae5bc9a34 100644 --- a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -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) << "\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) << "\n"; } -static raw_ostream& EmitString(raw_ostream& o, +static raw_ostream &EmitString(raw_ostream &o, const std::string& s) { o << ""; 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) << "\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 << "\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) { diff --git a/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp b/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp index ecde983fb6..b66bce46d6 100644 --- a/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ b/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -198,7 +198,7 @@ namespace ento { template<> struct GRStateTrait : public GRStatePartialTrait { - 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(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(); @@ -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(); diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp index d378f10fc0..3cb40e4d17 100644 --- a/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -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(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(); - 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; diff --git a/lib/StaticAnalyzer/Core/SValBuilder.cpp b/lib/StaticAnalyzer/Core/SValBuilder.cpp index 5269ebeac2..4fd492e8cf 100644 --- a/lib/StaticAnalyzer/Core/SValBuilder.cpp +++ b/lib/StaticAnalyzer/Core/SValBuilder.cpp @@ -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)); } diff --git a/lib/StaticAnalyzer/Core/SVals.cpp b/lib/StaticAnalyzer/Core/SVals.cpp index b74ceb7ea6..2f4dca5670 100644 --- a/lib/StaticAnalyzer/Core/SVals.cpp +++ b/lib/StaticAnalyzer/Core/SVals.cpp @@ -143,7 +143,7 @@ SVal::symbol_iterator::symbol_iterator(const SymExpr *SE) { while (!isa(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(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(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(this)->getValue().getZExtValue() << " (Loc)"; diff --git a/lib/StaticAnalyzer/Core/Store.cpp b/lib/StaticAnalyzer/Core/Store.cpp index 8913343b91..92dd8ed1c3 100644 --- a/lib/StaticAnalyzer/Core/Store.cpp +++ b/lib/StaticAnalyzer/Core/Store.cpp @@ -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; diff --git a/lib/StaticAnalyzer/Core/SymbolManager.cpp b/lib/StaticAnalyzer/Core/SymbolManager.cpp index a2fdf28736..255b914985 100644 --- a/lib/StaticAnalyzer/Core/SymbolManager.cpp +++ b/lib/StaticAnalyzer/Core/SymbolManager.cpp @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(sym); } -bool SymbolReaper::isLive(const Stmt* ExprVal) const { +bool SymbolReaper::isLive(const Stmt *ExprVal) const { return LCtx->getAnalysisContext()->getRelaxedLiveVariables()-> isLive(Loc, ExprVal); } diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index e8b027d21c..18a946c195 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -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(D); + FunctionDecl *FD = cast(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(*I); + ObjCImplDecl *ID = cast(*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) {