aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker
AgeCommit message (Collapse)Author
2010-06-17Tweak stack address checker to report multiple cases where globals may ↵Ted Kremenek
reference stack memory. Also refactor the diagnostics so that we print out the kind of stack memory returned. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106210 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17Update CMake build for new attribute changes.Sean Hunt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106188 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17Rework StackAddrLeakChecker to find stores of stack memory addresses to ↵Ted Kremenek
global variables by inspecting the Store bindings instead of iterating over all the global variables in a translation unit. By looking at the store directly, we avoid cases where we cannot directly load from the global variable, such as an array (which can result in an assertion failure) and it also catches cases where we store stack addresses to non-scalar globals. Also, but not iterating over all the globals in the translation unit, we maintain cache locality, and the complexity of the checker becomes restricted to the complexity of the analyzed function, and doesn't scale with the size of the translation unit. This fixes PR 7383. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106184 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17Implement RegionStoreManager::iterBindings(). This implementation only ↵Ted Kremenek
returns the base region in the binding key instead of the region + offset. It isn't clear if this is the best semantics, but most clients will likely only care about simple bindings, or bindings to a particular variable. We can refine later if necessary. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106183 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17Correctly return early from BasicStoreManager::iterBindings() when the ↵Ted Kremenek
BindingsHandler returns false. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106182 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16We return Loc where we know.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106087 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16Typo.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16Although arguments can not be undefined when we get here, they can still beZhongxing Xu
unknown. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106085 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16Cast earlier. We know we can get a DefinedSVal.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106084 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16Register CallAndMessageChecker before AttrNonNullChecker. Then we can assumeZhongxing Xu
arguments are not undefined. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106083 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16Add StreamChecker. This checker models and checks stream manipulation functions.Zhongxing Xu
This is the start. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106082 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16Introduce Type::isIntegralOrEnumerationType(), to cover those placesDouglas Gregor
in C++ that involve both integral and enumeration types. Convert all of the callers to Type::isIntegralType() that are meant to work with both integral and enumeration types over to Type::isIntegralOrEnumerationType(), to prepare to eliminate enumeration types as integral types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106071 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15Break Frontend's dependency on Rewrite, Checker and CodeGen in shared ↵Daniel Dunbar
library configuration Currently, all AST consumers are located in the Frontend library, meaning that in a shared library configuration, Frontend has a dependency on Rewrite, Checker and CodeGen. This is suboptimal for clients which only wish to make use of the frontend. CodeGen in particular introduces a large number of unwanted dependencies. This patch breaks the dependency by moving all AST consumers with dependencies on Rewrite, Checker and/or CodeGen to their respective libraries. The patch therefore introduces dependencies in the other direction (i.e. from Rewrite, Checker and CodeGen to Frontend). After applying this patch, Clang builds correctly using CMake and shared libraries ("cmake -DBUILD_SHARED_LIBS=ON"). N.B. This patch includes file renames which are indicated in the patch body. Changes in this revision of the patch: - Fixed some copy-paste mistakes in the header files - Modified certain aspects of the coding to comply with the LLVM Coding Standards git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106010 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09Remove an entry for a now deleted file. Fixes the neglected CMake build. ;]Chandler Carruth
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105708 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09Merge StackAddrLeakChecker and ReturnStackAddressChecker.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105687 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09Directly compare the StackFrameContext. This greatly simplifies logic andZhongxing Xu
improves generality. Thanks Ted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-08Code cleanup: remove explicit flush() in favor of using the ostream's str()Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105657 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-08Makefiles: Set Clang CPP compiler flags in a single location, instead of ↵Daniel Dunbar
scattered throughout the project Makefiles. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105638 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-08Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.Daniel Dunbar
- This eliminates most dependencies on how Clang is installed relative to LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105637 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-08Add a checker check if a global variable holds a local variable's address afterZhongxing Xu
the function call is left where the local variable is declared. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105602 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07Catch free()s on non-regions and regions known to be not from malloc(), by ↵Jordy Rose
checking the symbol type and memory space. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03Add comments.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-01Limit the use of BindDefault().Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105265 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-01Add support for calloc() in MallocChecker. Patch by Jordy Rose, with my Zhongxing Xu
modification. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105264 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-31After conversations with Zhongxing Xu and Jordy Rose, refine the logic inTed Kremenek
RegionStoreManager::RetrieveElement() that handles indexing into a larger scalar object to only consult the direct binding of a super region if it is a scalar. This isn't perfect yet, and a big FIXME is attached to the code. This causes the test case for PR 7218 now to pass. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105195 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-30Refactor the Is{Std,Clang,LLVM}Namespace methods and rename 'isClangAttr' toNick Lewycky
'IsClangAttr' to match prevailing style in this file. Patch by Jon Mulder! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105170 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-30Convert DeclNodes to use TableGen.Sean Hunt
The macros required for DeclNodes use have changed to match the use of StmtNodes. The FooFirst enumerator constants have been named firstFoo to match usage elsewhere. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105165 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-29Revert r105097. Thinking about a better fix.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105099 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-29Fix PR7218. Patch by Jordy Rose.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27Discard qualifiers for ElementRegions so that a 'const' doesn't change the ↵Ted Kremenek
lookup semantics in the symbol store. We may wish to push this down into the StoreManager itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104788 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26Small fix.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104669 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26Remove extents of dead symbolic regions when RemoveDeadBindings.Zhongxing Xu
This requires creating new persistent states due to the nature of GDM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104668 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25CastSizeChecker checks when casting a malloc'ed symbolic region to type T,Zhongxing Xu
whether the size of the symbolic region is a multiple of the size of T. Fixes PR6123 and PR7217. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104584 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21Update retain-release checker to understand changes to how 'super' is ↵Ted Kremenek
represented in the ASTs. Fixes <rdar://problem/8015556>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104389 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21Pass around an error SourceRange instead of an Expr* when reporting errorsTed Kremenek
in the Objective-C memory checker. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104388 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-19Add clang support for IBOutletCollection.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18Add option '-analyzer-max-loop', which specifies the maximum Zhongxing Xu
number of times the analyzer will go through a loop. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104007 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointedJohn McCall
out. The remaining ones are okay. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15Substantially alter the design of the Objective C type AST by introducingJohn McCall
ObjCObjectType, which is basically just a pair of one of {primitive-id, primitive-Class, user-defined @class} with a list of protocols. An ObjCObjectPointerType is therefore just a pointer which always points to one of these types (possibly sugared). ObjCInterfaceType is now just a kind of ObjCObjectType which happens to not carry any protocols. Alter a rather large number of use sites to use ObjCObjectType instead of ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather than hashing them in a FoldingSet. Remove some number of methods that are no longer used, at least after this patch. By simplifying ObjCObjectPointerType, we are now able to easily remove and apply pointers to Objective-C types, which is crucial for a certain kind of ObjC++ metaprogramming common in WebKit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103870 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13Relax an assertion. Various cases could lead to non-symbol values.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11Merged Elaborated and QualifiedName types.Abramo Bagnara
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103517 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11Fixes for compilation with Microsoft Visual Studio 2010, from Steven Watanabe!Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103458 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-06Turn -analyzer-inline-call on for C functions. This also fixed a bug thatZhongxing Xu
after inlining post-call checking shouldn't be done. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103161 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-06Make -analyzer-inline-call not a separate analysis. Instead it's a boolean Zhongxing Xu
flag now, and can be used with other analyses. Only turned it on for C++ methods for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103160 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05Unbreak CMake build.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103077 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28Completely reimplement __builtin_offsetof, based on a patch by RobertoDouglas Gregor
Amadini. This change introduces a new expression node type, OffsetOfExpr, that describes __builtin_offsetof. Previously, __builtin_offsetof was implemented using a unary operator whose subexpression involved various synthesized array-subscript and member-reference expressions, which was ugly and made it very hard to instantiate as a template. OffsetOfExpr represents the AST more faithfully, with proper type source information and a more compact representation. OffsetOfExpr also has support for dependent __builtin_offsetof expressions; it can be value-dependent, but will never be type-dependent (like sizeof or alignof). This commit introduces template instantiation for __builtin_offsetof as well. There are two major caveats to this patch: 1) CodeGen cannot handle the case where __builtin_offsetof is not a constant expression, so it produces an error. So, to avoid regressing in C, we retain the old UnaryOperator-based __builtin_offsetof implementation in C while using the shiny new OffsetOfExpr implementation in C++. The old implementation can go away once we have proper CodeGen support for this case, which we expect won't cause much trouble in C++. 2) __builtin_offsetof doesn't work well with non-POD class types, particularly when the designated field is found within a base class. I will address this in a subsequent patch. Fixes PR5880 and a bunch of assertions when building Boost.Python tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102542 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26Introduce Type::isStructureOrClassType(), which does the obviousDouglas Gregor
thing. Audit all uses of Type::isStructure(), changing those calls to isStructureOrClassType() as needed (which is alsmost everywhere). Fixes the remaining failure in Boost.Utility/Swap. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102386 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21CXXNamedCastExpr is actually an abstract expression.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101994 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21Use the right predecessor.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101981 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21Add initial support for C++ delete expr.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101980 91177308-0d34-0410-b5e6-96231b3b80d8