diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-04-02 08:55:10 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-04-02 08:55:10 +0000 |
commit | 11d2b2d2bb706fca0656f2760839721bb7f6cb6f (patch) | |
tree | d374cdca417e76f1bf101f139dba2db1d10ee8f7 /lib/Analysis | |
parent | c0c7bca4e5b8d12699dc93a0da49e9e4bb79671b (diff) |
Notes
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/AnalysisContext.cpp | 28 | ||||
-rw-r--r-- | lib/Analysis/CFG.cpp | 2 | ||||
-rw-r--r-- | lib/Analysis/PrintfFormatString.cpp | 2 |
3 files changed, 18 insertions, 14 deletions
diff --git a/lib/Analysis/AnalysisContext.cpp b/lib/Analysis/AnalysisContext.cpp index 5640c4a461e00..06d8aec3910e2 100644 --- a/lib/Analysis/AnalysisContext.cpp +++ b/lib/Analysis/AnalysisContext.cpp @@ -54,8 +54,12 @@ const ImplicitParamDecl *AnalysisContext::getSelfDecl() const { } CFG *AnalysisContext::getCFG() { - if (!cfg) + if (!builtCFG) { cfg = CFG::buildCFG(D, getBody(), &D->getASTContext(), AddEHEdges); + // Even when the cfg is not successfully built, we don't + // want to try building it again. + builtCFG = true; + } return cfg; } @@ -126,9 +130,9 @@ LocationContextManager::getLocationContext(AnalysisContext *ctx, llvm::FoldingSetNodeID ID; LOC::Profile(ID, ctx, parent, d); void *InsertPos; - + LOC *L = cast_or_null<LOC>(Contexts.FindNodeOrInsertPos(ID, InsertPos)); - + if (!L) { L = new LOC(ctx, parent, d); Contexts.InsertNode(L, InsertPos); @@ -144,7 +148,7 @@ LocationContextManager::getStackFrame(AnalysisContext *ctx, llvm::FoldingSetNodeID ID; StackFrameContext::Profile(ID, ctx, parent, s, blk, idx); void *InsertPos; - StackFrameContext *L = + StackFrameContext *L = cast_or_null<StackFrameContext>(Contexts.FindNodeOrInsertPos(ID, InsertPos)); if (!L) { L = new StackFrameContext(ctx, parent, s, blk, idx); @@ -253,7 +257,7 @@ public: IgnoredContexts.insert(BR->getBlockDecl()); Visit(BR->getBlockDecl()->getBody()); } -}; +}; } // end anonymous namespace typedef BumpVector<const VarDecl*> DeclVec; @@ -263,16 +267,16 @@ static DeclVec* LazyInitializeReferencedDecls(const BlockDecl *BD, llvm::BumpPtrAllocator &A) { if (Vec) return (DeclVec*) Vec; - + BumpVectorContext BC(A); DeclVec *BV = (DeclVec*) A.Allocate<DeclVec>(); new (BV) DeclVec(BC, 10); - + // Find the referenced variables. FindBlockDeclRefExprsVals F(*BV, BC); F.Visit(BD->getBody()); - - Vec = BV; + + Vec = BV; return BV; } @@ -281,7 +285,7 @@ std::pair<AnalysisContext::referenced_decls_iterator, AnalysisContext::getReferencedBlockVars(const BlockDecl *BD) { if (!ReferencedBlockVars) ReferencedBlockVars = new llvm::DenseMap<const BlockDecl*,void*>(); - + DeclVec *V = LazyInitializeReferencedDecls(BD, (*ReferencedBlockVars)[BD], A); return std::make_pair(V->begin(), V->end()); } @@ -310,12 +314,12 @@ LocationContextManager::~LocationContextManager() { void LocationContextManager::clear() { for (llvm::FoldingSet<LocationContext>::iterator I = Contexts.begin(), - E = Contexts.end(); I != E; ) { + E = Contexts.end(); I != E; ) { LocationContext *LC = &*I; ++I; delete LC; } - + Contexts.clear(); } diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index a4a021f20b21c..f94f6b3f127fe 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -571,7 +571,7 @@ static bool CanThrow(Expr *E) { CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, AddStmtChoice asc) { // If this is a call to a no-return function, this stops the block here. bool NoReturn = false; - if (C->getCallee()->getType().getNoReturnAttr()) { + if (getFunctionExtInfo(*C->getCallee()->getType()).getNoReturn()) { NoReturn = true; } diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp index 46acc8a377bf1..c38aae34764c9 100644 --- a/lib/Analysis/PrintfFormatString.cpp +++ b/lib/Analysis/PrintfFormatString.cpp @@ -75,7 +75,7 @@ static OptionalAmount ParseAmount(const char *&Beg, const char *E) { char c = *I; if (c >= '0' && c <= '9') { hasDigits = true; - accumulator += (accumulator * 10) + (c - '0'); + accumulator = (accumulator * 10) + (c - '0'); continue; } |