summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer] Replace isIntegerType() with isIntegerOrEnumerationType().Jordan Rose2013-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Previously, the analyzer used isIntegerType() everywhere, which uses the C definition of "integer". The C++ predicate with the same behavior is isIntegerOrUnscopedEnumerationType(). However, the analyzer is /really/ using this to ask if it's some sort of "integrally representable" type, i.e. it should include C++11 scoped enumerations as well. hasIntegerRepresentation() sounds like the right predicate, but that includes vectors, which the analyzer represents by its elements. This commit audits all uses of isIntegerType() and replaces them with the general isIntegerOrEnumerationType(), except in some specific cases where it makes sense to exclude scoped enumerations, or any enumerations. These cases now use isIntegerOrUnscopedEnumerationType() and getAs<BuiltinType>() plus BuiltinType::isInteger(). isIntegerType() is hereby banned in the analyzer - lib/StaticAnalysis and include/clang/StaticAnalysis. :-) Fixes real assertion failures. PR15703 / <rdar://problem/12350701> llvm-svn: 179081
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-2/+2
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Include pruning and general cleanup.Benjamin Kramer2012-12-011-0/+1
| | | | llvm-svn: 169095
* [analyzer] Address John's code review for r163407.Anna Zaks2012-09-081-12/+15
| | | | | | | Teach malloc sizeof checker to find type inconsistencies in multi- dimensional arrays. llvm-svn: 163438
* [analyzer] Fix a false positive in sizeof malloc checker.Anna Zaks2012-09-071-33/+49
| | | | | | | Don't warn when the sizeof argument is an array with the same element type as the pointee of the return type. llvm-svn: 163407
* Fix indentation.Ted Kremenek2012-09-041-3/+3
| | | | llvm-svn: 163176
* [analyzer] RetainCountChecker: don't assume all functions have names.Jordan Rose2012-08-311-3/+7
| | | | | | | | | | | | | | | Fixes a hard-to-reach crash when calling a non-member overloaded operator with arguments that may be callbacks. Future-proofing: don't make the same assumption in MallocSizeofChecker. Aside from possibly respecting attributes in the future, it might be possible to call 'malloc' through a function pointer. I audited all other uses of FunctionDecl::getIdentifier() in the analyzer; they all now correctly test to see if the identifier is present before using it. llvm-svn: 163012
* [analyzer] MallocSizeofChecker false positive: when sizeof is argumentAnna Zaks2012-06-081-5/+0
| | | | | | | | | | | | | | to addition. We should not to warn in case the malloc size argument is an addition containing 'sizeof' operator - it is common to use the pattern to pack values of different sizes into a buffer. Ex: uint8_t *buffer = (uint8_t*)malloc(dataSize + sizeof(length)); llvm-svn: 158219
* [analyzer]Turn on MallocSizeOfChecker by default; shorten the diagnosticAnna Zaks2012-05-071-4/+3
| | | | llvm-svn: 156341
* malloc size checker: Ignore const'ness of pointer types when determining of ↵Ted Kremenek2012-05-011-1/+24
| | | | | | | | a sizeof() type is compatible with a pointed type. Fixes <rdar://problem/11292586>. llvm-svn: 155864
* Require that all static analyzer issues have a category. As part of this ↵Ted Kremenek2012-04-051-1/+3
| | | | | | | | | | change, consolidate some commonly used category strings into global references (more of this can be done, I just did a few). Fixes <rdar://problem/11191537>. llvm-svn: 154121
* Include the "issue context" (e.g. function or method) where a static ↵Ted Kremenek2012-04-041-2/+2
| | | | | | | | analyzer issue occurred in the plist output. Fixes <rdar://problem/11004527> llvm-svn: 154030
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Move a method from IdentifierTable.h out of line and remove the SmallString ↵Benjamin Kramer2012-02-041-0/+1
| | | | | | | | include. Fix all the transitive include users. llvm-svn: 149783
* Unbreak MSVC build.Francois Pichet2011-12-081-1/+1
| | | | llvm-svn: 146146
* Add an experimental MallocSizeofChecker, which reports inconsistenciesPeter Collingbourne2011-12-081-0/+208
between the casted type of the return value of a malloc/calloc/realloc call and the operand of any sizeof expressions contained within its argument(s). llvm-svn: 146144
OpenPOWER on IntegriCloud