Commit Graph

203 Commits

Author SHA1 Message Date
Petr Hosek 5326bb4a77 [scan-build] Patch to scan-build tool to support "--target=<value>" flag
The scan-build script provided by clang can be used to detect defects in
code in the compile time. However, we discovered that the
"--target=<value>" flag in clang is not properly handled by this script,
which results in failures when analyzing projects that have used this
flag in their makefile.

This single line of change allows scan-build script to properly handle
the "--target=<value>" flag.

Patch by Haowei Wu

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

llvm-svn: 304025
2017-05-26 19:25:32 +00:00
Jonathan Roelofs 7121c00966 Actually install scan-build / ccc-analyzer / c++-analyzer on windows
Before, we were only installing the wrappers... oops.

llvm-svn: 298549
2017-03-22 21:13:49 +00:00
Sylvestre Ledru 522c0ec295 scan-build: Add an option to show the description in the list of defect
Summary:
This patch adds an option //--show-description// to add the defect description to the list of defect. This helps to get a better understanding of the defect without opening the page.

For example, this is used for Firefox:
https://people.mozilla.org/~sledru/reports/fx-scan-build/

Reviewers: rizsotto.mailinglist, zaks.anna

Subscribers: cfe-commits

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

llvm-svn: 277328
2016-08-01 08:04:45 +00:00
Yury Gribov a6560ebe4c [analyzer] Add --force-analyze-debug-code option to scan-build
to force debug build and hopefully enable more precise warnings.

Static Analyzer is much more efficient when built in debug mode
(-UNDEBUG) so we advice users to enable it manually. This may be
inconvenient in case of large complex projects (think about Linux
distros e.g. Android or Tizen). This patch adds a flag to scan-build
which inserts -UNDEBUG automatically.

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

llvm-svn: 261204
2016-02-18 11:08:46 +00:00
Chris Bieneman 2bf68c6c1c Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

    "This is the way [autoconf] ends
    Not with a bang but a whimper."
    -T.S. Eliot

Reviewers: chandlerc, grosbach, bob.wilson, echristo

Subscribers: klimek, cfe-commits

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

llvm-svn: 258862
2016-01-26 21:30:40 +00:00
Chris Bieneman 0502e98c8a Honor system specific paths of MAN pages
Summary: Caught on NetBSD.

Patch by: Kamil Rytarowski (krytarowski)

Reviewers: beanz, jroelofs

Subscribers: cfe-commits, joerg

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

llvm-svn: 253693
2015-11-20 18:49:02 +00:00
Jonathan Roelofs 534c4eec48 Fix build... again
llvm-svn: 253081
2015-11-13 21:04:14 +00:00
Jonathan Roelofs 814aa25a92 [scan-build] Make scan-build work whether it's installed or not
llvm-svn: 253074
2015-11-13 20:34:15 +00:00
Jonathan Roelofs 80df3d262d [scan-build] Move non user-facing utilities to share
llvm-svn: 253068
2015-11-13 19:56:07 +00:00
NAKAMURA Takumi 624922ad87 scan-build: Fix install.
llvm-svn: 253016
2015-11-13 06:48:02 +00:00
Jonathan Roelofs 2ec2acb03e [scan-build] Create share directory similar to scan-view's
llvm-svn: 252981
2015-11-13 00:32:54 +00:00
Devin Coughlin 932d88ca05 [analyzer] Fix scan-build to handle missing output directories.
Cwd::abs_path has a somewhat tricky semantics: if it's operand directory does not exist,
it'll return undefined (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=257568).
This may cause scan-build to silently ignore output directory (specified with -o) and
use /tmp instead of trying to create directory. This tiny patch fixes the problem.

A patch by Yury Gribov!

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

llvm-svn: 252797
2015-11-11 20:39:03 +00:00
Aaron Ballman 8f3f6347aa Hiding the scan-build and scan-view projects under the Misc folder in IDEs instead of having them at the root view.
llvm-svn: 252771
2015-11-11 18:13:42 +00:00
Jonathan Roelofs 1ff9c63204 Implement post-commit review feedback on r252662
llvm-svn: 252664
2015-11-10 22:48:11 +00:00
Jonathan Roelofs 467ab05291 Implement the fix that r252641 should have been
llvm-svn: 252662
2015-11-10 22:38:59 +00:00
Jonathan Roelofs 2a439a104b Fix missing CMake dependency introduced in r252474
llvm-svn: 252641
2015-11-10 20:01:22 +00:00
Jonathan Roelofs 9c0d3f5e6f Fix the cmake build after r252474 broke it
llvm-svn: 252489
2015-11-09 16:47:09 +00:00
Jonathan Roelofs e961432ae7 Create install targets for scan-build and scan-view
http://reviews.llvm.org/D14403

llvm-svn: 252474
2015-11-09 16:12:56 +00:00
Anton Yartsev 522ccb9d80 [analyzer] Preserve the order checkers were enabled/disabled.
In addition to r251524: preserve the order the checkers were enabled/disabled to be deterministic.
Additionally return the number of arguments read by 'ProcessArgs' - for debug purpose.

llvm-svn: 251552
2015-10-28 20:43:39 +00:00
Anton Yartsev 5d381bc775 [analyzer] Make inclusion/exclusion of checkers less ambiguous.
A checker may be enabled/disabled multiple times via -enable-checker and -disable-checker scan-build arguments. Currently the conflicting and repetitive arguments are passed to the analyzer as is.
With this patch only the last enable/disable of a particular checker is accepted and passed to the analyzer.
This change is mostly done for the upcoming 'config for scan-build' patch when multiple inclusions/exclusions of a checker are expected to be more common.

llvm-svn: 251524
2015-10-28 16:28:57 +00:00
Devin Coughlin 8e850d45e4 [analyzer] ccc-analyzer: Fix -isystem value passing.
The regex for -isystem matching is broken. -[D,I,Usystem] matches "-D", "-,",
"-I", "-U", "-s" "-y", etc. Besides that, "-isystem /foo" gets interpreted as
"-i" with a non-empty value "system" and thus the next "/foo" argument is not
read. This patch corrects the regex.

This fixes PR13237 <https://llvm.org/bugs/show_bug.cgi?id=13237>.

A patch by Peter Wu!

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

llvm-svn: 251312
2015-10-26 17:19:51 +00:00
Devin Coughlin 26c5df2c21 [analyzer] scan-build: Teach ccc-analyzer about -Xclang.
Update ccc-analyzer to forward both -Xclang and its following argument to the
the compiler driver. Previously we were dropping -Xclang and forwarding the
argument on its own if it matched other forwarding criteria. This caused the
argument to be interpreted as a driver rather than a frontend option.

llvm-svn: 251218
2015-10-25 01:30:18 +00:00
Anton Yartsev c647a6df72 [analyzer] Improved behavior if Clang was not found, part II
- scan-build help: display 'Could not query Clang for the list of available checkers.' + the reason why it happened so if clang was not found.
- display requested/forced help in case of --use-analyzer=Xcode.

llvm-svn: 247828
2015-09-16 18:12:15 +00:00
Ted Kremenek 04d7b95ef3 Use -f instead of -d flag for testing existing of clang executable (http://reviews.llvm.org/D12827).
llvm-svn: 247510
2015-09-12 16:01:34 +00:00
Anton Yartsev f54d6796e3 [analyzer] Improve behavior if Clang not found.
- Eliminate 'No such file or directory at scan-build line ...' error if '$RealBin/bin/clang' or '$RealBin/clang' directory does not exist.
- Eliminate 'Use of uninitialized value $Clang in concatenation (.) or string at scan-build line ...' error if help is displayed while $Clang was not found.

llvm-svn: 247466
2015-09-11 20:41:09 +00:00
Ted Kremenek 3a0678e33c [analyzer] Apply whitespace cleanups by Honggyu Kim.
llvm-svn: 246978
2015-09-08 03:50:52 +00:00
Anton Yartsev 9550590711 [analyzer] Refactoring: bring together scan-build options and environment variables.
Full list of changes:
- all scan-build command-line arguments are now kept in %Options hash.
- most of environment variables scan-build operates with are stored in %EnvVars hash.
- moved processing of command-line arguments to the ProcessArgs subroutine.

llvm-svn: 246710
2015-09-02 21:01:59 +00:00
Anton Yartsev c971a1a6d5 [analyzer] Fix for PR24112 (scan-build doesn't work with --use-analyzer="path to clang++.exe").
Don't derive the path_to_clang++ from the path_to_clang if the path_to_clang is really the path_to_clang++.

llvm-svn: 245621
2015-08-20 21:52:39 +00:00
Anton Yartsev 8be92ef3a1 [analyzer] Incorrect env variable replaced.
llvm-svn: 244673
2015-08-11 21:24:19 +00:00
Ted Kremenek 0270a08ebf [Static Analyzer] Add --analyzer-target option to scan-build.
When interposing on a compiler doing cross-compilation, scan-build
does not infer the target triple needed to pass to clang for
doing static analysis.  The --analyzer-target option allows one
to manually specify the target triple used during static analysis
(and only static analysis) for such cases.

Patch by Honggyu Kim!

Reviewed in http://reviews.llvm.org/D10356.

llvm-svn: 244400
2015-08-08 17:58:47 +00:00
Anton Yartsev 84f9042fae [analyzer] Prevent ccc/c++-analyzer from hanging on Windows.
'fork'+'exec' combination made scan-build and ccc-analyzer hang under Windows. The patch replaces 'fork'+'exec' with more reliable 'system' (ccc-analyzer) and piped 'open' (scan-build). See http://reviews.llvm.org/D8774 and http://reviews.llvm.org/D9357 for more details.

llvm-svn: 241201
2015-07-01 22:35:29 +00:00
Anton Yartsev 4d04afbb61 [analyzer] Cleanup: $Status is always 0 here.
llvm-svn: 239971
2015-06-17 23:25:58 +00:00
Anton Yartsev 321b176a08 [analyzer] Close file handle before output to file from external command.
An old code caused problems under Windows - additional temporary file was created for clang preprocessor output while the right output file remained empty.

llvm-svn: 239970
2015-06-17 23:12:33 +00:00
Sylvestre Ledru f8a5ce35a4 scan-build: Remove useless whitespace in File path
Patch by Honggyu Kim

Summary:
This patch removes useless whitespace in File path in index.html
Previously, a File directory path is copied and pasted as below:
  arch /arm /kernel /stacktrace.c

It just removes the whitespace between directories and makes the
copied string as below:
  arch/arm/kernel/stacktrace.c

The output looks same in html format, but the copied directory path
can be pasted as it looks.

Reviewers: krememek, zaks.anna, sylvestre.ledru

Reviewed By: sylvestre.ledru

Subscribers: aemerson, cfe-commits

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

llvm-svn: 239609
2015-06-12 15:50:27 +00:00
Ahmed Bougacha 5191911a57 Revert "[analyzer] scan-build: support spaces in compiler path and arguments."
This reverts commit r236423 and its followup r236533, as indiscriminate
quoting makes for too much quoting (and clang doesn't like both '"-c"'
and -D"FOO=bar").

llvm-svn: 236562
2015-05-06 02:08:27 +00:00
Anton Yartsev 22f6189fb0 [analyzer] This eliminates regression caused by r236423.
Wrap an argument with quotes only if it has spaces.

llvm-svn: 236533
2015-05-05 19:43:37 +00:00
Anton Yartsev c312ef1d17 [analyzer] scan-build: support spaces in compiler path and arguments.
This fixes errors that occur if a path to the default compiler has spaces or if an argument with spaces is given to compiler (e.g. via -I). (http://reviews.llvm.org/D9357)

llvm-svn: 236423
2015-05-04 13:37:36 +00:00
Anna Zaks 50b0956754 [scan-build] Be friendly to "" in the argument list.
Do not fail when "" is one of the compilation arguments.

llvm-svn: 233465
2015-03-28 02:17:21 +00:00
Ted Kremenek 0f26d132d7 [analyzer] Change ccc-analyzer to accept both -isystem <path> and -isystem<path>
Patch by Thomas Hauth!

llvm-svn: 227946
2015-02-03 06:23:36 +00:00
Ted Kremenek 67978556a5 [analyzer] Include a couple more comments on using xcrun to query the SDK.
llvm-svn: 225039
2014-12-31 08:19:08 +00:00
Ted Kremenek 398f46f8f2 [analyzer] Change ccc-analyzer to mimick behavior on OSX Mavericks/Yosemite to automatically infer the SDK location.
llvm-svn: 225038
2014-12-31 07:44:51 +00:00
Anton Yartsev a466a93ffe [analyzer] Eliminated endless loop.
llvm-svn: 223426
2014-12-05 00:59:07 +00:00
Anton Yartsev 0a18fca007 [analyzer] Indented code within the DisplayHelp sub.
llvm-svn: 222851
2014-11-26 21:53:39 +00:00
Anton Yartsev 39323f95cc [analyzer] Perl scripts are run differently from makefiles. Sometimes additional utilities are involved, e.g. 'env' utility that present in MSYS but is missing in MinGW. The patch unifies launch of "c++-analyzer" and "ccc-analyzer".
llvm-svn: 219812
2014-10-15 17:13:02 +00:00
Anton Yartsev a95ea95b5c [analyzer] Handle 'mingw32-make' in the same way as 'make' and 'gmake'.
llvm-svn: 219794
2014-10-15 15:11:45 +00:00
Sylvestre Ledru 9e0752980c Fix a bug when scan-build is used in a cross-compilation environment with
the --use-cc option.

Instead, we will search in the PATH
For example:
 scan-build --use-cc=arm-none-eabi-gcc -o out make -e

Initially reported as a Debian Bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=748777

llvm-svn: 215229
2014-08-08 17:15:13 +00:00
Sylvestre Ledru c790515c8b Consistency on the tab/space
llvm-svn: 213236
2014-07-17 08:40:35 +00:00
Sylvestre Ledru 6aac507e7d Fix Bug 14061 - scan-build crashes during postprocessing if BUGFILE no longer exists
Experienced with Thunderbird build

Patch by Matti Niemenmaa

llvm-svn: 213235
2014-07-17 08:39:04 +00:00
Alp Toker 958027b698 Fix typos
Also consolidate 'backward compatibility'

llvm-svn: 212974
2014-07-14 19:42:55 +00:00
Sylvestre Ledru bf9effc736 actually, just check if it is a file (including directory or symlink)
llvm-svn: 211053
2014-06-16 20:51:40 +00:00