aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker
AgeCommit message (Collapse)Author
2010-03-21Delete the new visitor if an old one already exists.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99114 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20Reapply r99024 (but with the memory issue now fixed).Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99064 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20Check if a BugReporterVisitor has already been added to a BugReporterContext.Ted Kremenek
This avoids redundant diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99063 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20Revert r99024, "Augment path diagnostics to include displaying when a messageDaniel Dunbar
expression", statistical evidence indicates it has some kind of memory error. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99040 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20Augment path diagnostics to include displaying when a message expressionTed Kremenek
is not evaluated because the receiver is nil. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99024 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18Refactor argument checking in CallAndMessageChecker to be the sameTed Kremenek
for both CallExprs and ObjCMessageExprs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18Detect pass-by-value arguments that are structs that containTed Kremenek
uninitialized data. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98796 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18Tweak dead stores checker to not emit a warning when initializationTed Kremenek
a scalar variable with a scalar parameter. This is a form of defensive programming. If the variable is unused, it will be caused by -Wunused-variable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98795 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17Mark CXXThisRegion in the current or parent stack frame context as live so thatZhongxing Xu
their bindings are not removed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98705 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16Add VisitCXXContructExpr logic to the analyzer. This still has not fully workedZhongxing Xu
since RemoveDeadBinding mistakenly remove the binding to CXXThisRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98629 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12Allow users to set CPPFLAGS and CXXFLAGS on the make command line.Jeffrey Yasskin
Tested: make CPPFLAGS=-m64 CXXFLAGS=-m64 -j8 && (cd tools/clang;make test) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98399 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Simplify assertion.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98176 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Remove '#if 0' code. Lazy compound values have proven their worth.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98175 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Remove the subregion map cache. It is no longer used.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98161 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Fix stale comment.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98160 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Really apply (unnoticed weird git-svn merge conflict in 98144): Refactor ↵Ted Kremenek
RegionStore::RemoveDeadBindings to use the same core cluster analysis algorithm as RegionStore::InvalidateRegions(). Beyond simplifying the algorithm significantly, we no longer need to build subregion maps in RemoveDeadBindings(). This and other changes cause a significant speedup: the time to analyze sqlite3.c (single core) drops by 14%. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98159 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Refactor RegionStore::RemoveDeadBindings to use the same coreTed Kremenek
cluster analysis algorithm as RegionStore::InvalidateRegions(). Beyond simplifying the algorithm significantly, we no longer need to build subregion maps in RemoveDeadBindings(). This and other changes cause a significant speedup: the time to analyze sqlite3.c (single core) drops by 14%. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98144 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Refactor some of RegionStore's InvalidateRegionsWorker classTed Kremenek
into a 'ClusterAnalysis' parent class. The idea is to potentially reuse this for reworking RemoveDeadBindings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98143 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Add use-after-free check to MallocChecker.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98136 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Enhance basic store to also lazily symbolicate VarRegionsTed Kremenek
with an 'unknown' memory space. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98110 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08Extend ObjCMessageExpr for class method sends with the source locationDouglas Gregor
of the class name. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97943 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08Remove unused headers.Duncan Sands
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97941 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-05Remove reference to AnalysisContext in Environment. We already have ↵Zhongxing Xu
LocationContext information in ExplodedNode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97785 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04When profiling Environment, also profile with AnalysisContext*, bacauseZhongxing Xu
we now may have identical states with different analysis context. Set the right AnalysisContext in state when entering and leaving a callee. With both of the above changes, we can pass the test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97724 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02[CFG]Ted Kremenek
After discussion with Zhongxing, don't force the initializer of DeclStmts to be block-level expressions. This led to some interesting fallout: [UninitializedValues] Always visit the initializer of DeclStmts (do not assume they are block-level expressions). [BasicStore] With initializers of DeclStmts no longer block-level expressions, this causes self-referencing initializers (e.g. 'int x = x') to no longer cause the initialized variable to be live before the DeclStmt. While this is correct, it caused BasicStore::RemoveDeadBindings() to prune off the values of these variables from the initial store (where they are set to uninitialized). The fix is to back-port some (and only some) of the lazy-binding logic from RegionStore to BasicStore. Now the default values of local variables are determined lazily as opposed to explicitly initialized. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97591 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02Don't conjure a symbol for DeclStmts when the variable is a C++ reference.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97590 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01Since now we store the cast type with an ElementRegion, there isZhongxing Xu
no need to store a type with SymbolRegionValue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97437 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01Assert when loading from a code text region instead of returning an unknown ↵Zhongxing Xu
silently. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28Use getBody() to get the function definition when the decl referenced is notZhongxing Xu
definition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97373 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26Use a GDM to record the returned expression in the state when VisitReturnStmt.Zhongxing Xu
Use this information to find the returned value and bind it to CallExpr in ProcessCallExit. And there is no need to remove dead bindings in ProcessCallExit, because a. it would clean up the return value bound to CallExpr b. we still would do it in the next ProcessStmt(), where we would not misclean up the return value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97225 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26Remove derelict GRStmtNodeBuilder::LastNode.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97207 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Restore Zhongxing's commits r97122 r97127 r97129 r97131 which were reverted ↵Douglas Gregor
due to a Clang-on-Clang failure git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97162 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Revert patches r97122 r97127 r97129 r97131.Jakob Stoklund Olesen
They were breaking clang-x86_64-darwin10-selfhost git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97138 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Move the GenerateCallExitNode logic completely into GREndPathNodeBuilder.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97131 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Move the dead bindings removal logic from CallInliner to ↵Zhongxing Xu
GRExprEngine::ProcessCallExit(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97129 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Add comments.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97127 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Call inliner improvements:Zhongxing Xu
This patch implements the CallEnter/CallExit idea of Ted. Add two interfaces to GRSubEngine: ProcessCallEnter, ProcessCallExit. The CallEnter program point uses caller's location context. The CallExit program point uses callee's location context. CallEnter is built by GRStmtNodeBuilder. CallExit is built by GREndPathNodeBuilder. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97122 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Add MacOSXAPIChecker, a meta checker to include various precondition checks ↵Ted Kremenek
for calls to various MacOS X functions. The checks in BasicObjCFoundationChecks.cpp will gradually be migrated here. As a first check, check that when 'dispatch_once()' is passed a predicate value that has non-local storage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97116 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25When generating error node, check to see if we already cached out.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97115 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Enhance the unused ivar checker to not consider an ivar to be accidentally ↵Ted Kremenek
unused when it is explicitly marked as unused via __attribute__((unused)). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97104 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Add UnixAPIChecker, a meta checker to include various precondition checks ↵Ted Kremenek
for calls to various unix/posix functions, e.g. 'open()'. As a first check, check that when 'open()' is passed 'O_CREAT' that it has a third argument. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Remove stray #include.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97085 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Remove #include.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97084 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Divide list of registration functions in API and foundational checks. Also ↵Ted Kremenek
trim whitespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97083 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25Sort list of checker registration functions.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97082 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23Dead emit dead store warnings when assigning nil to an ObjC objectTed Kremenek
pointer (for defensive programming). This matches the behavior with assigning NULL to a regular pointer. Fixes <rdar://problem/7631278>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96985 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18Recognize attributes ns_returns_not_retained and cf_returns_not_retainedTed Kremenek
in the static analyzer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18Sort @includes.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96537 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17In symbol reaper, a variable is live if its stack frame is the parent of the Zhongxing Xu
current stack frame. When leaving a callee, remove all bindings belonging to that callee. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17For inline-based inter-procedural analysis, we will have multiple stack ↵Zhongxing Xu
space regions. Use a dense map to store them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96472 91177308-0d34-0410-b5e6-96231b3b80d8