summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer] Apply whitespace cleanups by Honggyu Kim.Ted Kremenek2015-09-081-4/+4
| | | | llvm-svn: 246978
* Rewrite users of Stmt::child_begin/end into for-range loops.Benjamin Kramer2015-07-031-4/+3
| | | | | | No functionality change intended. llvm-svn: 241355
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* [analyzer] Tweak MallocSizeOfChecker to not warn when using sizeof(void*) to ↵Ted Kremenek2014-10-191-0/+4
| | | | | | | | | | | allocate a bunch of any pointer type. This suppresses a common false positive when analyzing libc++. Along the way, introduce some tests to show this checker actually works with C++ static_cast<>. llvm-svn: 220160
* [C++11] Use 'nullptr'. StaticAnalyzer edition.Craig Topper2014-05-271-2/+2
| | | | llvm-svn: 209642
* [C++11] Replacing DeclStmt iterators decl_begin() and decl_end() with ↵Aaron Ballman2014-03-141-3/+2
| | | | | | iterator_range decls(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203947
* Expose the name of the checker producing each diagnostic message.Alexander Kornienko2014-02-111-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In clang-tidy we'd like to know the name of the checker producing each diagnostic message. PathDiagnostic has BugType and Category fields, which are both arbitrary human-readable strings, but we need to know the exact name of the checker in the form that can be used in the CheckersControlList option to enable/disable the specific checker. This patch adds the CheckName field to the CheckerBase class, and sets it in the CheckerManager::registerChecker() method, which gets them from the CheckerRegistry. Checkers that implement multiple checks have to store the names of each check in the respective registerXXXChecker method. Reviewers: jordan_rose, krememek Reviewed By: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2557 llvm-svn: 201186
* [analyzer] ArrayRef-ize BugReporter::EmitBasicReport.Jordan Rose2013-10-071-1/+1
| | | | | | No functionality change. llvm-svn: 192114
* [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