History log of /llvm-project/clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp (Results 26 – 50 of 53)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-3.8.0, llvmorg-3.8.0-rc3, llvmorg-3.8.0-rc2
# 343730c5 22-Jan-2016 Gabor Horvath <xazax.hun@gmail.com>

[analyzer] Utility to match function calls.

This patch adds a small utility to match function calls. This utility abstracts away the mutable keywords and the lazy initialization and caching logic of

[analyzer] Utility to match function calls.

This patch adds a small utility to match function calls. This utility abstracts away the mutable keywords and the lazy initialization and caching logic of identifiers from the checkers. The SimpleStreamChecker is ported over this utility within this patch to show the reduction of code and to test this change.

Differential Revision: http://reviews.llvm.org/D15921

llvm-svn: 258572

show more ...


Revision tags: llvmorg-3.8.0-rc1, llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1
# 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 ...


Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3
# 903c2934 13-Aug-2015 David Blaikie <dblaikie@gmail.com>

Wdeprecated: CollectReachableSymbolsCallback are move constructed/returned by value, so make sure they're copy/moveable

(return by value is in ExprEngine::processPointerEscapedOnBind and any
other c

Wdeprecated: CollectReachableSymbolsCallback are move constructed/returned by value, so make sure they're copy/moveable

(return by value is in ExprEngine::processPointerEscapedOnBind and any
other call to the scanReachableSymbols function template used there)

Protect the special members in the base class to avoid slicing, and make
derived classes final so these special members don't accidentally become
public on an intermediate base which would open up the possibility of
slicing again.

llvm-svn: 244975

show more ...


Revision tags: 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
# 22c68ef8 11-Sep-2014 Benjamin Kramer <benny.kra@googlemail.com>

Avoid some unnecessary SmallVector copies.

No functionality change.

llvm-svn: 217586


Revision tags: 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
# fb6b25b5 15-Mar-2014 Craig Topper <craig.topper@gmail.com>

[C++11] Add 'override' keyword to virtual methods that override their base class.

llvm-svn: 203999


# 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


# 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 ...


Revision tags: llvmorg-3.4.0, llvmorg-3.4.0-rc3, llvmorg-3.4.0-rc2, llvmorg-3.4.0-rc1, llvmorg-3.3.1-rc1
# 2341c0d3 04-Jul-2013 Craig Topper <craig.topper@gmail.com>

Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily.

llvm-svn: 185610


Revision tags: llvmorg-3.3.0, llvmorg-3.3.0-rc3, llvmorg-3.3.0-rc2
# 757fbb0b 10-May-2013 Jordan Rose <jordan_rose@apple.com>

[analyzer] Indirect invalidation counts as an escape for leak checkers.

Consider this example:

char *p = malloc(sizeof(char));
systemFunction(&p);
free(p);

In this case, when we call systemF

[analyzer] Indirect invalidation counts as an escape for leak checkers.

Consider this example:

char *p = malloc(sizeof(char));
systemFunction(&p);
free(p);

In this case, when we call systemFunction, we know (because it's a system
function) that it won't free 'p'. However, we /don't/ know whether or not
it will /change/ 'p', so the analyzer is forced to invalidate 'p', wiping
out any bindings it contains. But now the malloc'd region looks like a
leak, since there are no more bindings pointing to it, and we'll get a
spurious leak warning.

The fix for this is to notice when something is becoming inaccessible due
to invalidation (i.e. an imperfect model, as opposed to being explicitly
overwritten) and stop tracking it at that point. Currently, the best way
to determine this for a call is the "indirect escape" pointer-escape kind.

In practice, all the patch does is take the "system functions don't free
memory" special case and limit it to direct parameters, i.e. just the
arguments to a call and not other regions accessible to them. This is a
conservative change that should only cause us to escape regions more
eagerly, which means fewer leak warnings.

This isn't perfect for several reasons, the main one being that this
example is treated the same as the one above:

char **p = malloc(sizeof(char *));
systemFunction(p + 1);
// leak

Currently, "addresses accessible by offsets of the starting region" and
"addresses accessible through bindings of the starting region" are both
considered "indirect" regions, hence this uniform treatment.

Another issue is our longstanding problem of not distinguishing const and
non-const bindings; if in the first example systemFunction's parameter were
a char * const *, we should know that the function will not overwrite 'p',
and thus we can safely report the leak.

<rdar://problem/13758386>

llvm-svn: 181607

show more ...


Revision tags: llvmorg-3.3.0-rc1
# acdc13cb 07-Feb-2013 Anna Zaks <ganna@apple.com>

[analyzer] Add pointer escape type param to checkPointerEscape callback

The checkPointerEscape callback previously did not specify how a
pointer escaped. This change includes an enum which describes

[analyzer] Add pointer escape type param to checkPointerEscape callback

The checkPointerEscape callback previously did not specify how a
pointer escaped. This change includes an enum which describes the
different ways a pointer may escape. This enum is passed to the
checkPointerEscape callback when a pointer escapes. If the escape
is due to a function call, the call is passed. This changes
previous behavior where the call is passed as NULL if the escape
was due to indirectly invalidating the region the pointer referenced.

A patch by Branden Archer!

llvm-svn: 174677

show more ...


# f857950d 12-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com>

Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h

llvm-svn: 172323


# 0dffbd6b 22-Dec-2012 Anna Zaks <ganna@apple.com>

[analyzer] Convert SimpleStreamChecker to use the PointerEscape callback

The new callback greatly simplifies the checker.

llvm-svn: 170969


Revision tags: llvmorg-3.2.0
# dc15415d 20-Dec-2012 Anna Zaks <ganna@apple.com>

[analyzer] Add the pointer escaped callback.

Instead of using several callbacks to identify the pointer escape event,
checkers now can register for the checkPointerEscape.

Converted the Malloc chec

[analyzer] Add the pointer escaped callback.

Instead of using several callbacks to identify the pointer escape event,
checkers now can register for the checkPointerEscape.

Converted the Malloc checker to use the new callback.
SimpleStreamChecker will be converted next.

llvm-svn: 170625

show more ...


Revision tags: 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 ...


Revision tags: llvmorg-3.2.0-rc2, llvmorg-3.2.0-rc1
# 2ed51255 06-Nov-2012 Anna Zaks <ganna@apple.com>

[analyzer] Add symbol escapes logic to the SimpleStreamChecker.

llvm-svn: 167439


# 58e82934 02-Nov-2012 Jordan Rose <jordan_rose@apple.com>

[analyzer] Convert SimpleStreamChecker over to CallEvent.

llvm-svn: 167340


# da27efed 02-Nov-2012 Anna Zaks <ganna@apple.com>

[analyzer] Factor SimpleStreamChecker pulling out isLeaked().

llvm-svn: 167316


# e10d5a76 02-Nov-2012 Jordan Rose <jordan_rose@apple.com>

[analyzer] Rename 'EmitReport' to 'emitReport'.

No functionality change.

llvm-svn: 167275


# 2b213720 01-Nov-2012 Jordan Rose <jordan_rose@apple.com>

[analyzer] Minor cleanup in SimpleStreamChecker's class definition.

No functionality change.

llvm-svn: 167187


# 14fe9f36 01-Nov-2012 Jordan Rose <jordan_rose@apple.com>

[analyzer] Rename ConditionTruthVal::isTrue to isConstrainedTrue.

(and the same for isFalse)

No functionality change.

llvm-svn: 167186


# a57e8ffd 31-Oct-2012 Anna Zaks <ganna@apple.com>

[analyzer] Fix a bug in SimpleStreamChecker - return after sink.

Thanks Ted.

llvm-svn: 167176


# 1e80d8b4 31-Oct-2012 Anna Zaks <ganna@apple.com>

[analyzer] SimpleStreamChecker - remove evalAssume and other refinements

llvm-svn: 167099


# 92d96604 30-Oct-2012 Anna Zaks <ganna@apple.com>

[analyzer]SimpleStreamChecker: add a TODO for better leak report.

llvm-svn: 167001


123