#
e39bd407 |
| 16-Sep-2015 |
Devin Coughlin <dcoughlin@apple.com> |
[analyzer] Add generateErrorNode() APIs to CheckerContext.
The analyzer trims unnecessary nodes from the exploded graph before reporting path diagnostics. However, in some cases it can trim all node
[analyzer] Add generateErrorNode() APIs to CheckerContext.
The analyzer trims unnecessary nodes from the exploded graph before reporting path diagnostics. However, in some cases it can trim all nodes (including the error node), leading to an assertion failure (see https://llvm.org/bugs/show_bug.cgi?id=24184).
This commit addresses the issue by adding two new APIs to CheckerContext to explicitly create error nodes. Unless the client provides a custom tag, these APIs tag the node with the checker's tag -- preventing it from being trimmed. The generateErrorNode() method creates a sink error node, while generateNonFatalErrorNode() creates an error node for a path that should continue being explored.
The intent is that one of these two methods should be used whenever a checker creates an error node.
This commit updates the checkers to use these APIs. These APIs (unlike addTransition() and generateSink()) do not take an explicit Pred node. This is because there are not any error nodes in the checkers that were created with an explicit different than the default (the CheckerContext's Pred node).
It also changes generateSink() to require state and pred nodes (previously these were optional) to reduce confusion.
Additionally, there were several cases where checkers did check whether a generated node could be null; we now explicitly check for null in these places.
This commit also includes a test case written by Ying Yi as part of http://reviews.llvm.org/D12163 (that patch originally addressed this issue but was reverted because it introduced false positive regressions).
Differential Revision: http://reviews.llvm.org/D12780
llvm-svn: 247859
show more ...
|
#
ca5ab2b0 |
| 15-Sep-2015 |
Devin Coughlin <dcoughlin@apple.com> |
[analyzer] Skip Pre/Post handlers for ObjC calls when receiver is nil.
In Objective-C, method calls with nil receivers are essentially no-ops. They do not fault (although the returned value may be g
[analyzer] Skip Pre/Post handlers for ObjC calls when receiver is nil.
In Objective-C, method calls with nil receivers are essentially no-ops. They do not fault (although the returned value may be garbage depending on the declared return type and architecture). Programmers are aware of this behavior and will complain about a false alarm when the analyzer diagnoses API violations for method calls when the receiver is known to be nil.
Rather than require each individual checker to be aware of this behavior and suppress a warning when the receiver is nil, this commit changes ExprEngineObjC so that VisitObjCMessage skips calling checker pre/post handlers when the receiver is definitely nil. Instead, it adds a new event, ObjCMessageNil, that is only called in that case.
The CallAndMessageChecker explicitly cares about this case, so I've changed it to add a callback for ObjCMessageNil and moved the logic in PreObjCMessage that handles nil receivers to the new callback.
rdar://problem/18092611
Differential Revision: http://reviews.llvm.org/D12123
llvm-svn: 247653
show more ...
|
Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4, llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1, llvmorg-3.6.2, llvmorg-3.6.2-rc1 |
|
#
8d3a7a56 |
| 23-Jun-2015 |
Aaron Ballman <aaron@aaronballman.com> |
Clarify pointer ownership semantics by hoisting the std::unique_ptr creation to the caller instead of hiding it in emitReport. NFC.
llvm-svn: 240400
|
Revision tags: llvmorg-3.6.1, llvmorg-3.6.1-rc1, llvmorg-3.5.2, llvmorg-3.5.2-rc1, llvmorg-3.6.0, llvmorg-3.6.0-rc4, llvmorg-3.6.0-rc3, llvmorg-3.6.0-rc2, llvmorg-3.6.0-rc1, llvmorg-3.5.1, llvmorg-3.5.1-rc2, llvmorg-3.5.1-rc1, llvmorg-3.5.0, llvmorg-3.5.0-rc4, llvmorg-3.5.0-rc3, llvmorg-3.5.0-rc2, llvmorg-3.5.0-rc1 |
|
#
0dbb783c |
| 27-May-2014 |
Craig Topper <craig.topper@gmail.com> |
[C++11] Use 'nullptr'. StaticAnalyzer edition.
llvm-svn: 209642
|
Revision tags: llvmorg-3.4.2, llvmorg-3.4.2-rc1, llvmorg-3.4.1, llvmorg-3.4.1-rc2, llvmorg-3.4.1-rc1 |
|
#
821a3a0f |
| 13-Mar-2014 |
Jordan Rose <jordan_rose@apple.com> |
[analyzer] Warn when passing pointers to const but uninitialized memory.
Passing a pointer to an uninitialized memory buffer is normally okay, but if the function is declared to take a pointer-to-co
[analyzer] Warn when passing pointers to const but uninitialized memory.
Passing a pointer to an uninitialized memory buffer is normally okay, but if the function is declared to take a pointer-to-const then it's very unlikely it will be modifying the buffer. In this case the analyzer should warn that there will likely be a read of uninitialized memory.
This doesn't check all elements of an array, only the first one. It also doesn't yet check Objective-C methods, only C functions and C++ methods.
This is controlled by a new check: alpha.core.CallAndMessageUnInitRefArg.
Patch by Per Viberg!
llvm-svn: 203822
show more ...
|
#
e8a8baef |
| 08-Mar-2014 |
Aaron Ballman <aaron@aaronballman.com> |
[C++11] Replacing RecordDecl iterators field_begin() and field_end() with iterator_range fields(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203355
|
#
b8984329 |
| 07-Mar-2014 |
Ahmed Charles <ahmedcharles@gmail.com> |
Replace OwningPtr with std::unique_ptr.
This compiles cleanly with lldb/lld/clang-tools-extra/llvm.
llvm-svn: 203279
|
#
867ea1d4 |
| 02-Mar-2014 |
Benjamin Kramer <benny.kra@googlemail.com> |
[C++11] Replace llvm::tie with std::tie.
llvm-svn: 202639
|
#
6a619222 |
| 17-Feb-2014 |
Anton Yartsev <anton.yartsev@gmail.com> |
[analyzer] Improved checker naming in CFG dump.
This implements FIXME from Checker.cpp (FIXME: We want to return the package + name of the checker here.) and replaces hardcoded checker names with th
[analyzer] Improved checker naming in CFG dump.
This implements FIXME from Checker.cpp (FIXME: We want to return the package + name of the checker here.) and replaces hardcoded checker names with the new ones obtained via getCheckName().getName().
llvm-svn: 201525
show more ...
|
#
4aca9b1c |
| 11-Feb-2014 |
Alexander Kornienko <alexfh@google.com> |
Expose the name of the checker producing each diagnostic message.
Summary: In clang-tidy we'd like to know the name of the checker producing each diagnostic message. PathDiagnostic has BugType and C
Expose the name of the checker producing each diagnostic message.
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
show more ...
|
#
b190f974 |
| 03-Jan-2014 |
Aaron Ballman <aaron@aaronballman.com> |
Fixed a FIXME; created a print method for Selectors that accepts a raw_ostream, and started using it in places it made sense.
No functional changes intended, just API cleanliness.
llvm-svn: 198428
|
Revision tags: llvmorg-3.4.0, llvmorg-3.4.0-rc3, llvmorg-3.4.0-rc2, llvmorg-3.4.0-rc1 |
|
#
44e066c7 |
| 02-Oct-2013 |
Jordan Rose <jordan_rose@apple.com> |
[analyzer] Add missing return after function pointer null check.
Also add some tests that there is actually a message and that the bug is actually a hard error. This actually behaved correctly befor
[analyzer] Add missing return after function pointer null check.
Also add some tests that there is actually a message and that the bug is actually a hard error. This actually behaved correctly before, because:
- addTransition() doesn't actually add a transition if the new state is null; it assumes you want to propagate the predecessor forward and does nothing. - generateSink() is called in order to emit a bug report. - If at least one new node has been generated, the predecessor node is /not/ propagated forward.
But now it's spelled out explicitly.
Found by Richard Mazorodze, who's working on a patch that may require this.
llvm-svn: 191805
show more ...
|
#
556d91e2 |
| 14-Sep-2013 |
Cameron Esfahani <dirty@apple.com> |
Clean up some Triple usage in clang.
llvm-svn: 190737
|
#
867b185e |
| 09-Aug-2013 |
Jordan Rose <jordan_rose@apple.com> |
[analyzer] Warn when using 'delete' on an uninitialized variable.
Patch by Karthik Bhat, modified slightly by me.
llvm-svn: 188043
|
Revision tags: llvmorg-3.3.1-rc1 |
|
#
963f91b3 |
| 19-Jun-2013 |
Pavel Labath <labath@google.com> |
Fix a crash in the static analyzer (bug #16307)
Summary: When processing a call to a function, which got passed less arguments than it expects, the analyzer would crash.
I've also added a test for
Fix a crash in the static analyzer (bug #16307)
Summary: When processing a call to a function, which got passed less arguments than it expects, the analyzer would crash.
I've also added a test for that and a analyzer warning which detects these cases.
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D994
llvm-svn: 184288
show more ...
|
Revision tags: llvmorg-3.3.0, llvmorg-3.3.0-rc3, llvmorg-3.3.0-rc2, llvmorg-3.3.0-rc1 |
|
#
c610bcac |
| 03-Apr-2013 |
Anna Zaks <ganna@apple.com> |
[analyzer] Warn when nil receiver results in forming null reference
This also allows us to ensure IDC/return null suppression gets triggered in such cases.
llvm-svn: 178686
|
#
22fa6ecc |
| 27-Mar-2013 |
Anna Zaks <ganna@apple.com> |
[analyzer] Ensure that the node NilReceiverBRVisitor is looking for is not reclaimed
The visitor should look for the PreStmt node as the receiver is nil in the PreStmt and this is the node. Also, ta
[analyzer] Ensure that the node NilReceiverBRVisitor is looking for is not reclaimed
The visitor should look for the PreStmt node as the receiver is nil in the PreStmt and this is the node. Also, tag the nil receiver nodes with a special tag for consistency.
llvm-svn: 178152
show more ...
|
#
05785d16 |
| 20-Feb-2013 |
David Blaikie <dblaikie@gmail.com> |
Include llvm::Optional in clang/Basic/LLVM.h
Post-commit CR feedback from Jordan Rose regarding r175594.
llvm-svn: 175679
|
#
2fdacbc5 |
| 20-Feb-2013 |
David Blaikie <dblaikie@gmail.com> |
Replace SVal llvm::cast support to be well-defined.
See r175462 for another example/more details.
llvm-svn: 175594
|
#
aea020f0 |
| 26-Jan-2013 |
Jordan Rose <jordan_rose@apple.com> |
[analyzer] Track null object lvalues back through C++ method calls.
The expression 'a->b.c()' contains a call to the 'c' method of 'a->b'. We emit an error if 'a' is NULL, but previously didn't actu
[analyzer] Track null object lvalues back through C++ method calls.
The expression 'a->b.c()' contains a call to the 'c' method of 'a->b'. We emit an error if 'a' is NULL, but previously didn't actually track the null value back through the 'a->b' expression, which caused us to miss important false-positive-suppression cases, including <rdar://problem/12676053>.
llvm-svn: 173547
show more ...
|
Revision tags: llvmorg-3.2.0, llvmorg-3.2.0-rc3 |
|
#
3a02247d |
| 04-Dec-2012 |
Chandler Carruth <chandlerc@gmail.com> |
Sort all of Clang's files under 'lib', and fix up the broken headers uncovered.
This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/util
Sort all of Clang's files under 'lib', and fix up the broken headers 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
show more ...
|
#
444a1304 |
| 01-Dec-2012 |
Benjamin Kramer <benny.kra@googlemail.com> |
Include pruning and general cleanup.
llvm-svn: 169095
|
Revision tags: llvmorg-3.2.0-rc2, llvmorg-3.2.0-rc1 |
|
#
e10d5a76 |
| 02-Nov-2012 |
Jordan Rose <jordan_rose@apple.com> |
[analyzer] Rename 'EmitReport' to 'emitReport'.
No functionality change.
llvm-svn: 167275
|
#
199f8da3 |
| 10-Sep-2012 |
Benjamin Kramer <benny.kra@googlemail.com> |
Make helper functions static.
llvm-svn: 163505
|
#
a0f7d35a |
| 28-Aug-2012 |
Jordan Rose <jordan_rose@apple.com> |
[analyzer] Rename addTrackNullOrUndefValueVisitor to trackNullOrUndefValue.
This helper function (in the clang::ento::bugreporter namespace) may add more than one visitor, but conceptually it's trac
[analyzer] Rename addTrackNullOrUndefValueVisitor to trackNullOrUndefValue.
This helper function (in the clang::ento::bugreporter namespace) may add more than one visitor, but conceptually it's tracking a single use of a null or undefined value and should do so as best it can.
Also, the BugReport parameter has been made a reference to underscore that it is non-optional.
llvm-svn: 162720
show more ...
|