Commit Graph

199 Commits

Author SHA1 Message Date
Yury Gribov 19b977bcdf [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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261204 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 11:08:46 +00:00
Chris Bieneman 171280519b 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258862 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 21:30:40 +00:00
Chris Bieneman f57d2f430d 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253693 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 18:49:02 +00:00
Jonathan Roelofs 0ca8df1240 Fix build... again
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253081 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 21:04:14 +00:00
Jonathan Roelofs 8dbb023328 [scan-build] Make scan-build work whether it's installed or not
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253074 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 20:34:15 +00:00
Jonathan Roelofs 86e3196c88 [scan-build] Move non user-facing utilities to share
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253068 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 19:56:07 +00:00
NAKAMURA Takumi 4d492513ef scan-build: Fix install.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253016 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 06:48:02 +00:00
Jonathan Roelofs e4e016d0a8 [scan-build] Create share directory similar to scan-view's
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252981 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 00:32:54 +00:00
Devin Coughlin 58ac3983f9 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252797 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 20:39:03 +00:00
Aaron Ballman c41a416b75 Hiding the scan-build and scan-view projects under the Misc folder in IDEs instead of having them at the root view.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252771 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 18:13:42 +00:00
Jonathan Roelofs 1c97f01e89 Implement post-commit review feedback on r252662
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252664 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 22:48:11 +00:00
Jonathan Roelofs 940be88b7a Implement the fix that r252641 should have been
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252662 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 22:38:59 +00:00
Jonathan Roelofs aa4f010284 Fix missing CMake dependency introduced in r252474
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 20:01:22 +00:00
Jonathan Roelofs 02f36bd65b Fix the cmake build after r252474 broke it
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252489 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-09 16:47:09 +00:00
Jonathan Roelofs d715f31c8e Create install targets for scan-build and scan-view
http://reviews.llvm.org/D14403


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252474 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-09 16:12:56 +00:00
Anton Yartsev 78cbefbe1a [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251552 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 20:43:39 +00:00
Anton Yartsev 4f183b9d6b [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251524 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 16:28:57 +00:00
Devin Coughlin b564c0a9f8 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251312 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26 17:19:51 +00:00
Devin Coughlin 1315efcc02 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251218 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-25 01:30:18 +00:00
Anton Yartsev ca3751bb45 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247828 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16 18:12:15 +00:00
Ted Kremenek 60669b0ea1 Use -f instead of -d flag for testing existing of clang executable (http://reviews.llvm.org/D12827).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247510 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-12 16:01:34 +00:00
Anton Yartsev a1a0ff0dc3 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247466 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 20:41:09 +00:00
Ted Kremenek 99bb39afb4 [analyzer] Apply whitespace cleanups by Honggyu Kim.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246978 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08 03:50:52 +00:00
Anton Yartsev 57111e9c43 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246710 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 21:01:59 +00:00
Anton Yartsev a8a5653cb2 [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++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245621 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 21:52:39 +00:00
Anton Yartsev d98efaa506 [analyzer] Incorrect env variable replaced.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244673 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 21:24:19 +00:00
Ted Kremenek 3c9c1621fa [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244400 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-08 17:58:47 +00:00
Anton Yartsev f2302bcac5 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241201 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-01 22:35:29 +00:00
Anton Yartsev a28856bb58 [analyzer] Cleanup: $Status is always 0 here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239971 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-17 23:25:58 +00:00
Anton Yartsev 8e3c7350ac [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239970 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-17 23:12:33 +00:00
Sylvestre Ledru 4181de4642 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




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239609 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-12 15:50:27 +00:00
Ahmed Bougacha 019474fdd0 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").


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236562 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 02:08:27 +00:00
Anton Yartsev 8e073be178 [analyzer] This eliminates regression caused by r236423.
Wrap an argument with quotes only if it has spaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236533 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-05 19:43:37 +00:00
Anton Yartsev 38ddb0ae36 [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)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236423 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-04 13:37:36 +00:00
Anna Zaks aacbae5fdb [scan-build] Be friendly to "" in the argument list.
Do not fail when "" is one of the compilation arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233465 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-28 02:17:21 +00:00
Ted Kremenek 1d0c8a7f4b [analyzer] Change ccc-analyzer to accept both -isystem <path> and -isystem<path>
Patch by Thomas Hauth!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227946 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-03 06:23:36 +00:00
Ted Kremenek 2d5a4a7eff [analyzer] Include a couple more comments on using xcrun to query the SDK.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225039 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-31 08:19:08 +00:00
Ted Kremenek a0e39bc444 [analyzer] Change ccc-analyzer to mimick behavior on OSX Mavericks/Yosemite to automatically infer the SDK location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225038 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-31 07:44:51 +00:00
Anton Yartsev 488283be8f [analyzer] Eliminated endless loop.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223426 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 00:59:07 +00:00
Anton Yartsev 6d4b97c944 [analyzer] Indented code within the DisplayHelp sub.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222851 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 21:53:39 +00:00
Anton Yartsev 6b0ed0ae92 [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".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219812 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-15 17:13:02 +00:00
Anton Yartsev 471d393d71 [analyzer] Handle 'mingw32-make' in the same way as 'make' and 'gmake'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219794 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-15 15:11:45 +00:00
Sylvestre Ledru 22efa1bf39 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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215229 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 17:15:13 +00:00
Sylvestre Ledru fc48dfdc97 Consistency on the tab/space
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213236 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-17 08:40:35 +00:00
Sylvestre Ledru f29418df13 Fix Bug 14061 - scan-build crashes during postprocessing if BUGFILE no longer exists
Experienced with Thunderbird build

Patch by Matti Niemenmaa



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213235 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-17 08:39:04 +00:00
Alp Toker c7645b9266 Fix typos
Also consolidate 'backward compatibility'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212974 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 19:42:55 +00:00
Sylvestre Ledru 0421d5e4cc actually, just check if it is a file (including directory or symlink)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211053 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-16 20:51:40 +00:00
Sylvestre Ledru 4a2040bc0e Check that the directory does not exist.
Otherwise, it could allows local users to obtain sensitive information or
overwrite arbitrary files via a symlink attack on temporary directories with
predictable names. 

Reported as CVE-2014-2893 ( https://security-tracker.debian.org/tracker/CVE-2014-2893 )
Found by Jakub Wilk



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211051 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-16 20:31:15 +00:00
Sylvestre Ledru e6f5c37aab List the function/method name in the index page of scan-build
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210971 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-14 08:49:40 +00:00
Sylvestre Ledru b78303a715 With the option '-analyzer-config stable-report-filename=true',
instead of report-XXXXXX.html, scan-build/clang analyzer generate
report-<filename>-<function, method name>-<function position>-<id>.html.
(id = i++ for several issues found in the same function/method)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210970 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-14 08:45:32 +00:00