Commit Graph

161 Commits

Author SHA1 Message Date
Artem Dergachev ed035ff826 [analyzer] exploded-graph-rewriter: Improve source location dumps.
- Correctly display macro expansion and spelling locations.
- Use the same procedure to display location context call site locations.
- Display statement IDs for program points.

llvm-svn: 365861
2019-07-12 02:10:33 +00:00
Artem Dergachev fc6059e8b9 [analyzer] exploded-graph-rewriter: Fix filenames in program point.
Fix a typo in JSON field name.

llvm-svn: 365827
2019-07-11 21:27:42 +00:00
Artem Dergachev c6b5c5b925 [analyzer] exploded-graph-rewriter: Implement a topology-only mode.
In this mode the rewriter will only rewrite program points
and omit program states. Useful for understanding
the rough topology of the graph.

Differential Revision: https://reviews.llvm.org/D64264

llvm-svn: 365410
2019-07-08 23:54:14 +00:00
Artem Dergachev 78566e454f [analyzer] exploded-graph-rewriter: Implement a single-path mode.
Instead of rewriting the whole graph, rewrite the leftmost path in the
graph. Useful for trimmed graphs that are still too large to display due
to multiple equivalent reports mixed into them.

Differential Revision: https://reviews.llvm.org/D64263

llvm-svn: 365409
2019-07-08 23:54:11 +00:00
Artem Dergachev 78c0aefb22 [analyzer] exploded-graph-rewriter: Implement a black-and-white color scheme.
For accessibility!

Differential Revision: https://reviews.llvm.org/D64153

llvm-svn: 365085
2019-07-03 20:48:23 +00:00
Artem Dergachev ab758ba128 [analyzer] exploded-graph-rewriter: Implement bug nodes and sink nodes.
Add a label to nodes that have a bug report attached or on which
the analysis was generally interrupted.

Fix printing has_report and implement printing is_sink in the graph dumper.

Differential Revision: https://reviews.llvm.org/D64110

llvm-svn: 364992
2019-07-03 01:26:41 +00:00
Artem Dergachev 5fcf92e153 [analyzer] exploded-graph-rewriter: NFC: Add more comments.
llvm-svn: 364991
2019-07-03 01:26:38 +00:00
Artem Dergachev 48a5c83af4 [analyzer] exploded-graph-rewriter: Collapse very long statement pretty-prints.
When printing various statements that include braces (compound
statements, lambda expressions, statement-expressions, etc.),
replace the code between braces with '...'.

Differential Revision: https://reviews.llvm.org/D64104

llvm-svn: 364990
2019-07-03 01:26:35 +00:00
Artem Dergachev deb7accbea [analyzer] exploded-graph-rewriter: Implement checker messages.
They are displayed as raw lines and diffed via difflib on a per-checker basis.

Differential Revision: https://reviews.llvm.org/D64100

llvm-svn: 364989
2019-07-03 01:26:32 +00:00
Artem Dergachev ad38e58ef2 [analyzer] exploded-graph-rewriter: Implement a dark color scheme.
Addresses a popular request. Activated via --dark.

Differential Revision: https://reviews.llvm.org/D64056

llvm-svn: 364882
2019-07-02 02:17:56 +00:00
Artem Dergachev 2ca5355712 [analyzer] exploded-graph-rewriter: Improve program point dumps.
- Take advantage of the stmt_point_kind.
- Dump block IDs for BlockEntrance nodes.
- Don't dump huge compound statements on PurgeDeadSymbols nodes.
- Rename Edge to BlockEdge for consistency.
- Tweak colors.

Differential Revision: https://reviews.llvm.org/D64051

llvm-svn: 364881
2019-07-02 02:17:53 +00:00
Artem Dergachev 0a77d9192a [analyzer] exploded-graph-rewriter: Add support for objects under construction.
This trait is Environment-like, so there was a chance to re-use a lot of code.

Differential Revision: https://reviews.llvm.org/D64047

llvm-svn: 364880
2019-07-02 02:17:50 +00:00
Artem Dergachev 02f91ddf1b [analyzer] exploded-graph-rewriter: Add support for dynamic types.
Slightly cleanup emission of horizontal lines and unhardcode the title
for generic maps.

Differential Revision: https://reviews.llvm.org/D64041

llvm-svn: 364865
2019-07-01 23:01:59 +00:00
Artem Dergachev 5a72338bf5 [analyzer] exploded-graph-rewriter: Implement program point tags.
Keep them on a separate line for more visibility.

Differential Revision: https://reviews.llvm.org/D63965

llvm-svn: 364864
2019-07-01 23:01:55 +00:00
Artem Dergachev 628f36ff70 [analyzer] exploded-graph-rewriter: Prettier location context dumps.
Make them span wider.

llvm-svn: 364365
2019-06-26 00:14:49 +00:00
Csaba Dabis 0cdd13c05a [analyzer] print() JSONify: Create pointers
Summary: -

Reviewers: NoQ

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin,
             mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D63726

llvm-svn: 364271
2019-06-25 03:17:55 +00:00
Artem Dergachev 14f4de9bb9 [analyzer] exploded-graph-rewriter: Fix escaping for bitwise-or.
'|' is a special character in graphviz, so it needs to be properly
escaped and unescaped.

llvm-svn: 364269
2019-06-25 02:16:56 +00:00
Artem Dergachev beb85ad66d [analyzer] exploded-graph-rewriter: Add support for range constraints.
Diff support included.

A cheap solution is implemented that treats range constraints as
"some sort of key-value map", so it's going to be trivial
to add support for other such maps later, such as dynamic type info.

Differential Revision: https://reviews.llvm.org/D63685

llvm-svn: 364268
2019-06-25 02:16:53 +00:00
Artem Dergachev b9c94f946f [analyzer] NFC: exploded-graph-rewriter: Extract some code into functions.
Differential Revision: https://reviews.llvm.org/D63684

llvm-svn: 364267
2019-06-25 02:16:50 +00:00
Artem Dergachev 5740e77f03 [analyzer] exploded-graph-rewriter: Implement a --diff mode.
In this mode the tool would avoid duplicating the contents of the
program state on every node, replacing them with a diff-like dump
of changes that happened on that node.

This is useful because most of the time we only interested in whether
the effect of the statement was modeled correctly. A diffed graph would
also be much faster to load and navigate, being much smaller than
the original graph.

The diffs are computed "semantically" as opposed to plain text diffs.
I.e., the diff algorithm is hand-crafted separately for every state trait,
taking the underlying data structures into account. This is especially nice
for Environment because textual diffs would have been terrible.
On the other hand, it requires some boilerplate to implement.

Differential Revision: https://reviews.llvm.org/D62761

llvm-svn: 363898
2019-06-19 23:33:59 +00:00
Artem Dergachev b50d167358 [analyzer] exploded-graph-rewriter: Fix escaping StringRegions.
Quotes around StringRegions are now escaped and unescaped correctly,
producing valid JSON.

Additionally, add a forgotten escape for Store values.

Differential Revision: https://reviews.llvm.org/D63519

llvm-svn: 363897
2019-06-19 23:33:55 +00:00
Artem Dergachev 44fb55bf96 [analyzer] exploded-graph-rewriter: Add the missing license header!
llvm-svn: 362575
2019-06-05 02:09:49 +00:00
Artem Dergachev 162360774e [analyzer] exploded-graph-rewriter: Initial commit.
This is a utility to improve readability and generally manipulate
GraphViz dumps of the analysis graph. Such dumps are often huge and
not only hard to read, but also often hang the viewer apps with their
mere size. Such script should significantly improve debugging experience.

Differential Revision: https://reviews.llvm.org/D62638

llvm-svn: 362340
2019-06-02 21:40:53 +00:00
Artem Dergachev e8b29c00dd [analyzer] SATestBuild.py: Use driver for analyzing single-file tests.
Don't bother coming up with a -cc1 run-line ourselves.

This, in particular, gets rid of a macOS-specific code path.

llvm-svn: 362009
2019-05-29 18:49:31 +00:00
George Karpenkov a64b205ae7 [analyzer] [testing] Inside CmpRuns.py output also print the filename of the first item in the path
Differential Revision: https://reviews.llvm.org/D57783

llvm-svn: 353228
2019-02-05 22:26:57 +00:00
Serge Guelton b748c0e696 Portable Python script across Python version
Make scripts more future-proof by importing most __future__ stuff.

Differential Revision: https://reviews.llvm.org/D55208

llvm-svn: 349504
2018-12-18 16:07:37 +00:00
Serge Guelton d458974c45 Portable Python script across Python version
In Python3, dict.items, dict.keys, dict.values, zip, map and filter no longer return lists, they create generator instead.

The portability patch consists in forcing an extra `list` call if the result is actually used as a list.
`map` are replaced by list comprehension and `filter` by filtered list comprehension.

Differential Revision: https://reviews.llvm.org/D55197

llvm-svn: 349501
2018-12-18 16:04:21 +00:00
Serge Guelton 3744de522c Portable Python script across Python version
In Python2, division between integer yields an integer, while it yields a float in Python3.
Use a combination of from __future__ import division and // operator to get a portable behavior.

Differential Revision: https://reviews.llvm.org/D55204

llvm-svn: 349455
2018-12-18 08:38:50 +00:00
Serge Guelton c0ebe773cd Portable Python script across Python version
Using from __future__ import print_function it is possible to have a compatible behavior of `print(...)` across Python version.

Differential Revision: https://reviews.llvm.org/D55213

llvm-svn: 349454
2018-12-18 08:36:33 +00:00
Serge Guelton 1f88dc5aee Portable Python script across Python version
Queue module as been renamed into queue in Python3

Differential Revision: https://reviews.llvm.org/D55202

llvm-svn: 349009
2018-12-13 07:44:19 +00:00
Serge Guelton 09616bdb4a Portable Python script across version
Have all classes derive from object: that's implicitly the default in Python3,
it needs to be done explicilty in Python2.

Differential Revision: https://reviews.llvm.org/D55121

llvm-svn: 348127
2018-12-03 12:12:48 +00:00
Serge Guelton 3de410848c Portable Python script across Python version
Python2 supports the two following equivalent construct

	raise ExceptionType, exception_value
and
	raise ExceptionType(exception_value)

Only the later is supported by Python3.

Differential Revision: https://reviews.llvm.org/D55195

llvm-svn: 348126
2018-12-03 12:11:21 +00:00
George Karpenkov 6a2a197f95 [analyzer] [testing] Compute data on path length, compute percentiles
Differential Revision: https://reviews.llvm.org/D52844

llvm-svn: 344990
2018-10-23 01:30:26 +00:00
George Karpenkov d3b0846e7a [analyzer] [tests] Hotfix: missing space
llvm-svn: 343643
2018-10-02 22:31:44 +00:00
George Karpenkov ac98683423 [analyzer] [tests] Allow specifying entire -analyze-config on the command line, make sure it's always propagated
Differential Revision: https://reviews.llvm.org/D52801

llvm-svn: 343636
2018-10-02 21:19:23 +00:00
George Karpenkov 47e5493b1d [analyzer] [testing] Pass through an extra argument for specifying extra analyzer options
Differential Revision: https://reviews.llvm.org/D52585

llvm-svn: 343158
2018-09-27 01:10:59 +00:00
George Karpenkov 95363e378a [analyzer] Remove traces of ubigraph visualization
Ubigraph project has been dead since about 2008, and to the best of my
knowledge, no one was using it.
Previously, I wasn't able to launch the existing binary at all.

Differential Revision: https://reviews.llvm.org/D51655

llvm-svn: 341601
2018-09-06 23:07:47 +00:00
George Karpenkov 1f5fe1132e [analyzer] [tests] Do not be verbose by default when updating reference results.
llvm-svn: 339183
2018-08-07 21:14:35 +00:00
George Karpenkov 8f6d65c685 [analyzer] [tests] Add an option for showing statistics after running tests.
Do not show statistics by default.

llvm-svn: 338323
2018-07-30 23:01:47 +00:00
George Karpenkov 13d3748e7c [analyzer] [tests] Style fixes for testing harness.
llvm-svn: 338322
2018-07-30 23:01:20 +00:00
George Karpenkov 6e4ddf49d8 [analyzer] [tests] Pass clang executable path to prefix-less executor scripts.
llvm-svn: 336124
2018-07-02 17:10:40 +00:00
George Karpenkov 5c23d6ab3c [analyzer] [tests] Allow the tested project to specify it's own analyzer wrapper
llvm-svn: 336023
2018-06-29 22:05:32 +00:00
George Karpenkov a262cf3146 [analyzer] [tests] Fix 80 column violation in SATestBuild.py
llvm-svn: 336022
2018-06-29 22:05:13 +00:00
Mikhail R. Gadelha afc62b7032 [analyzer] Fix string not being formatted with extra arguments
Signed-off-by: Mikhail Ramalho <mikhail.ramalho@gmail.com>
llvm-svn: 335739
2018-06-27 14:39:41 +00:00
George Karpenkov 30130b78c5 [analyzer] [tests] Include statistics in tests.
llvm-svn: 335685
2018-06-26 23:17:35 +00:00
Mikhail R. Gadelha 690a99a5fb Fix a (possible) division by zero check in the CmpRuns script
I missed updating the check in r333375

llvm-svn: 333529
2018-05-30 11:17:55 +00:00
Mikhail R. Gadelha 8af2e690f3 Introduces --stats-only option to only show changes in statistics.
llvm-svn: 333375
2018-05-28 15:40:39 +00:00
George Karpenkov 711058165c [analyzer] [testing] Be less verbose by default in integration testing.
llvm-svn: 328752
2018-03-29 01:23:54 +00:00
George Karpenkov dc0abcb87b [analyzer] [tests] Create a directory for the log file
llvm-svn: 326408
2018-03-01 02:18:54 +00:00
George Karpenkov 3f560daf37 [analyzer] [tests] Write to logfile instead of stdout while updating
reference results

llvm-svn: 326295
2018-02-28 01:55:23 +00:00