aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker
AgeCommit message (Collapse)Author
2010-02-16Add simpler checker to check if variables captured by a block are uninitialized.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96341 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15Convert GRExprEngine's handling of ObjCMessageExprs to use a worklistTed Kremenek
to evaluate arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96293 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14clang::Attr objects should be treated as AST nodes as well byTed Kremenek
the LLVMConventionsChecker. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96202 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14Add LLVM conventions check that scans for AST elements (types, stmts, decls)Ted Kremenek
that allocate heap memory. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96184 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14Change LLVMConventionsChecker to accept an entire translation unit insteadTed Kremenek
of operating on each code decl. This exposes two flaws in AnalysisConsumer that should eventually be fixed: (1) It is not possible to associate multiple "actions" with a single command line argument. This will require the notion of an "analysis" group, and possibly tablegen support. (although eventually we want to support dynamically loading analyses as well) (2) AnalysisConsumer may not actually be scanning the declarations in namespaces. We'll experiment first in LLVMConventionsChecker before changing the behavior in AnalysisConsumer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96183 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14For the StringRef check, also visit the children of DeclStmts.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96181 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14Place type-checking static methods at type of file (where they will congregate).Ted Kremenek
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96180 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14Fix pr6293. If ptr is NULL, no operation is preformed.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96154 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14Add new static analyzer for checking LLVM coding conventions: ↵Ted Kremenek
-analyzer-check-llvm-conventions Currently these checks are intended to be largely syntactical, but may get more sophisticated over time. As an initial foray into this brave new world, emit a static analyzer warning when binding a temporary 'std::string' to an 'llvm::StringRef' where the lifetime of the 'std::string' does not outlive the 'llvm::StringRef'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13Enhance RegionStore::InvalidateRegions() to correctly invalidate bindingsTed Kremenek
by scanning through the values of LazyCompoundVals. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96067 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13Pull logic for visiting value bindings in InvalidateRegionsWorker into a ↵Ted Kremenek
separate method. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96060 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11Eliminate the ASTContext parameter from RecordDecl::getDefinition()Douglas Gregor
and CXXRecordDecl::getDefinition(); it's totally unnecessary. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95836 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10Add comment.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95755 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09Fix lookup of fields from lazy bindings to check if the region isTed Kremenek
NULL, not the store, to determine if a lookup succeeded. The store can be null if it contained no bindings. This fixes a false positive reported to me by a user of the analyzer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95679 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Fix -Asserts warning.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95563 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Simplify another switch/strcmp construct. No functionality/performance change.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95561 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Reapply r95546, no intended change in performance or functionality.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95552 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Revert 95546 since it changed the algorithmic characteristics of the ↵Ted Kremenek
convention lookup. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Simplify code with StringRef.Benjamin Kramer
3 files changed, 76 insertions(+), 153 deletions(-) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95546 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Revert 95541.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Rename: GRState::getSVal(Stmt*) => getExprVal(),Zhongxing Xu
GRState::getSVal(MemRegion*) => Load(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95541 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08BindInternal is redundant. Remove it.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95540 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Like for symbolic region, automatically create a element zero region for Zhongxing Xu
alloca region. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Unify the implementation of getLValueElement of store managers.Zhongxing Xu
It's more sophisticated than the original one of BasicStore. But it does matter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95536 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Unify the implementation of getLValueIvar and getLValueField of store managers.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95535 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Move common methods to the base StoreManager class.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95534 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08ASTContext is now a reference member of StoreManager.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95531 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Add support for binding and retrieving VarRegions in flat store.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95529 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06Also teach RegionStore::RetrieveVar() to handle 'static' pointers that are ↵Ted Kremenek
implicitly initialized to NULL. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95479 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06Fix regression in RegionStore (from BasicStore) where static variables were ↵Ted Kremenek
not treated as being implicitly initialized to 0 (and instead were getting symbolicated). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95478 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06Teach RegionStore::InvalidateRegions() to also invalidate static variables ↵Ted Kremenek
referenced by blocks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95459 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05More GRState* -> Store changes.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95365 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05Remove unused parameter.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95364 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05More GRState* -> Store changes.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95362 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05More GRState* -> Store changes.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95360 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05More GRState* -> Store changes.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95357 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05Change LazyCompoundVal to a <Store, MemRegion*> pair. We really don't need toZhongxing Xu
spread GRState* everywhere. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95354 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04Cast evaluation no longer touch GRState.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95290 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04Specially handle casts to 'void' in AdjustedReturnValueChecker.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95287 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04Remove stray typo.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95286 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04Now that CastRetrievedVal returns SVal, there is no need to use CastResult.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95279 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04static analyzer: handle casts of a function to a function pointer withTed Kremenek
a different return type. While we don't emit any errors (yet), at least we avoid cases where we might crash because of an assertion failure later on (when the return type differs from what is expected). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95268 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03Add FlatStore.cpp (from r95214) to CMake build. Don't forget about it! =DChandler Carruth
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95215 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03Add skeleton of flat store manager.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95214 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03Fix regression in RegionStore due to recent changes inTed Kremenek
RegionStoreManager::InvalidateRegions() by adjusting the worklist to iterate over BindingKeys instead of MemRegions. We also only need to do the actual invalidation work on base regions, and for non-base regions just blow away their bindings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95200 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03Rework RegionStoreManager's implementation of InvalidateRegions() toTed Kremenek
not build a subregion map and instead do a single scan of the store. This is done by building "region clusters" that represent the collection of regions that have the same base region. Invalidating any region in a cluster means that they all should get invalidated. This change brought out a point that Zhongxing mentioned to me offline: the flattened memory binding has issues distinguishing between direct and default bindings. For example, setting the default value for an entire struct is the same as binding to the first element. To address this problem, I moved the binding "tag" (Direct or Default) from BindingVal to BdingKey (and removed BindingVal entirely). This requires us to do double lookups in some cases; and there is still much more cleanup that can be done. This change produced a noticeable speedup when analyzing sqlite3 (a reduction of 4% in running time). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95193 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02Remove RegionStoreSubRegionMap::iterator and ↵Ted Kremenek
RegionStoreSubRegionMap::begin_end(). This is a precursor to using DenseSet to represent region sets instead of ImmutableSet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95151 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02Explicitly check for casts to double or complex types instead of possibly ↵Ted Kremenek
asserting in SValuator. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95128 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02Fix bug in GRExprEngine::VisitSizeOfAlignOfExpr() where we do not addTed Kremenek
'Pred' to 'Dst' for cases we currently don't handle. This fixes <rdar://problem/7593875>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95048 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02Hoist diagnostic generation in ReturnStackAddressChecker into a separate ↵Ted Kremenek
method. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95037 91177308-0d34-0410-b5e6-96231b3b80d8