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
Sylvestre Ledru
c7bc52596f
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
llvm-svn: 211051
2014-06-16 20:31:15 +00:00
Sylvestre Ledru
ac5a08a56a
List the function/method name in the index page of scan-build
...
llvm-svn: 210971
2014-06-14 08:49:40 +00:00
Sylvestre Ledru
9882e1a52c
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)
llvm-svn: 210970
2014-06-14 08:45:32 +00:00
Sylvestre Ledru
e8103abdbc
revert "r209526 List the function/method name in the index page of scan-build "
...
Depends on http://reviews.llvm.org/D3762
llvm-svn: 209527
2014-05-23 16:47:42 +00:00
Sylvestre Ledru
970d3189e6
List the function/method name in the index page of scan-build
...
llvm-svn: 209526
2014-05-23 16:40:46 +00:00
Sylvestre Ledru
df70a7ba99
Replace system() by native perl calls
...
llvm-svn: 209524
2014-05-23 16:10:00 +00:00
Sylvestre Ledru
3cbaa468c2
Improve a scan-build message
...
llvm-svn: 208951
2014-05-16 07:03:15 +00:00
Jordan Rose
57ee6d2cf7
[scan-build] Pass --sysroot through for both compilation and linking.
...
PR19704
llvm-svn: 208595
2014-05-12 17:04:44 +00:00
Jordan Rose
90d09146e0
scan-build: Don't use realpath when the user provides an explicit path.
...
PR19583
llvm-svn: 207484
2014-04-29 01:37:19 +00:00
Ted Kremenek
dd21b89a25
Handle possible trailing '/' in xcode-select output. Patch by Jeff Olson.
...
llvm-svn: 206752
2014-04-21 14:13:22 +00:00
Jordan Rose
0d7d09f804
[analyzer] scan-build: allow quotes around "-cc1" when looking at -### output.
...
Third time's the charm. Patch by Brennan Shacklett!
llvm-svn: 204362
2014-03-20 17:43:54 +00:00
Jordan Rose
428f2e980a
[analyzer] scan-build: match whitespace instead of word boundaries around flags.
...
Because neither ' ' nor '-' is alphanumeric, \b won't match between them!
Since in this case we know our output is coming from a -### invocation,
we should always have spaces on both sides of the flag we're trying to match,
"-cc1".
llvm-svn: 204356
2014-03-20 16:37:54 +00:00
Jordan Rose
69ab726724
[analyzer] scan-build: when matching flags, make sure the - is the first letter.
...
PR19191
llvm-svn: 204253
2014-03-19 17:42:26 +00:00
Ted Kremenek
38d77473b0
Add preprocessed output to ccc-analyzer's accepted language map.
...
llvm-svn: 202182
2014-02-25 19:16:33 +00:00
Sylvestre Ledru
3ea1dae8da
In some cases (for example, the Firefox build system), the CLANG_CXX variable is defined but empty.
...
Extend the test (like it is done in scan-build) to check also if the variable
is empty or not.
llvm-svn: 201586
2014-02-18 17:45:06 +00:00
Sylvestre Ledru
82e547e1a9
Remove trailing spaces (no other change). Bikeshed #2
...
llvm-svn: 201584
2014-02-18 17:21:45 +00:00
Sylvestre Ledru
905d848fc9
Remove trailing spaces (no other change)
...
llvm-svn: 201570
2014-02-18 12:59:51 +00:00
Sylvestre Ledru
a4c779d8d6
update of the clang version (should probably managed in the configure)
...
llvm-svn: 201182
2014-02-11 21:37:27 +00:00
Anton Yartsev
0cb7c8abc1
[analyzer] Strip trailing whitespace characters from input.
...
More universal way of removing trailing whitespace characters then 'chomp' does. Chomp "removes any trailing string that corresponds to the current value of $/" (quote from perldoc). In my case an input ended with '\r\r\n', chomp left '\r' at the end of input and the script ended up with an error "Use of uninitialized value in concatenation (.) or string"
llvm-svn: 199892
2014-01-23 14:12:48 +00:00
Jordan Rose
a63f229509
[analyzer] Files with .c extensions are still C++ files if the compiler is CXX.
...
PR18339
llvm-svn: 198711
2014-01-07 21:39:51 +00:00
Jordan Rose
3dcbca3719
[analyzer] Add -analyzer-config to scan-build.
...
-analyzer-config options are now passed from scan-build through to
ccc-analyzer and then to clang.
Patch by Daniel Connelly!
llvm-svn: 197246
2013-12-13 17:16:28 +00:00
Alp Toker
f6a24ce40f
Fix a tranche of comment, test and doc typos
...
llvm-svn: 196510
2013-12-05 16:25:25 +00:00
Jordan Rose
476bbb0252
[analyzer] scan-build: Handle -m* option wildcard after compiler/linker flags.
...
Some of the shared compiler/linker flags start with -m, so they've been
getting passed to the compiler only since r180073. Now, the -m* wildcard
is processed after the shared flags and the ignored flags.
Found by Laszlo Nagy!
llvm-svn: 193184
2013-10-22 18:55:18 +00:00
Jordan Rose
3bde507a7a
[analyzer] scan-build: add missing semicolon
...
Patch by Kevin Zheng!
llvm-svn: 190789
2013-09-16 16:17:18 +00:00
Jordan Rose
e10c859583
[analyzer] Put more uniqueness in scan-build's temporary directory names.
...
This is necessary when running two scan-build processes in parallel. The
directory naming scheme is now:
yyyy-MM-dd-HHmmss-PID-N
2013-09-13-174210-123-1
where "PID" is the scan-build process ID, and "N" is a sequential counter
(not likely to be needed now that seconds are mangled in, but just in case).
PR17196, using a suggested fix from Greg Czajkowski!
llvm-svn: 190735
2013-09-14 00:41:32 +00:00
Jordan Rose
1c71ab00e6
scan-build: Set CC and CXX as make variables when wrapping make builds.
...
Variables set in a makefile are not overridden by environment variables.
Make sure we actually override CC and CXX when using scan-build.
Patch by Steve McCoy!
llvm-svn: 189372
2013-08-27 16:59:33 +00:00
Anton Yartsev
9ddb5fe2d7
+ make scan-build work with Strawberry Perl, ActiveState Perl, cygwin perl and msys perl ports.
...
llvm-svn: 188607
2013-08-17 15:43:19 +00:00
Jordan Rose
687fc9a30b
scan-build: pass -target through to analyzer
...
llvm-svn: 187989
2013-08-08 16:06:26 +00:00
Jordan Rose
525121f9b6
[scan-build] Add missing comma to ccc-analyzer.
...
Thanks, Dmitry!
llvm-svn: 186167
2013-07-12 16:07:33 +00:00
Jordan Rose
05b3a8b604
[scan-build] Pass through all -f and -O flags, along with -Wwrite-strings.
...
These flags control language options and user-visible macros, so it's
important to preserve them when analyzing. Rather than try to keep up
with all the -f flags, we'll pass them all through and then ban the ones
we don't want (like -fsyntax-only).
-Wwrite-strings is really an f-flag in disguise: it implies -fconst-strings.
Patch by Keaton Mowry, modified by me.
llvm-svn: 186138
2013-07-11 23:56:12 +00:00
Jordan Rose
1187b95bd1
[scan-build] Log compiler invocation to stderr, not stdout.
...
This is important for preprocessing steps, which may output to stdout.
Also, change ENV accesses using barewords to use string keys instead.
PR16414
llvm-svn: 185555
2013-07-03 16:42:02 +00:00
Anna Zaks
9f53c950df
[analyzer] Add --override-compiler option to scan-build.
...
The new advanced option ensures ccc-analyze is used even when better
interposition methods are available.
llvm-svn: 182981
2013-05-31 02:31:07 +00:00
Jordan Rose
d8fb478b36
scan-build: use the xcodebuild specified by the user.
...
This is important if the user has multiple Xcodes installed on their
system -- we use xcodebuild to do a version check, and therefore we need
to make sure we match the actual build command.
Reported by Howard Ling!
llvm-svn: 182498
2013-05-22 18:09:57 +00:00
Anton Yartsev
604518ccd4
[analyzer] Finally make c++-analyzer 'executable' again.
...
llvm-svn: 180905
2013-05-02 01:57:58 +00:00
Anton Yartsev
10f9d08c70
[analyzer] Recreated as a file.
...
llvm-svn: 180903
2013-05-02 01:41:51 +00:00
Anton Yartsev
2320d295af
[analyzer] Temporary remove c++analyzer to recreate it as a separate file, not a symlink.
...
llvm-svn: 180902
2013-05-02 01:36:41 +00:00
Anton Yartsev
19993e8441
[analyzer] Added 'executable' property to c++analyzer.
...
llvm-svn: 180901
2013-05-02 01:18:17 +00:00
Anton Yartsev
caaaf2ee28
[analyzer] scan-build for Windows
...
The patch allows Windows users to launch scan-build without any additional preparations in the same way as it described in http://clang-analyzer.llvm.org/scan-build.html . The only thing that should be done to make scan-build work from an arbitrary location is to add scan-build folder to the PATH environment variable.
llvm-svn: 180900
2013-05-02 00:52:46 +00:00
Jordan Rose
38c97d2642
[analyzer] scan-build: support -enable-checker with new Xcode integration.
...
<rdar://problem/13772094>
llvm-svn: 180812
2013-04-30 22:00:04 +00:00
Ted Kremenek
b44bc7d599
[scan-build] Whitelist all -mXXXX options.
...
llvm-svn: 180073
2013-04-23 00:10:55 +00:00
Jordan Rose
83662f75ad
[analyzer] scan-build: emit errors on stderr, and exit(1) instead of exit(0).
...
PR14963
llvm-svn: 177678
2013-03-21 23:14:26 +00:00
Jordan Rose
529e239aee
[analyzer] Fix scan-build's -stats mode.
...
We were failing to match the output line, which led to us collecting no
stats at all, which led to a divide-by-zero error.
Fixes PR15510.
llvm-svn: 177084
2013-03-14 17:18:30 +00:00
Jordan Rose
838b72f6b5
scan-build: explicitly say "No bugs found" if there are no reports.
...
Patch by Martin Storsjo!
llvm-svn: 176472
2013-03-05 02:33:08 +00:00
Benjamin Kramer
d504096c12
scan-build: Remove debug print.
...
PR15329.
llvm-svn: 175889
2013-02-22 12:07:39 +00:00
Ted Kremenek
2dca31e1ed
[scan-build] Add quotes around clang executable name to handle path withs spaces. Fixes <rdar://problem/13254727>
...
llvm-svn: 175790
2013-02-21 20:28:59 +00:00
Ted Kremenek
9ddfa89bed
[scan-build] fix xcode version parsing to handle dot releases. Fixes <rdar://problem/13265300>.
...
llvm-svn: 175781
2013-02-21 19:33:30 +00:00
Ted Kremenek
3cfba5bf13
Teach ccc-analyze to pass on -iquote with no spaces between it an the argument.
...
llvm-svn: 175115
2013-02-14 00:32:25 +00:00
Ted Kremenek
26c777c409
Add some horrible Perl code to teach scan-build to recursively walk a directory for HTML files.
...
llvm-svn: 174260
2013-02-02 01:52:41 +00:00
Ted Kremenek
23813454e9
scan-build: When using Xcode 4.6, use build settings for doing proper build interposition.
...
llvm-svn: 173954
2013-01-30 19:10:24 +00:00
Jordan Rose
b18179da33
scan-build: Add a --keep-empty option for better testing.
...
SATestBuild expects to compare output directories for each invocation of
scan-build that it runs, but scan-build clears out empty directories by
default. We were coincidentally not getting that behavior until r173294.
llvm-svn: 173383
2013-01-24 23:07:59 +00:00
Ted Kremenek
15b47bc872
Always process an index.html file if we have HTML output. Patch by Justin Bogner.
...
llvm-svn: 173294
2013-01-23 21:22:14 +00:00
Ted Kremenek
632af24eb8
Set process return code of 1 in set-xcode-analyzer when Xcode needs to be quit. Fixes <rdar://problem/12983031>.
...
llvm-svn: 172256
2013-01-11 21:49:36 +00:00
Ted Kremenek
4a800f876a
ccc-analyzer: Forward -msse* options to the compiler.
...
llvm-svn: 172094
2013-01-10 19:29:31 +00:00
Ted Kremenek
6a4c73db23
Fix set-xcode-analyzer to only modify the ExecPath for the analyzer when using --use-xcode-clang.
...
Turns out that the ExecPath for the ObjC migrator would also get set.
Fixes <rdar://problem/12961769>.
llvm-svn: 171607
2013-01-05 07:31:54 +00:00
Ted Kremenek
8533dd9f58
Require set-xcode-analyzer to run with Python 2.7 or later.
...
Addresses LLVM PR 11661.
llvm-svn: 171503
2013-01-04 19:04:42 +00:00
Jordan Rose
85ff8f281e
[analyzer] scan-build: Don't forget to close our temp file for Clang's output.
...
Also, minor whitespace/indentation fixes.
Patch by Peeter Joot!
llvm-svn: 168805
2012-11-28 19:12:44 +00:00
Jordan Rose
dbbbf55119
[analyzer] scan-build: Treat '.C' files as C++.
...
Part of PR14443.
llvm-svn: 168804
2012-11-28 19:12:29 +00:00
Jordan Rose
a333f3fba1
scan-build: Respect TMPDIR on all platforms, not just Darwin (PR14438).
...
llvm-svn: 168672
2012-11-27 02:37:59 +00:00
Jordan Rose
721567af3e
[analyzer] Check that the argument to CFMakeCollectable is non-NULL.
...
Patch by Sean McBride!
llvm-svn: 167537
2012-11-07 17:12:37 +00:00
Sean Silva
d901e82ec4
Fix some mdoc nits
...
Patch by Eitan Adler!
llvm-svn: 166482
2012-10-23 16:35:44 +00:00
Ted Kremenek
45df60c1f3
Teach set-xcode-analyzer that the new default value for ExecPath is CLANG_ANALYZER_EXEC.
...
llvm-svn: 165681
2012-10-11 00:40:41 +00:00
Ted Kremenek
f81b0e387a
Have set-xcode-analyer report an error if no xcspec file could be found.
...
llvm-svn: 164713
2012-09-26 18:19:55 +00:00
Ted Kremenek
66dfa34404
Make set-xcode-analyzer more tolerant of the naming differenes reported by xcode-select.
...
llvm-svn: 164712
2012-09-26 18:13:03 +00:00
Benjamin Kramer
75e4bb1d87
ccc-analyzer: pass -stdlib=libc++ through to the analyzer.
...
Otherwise clang can't analyze code that relies on features provided by libc++.
llvm-svn: 164262
2012-09-19 22:56:24 +00:00
Ted Kremenek
b184a36aad
Revert "Utilize new build system support in Xcode 4.5 for easier interposition"
...
It's not clear if this is working yet on the buildbot. Reverting until we have
time to investigate.
llvm-svn: 163963
2012-09-15 05:51:10 +00:00
Ted Kremenek
460602e252
Utilize new build system support in Xcode 4.5 for easier interposition
...
of a build without needing to use ccc-analyzer.
llvm-svn: 163927
2012-09-14 19:06:33 +00:00
Jordan Rose
c87e690372
scan-build: Determine the location of the clang binary before printing help.
...
We need the clang executable to print the list of available checkers.
llvm-svn: 163925
2012-09-14 18:59:03 +00:00
Ted Kremenek
e29d2b8a66
Use double instead of single quote to expand .
...
llvm-svn: 162830
2012-08-29 07:22:34 +00:00
Ted Kremenek
2a226a61da
Fix passing of -analyzer-max-loop from scan-build to clang.
...
llvm-svn: 162765
2012-08-28 16:48:48 +00:00
Ted Kremenek
ca13244bb7
Change --with-analyzer to --use-analyzer, per sage feedback from Jordan.
...
llvm-svn: 162640
2012-08-25 05:24:46 +00:00
Ted Kremenek
12cda3384a
Fix a few issues related to -with-analyzer reported by Jordan. Let's
...
have the option with two '--' to be consistent with other options.
llvm-svn: 162625
2012-08-24 23:42:58 +00:00
Ted Kremenek
22708504f2
Rework how scan-build picks the version of clang to use for static analysis.
...
Unless the user specifies, the clang used for static analysis is the one
found relative to scan-build.
If the user specifies -with-analyzer, they can pick either to use
the clang bundled with Xcode (via xcrun) or they can specify
a path to clang.
llvm-svn: 162620
2012-08-24 23:08:08 +00:00
Ted Kremenek
2f65f465bf
Reformat help text for scan-build, and remove -constraints
...
and -store from help text because they are no longer relevant
to users.
llvm-svn: 162619
2012-08-24 23:08:06 +00:00
Ted Kremenek
7c2137a328
Revert "Go ahead and show experimental checkers in the scan-build "-h" output."
...
llvm-svn: 162587
2012-08-24 20:39:38 +00:00
Ted Kremenek
b5e409fd20
Go ahead and show experimental checkers in the scan-build "-h" output.
...
They are labeled as not being enabled-by-default, and how else
are users going to test them.
Fixes <rdar://problem/11654923>
llvm-svn: 162543
2012-08-24 06:49:34 +00:00
Ted Kremenek
af592eef7b
On OS X, use xcrun (if present) to find the clang to use for static analysis if
...
no clang can be found relative to the location of scan-build.
Fixes <rdar://problem/11691794>
llvm-svn: 162535
2012-08-24 04:53:06 +00:00
Jordan Rose
060b163801
[scan-build] Accept -fno-objc-arc as well as -fobjc-arc.
...
This is how Xcode lets individual files be marked as non-ARC when the rest
of the project is ARC-enabled, so this is necessary for scan-build xcodebuild.
Patch by Paul Eipper!
llvm-svn: 162497
2012-08-23 23:16:34 +00:00
Ted Kremenek
7c88d2ae0f
Teach ccc-analyze about -fobjc-legacy-dispatch and -mios-simulator-version-min
...
llvm-svn: 161443
2012-08-07 19:27:08 +00:00
Ted Kremenek
b9ddbd3daa
scan-build: factor out setting of environment variables.
...
llvm-svn: 161343
2012-08-06 20:19:19 +00:00
Ted Kremenek
0d29bd231b
Pull 'xcodebuild' wrapper logic into a separate function.
...
llvm-svn: 161330
2012-08-06 18:54:19 +00:00
Arnaud A. de Grandmaison
e00629f777
[scan-build] Fix clang++ pathname
...
llvm-svn: 160871
2012-07-27 17:10:06 +00:00
Ted Kremenek
4abbade558
Add hack (provided by Jonathan Sauer) to fall back to assuming Xcode is installed in /Developer
...
when using Python < 2.7.0. This is the case on Snow Leopard, where the tools are always
installed in /Developer. This isn't a proper fix for really figuring out where Xcode
is installed, but should work to fix an obvious problem on Snow Leopard.
llvm-svn: 160321
2012-07-16 21:39:29 +00:00
Anna Zaks
7aa3687bb6
[analyzer]scan-build: report the total number of steps analyzer performs
...
This would be useful to investigate performance issues.
llvm-svn: 159038
2012-06-22 22:08:12 +00:00
Ted Kremenek
00c31c888b
Adjust scan-build to enable color output for xterm-256color.
...
llvm-svn: 158735
2012-06-19 19:27:28 +00:00
Ted Kremenek
9dcc0325de
Sink definition of IBOutlet, IBOutletCollection, and IBAction into
...
the compiler predefines buffer. These are essentially part of
the Objective-C language.
llvm-svn: 158690
2012-06-19 00:37:39 +00:00
Anna Zaks
268f154f48
[analyzer] Loading external plugins with scan-build
...
Load custom plugins when running scan-build. This is useful when
additional static analysis Checkers must be provided via clang's plugin
interface.
Loading additional plugins can now be done via the scan-build call:
scan-build -load-plugin <plugin.so>
A patch by Thomas Hauth.
llvm-svn: 157452
2012-05-25 01:13:50 +00:00
Ted Kremenek
e1e89370f0
New & improved man page attached, now with standard license added.
...
Plus, a patch for scan-build.
* mdoc corrections
* slightly more compact output
* same license as scan-build
* DESCRIPTION describes
* Default checkers corrected & explained
* Authors credited
The patch adds support for --help-checkers. It just lists the default
checkers by recursively invoking "scan-build -h" and looking for the
magic '+' signs.
Patch by James Lowden!
llvm-svn: 157411
2012-05-24 20:13:47 +00:00
Douglas Gregor
4b5c9979b9
Add the output of "clang --version" to scan-build results, from Gerald Combs!
...
llvm-svn: 156834
2012-05-15 18:41:55 +00:00
Ted Kremenek
42c8f73f93
Provide a man page for scan-build. Patch by James Lowden!
...
llvm-svn: 156559
2012-05-10 19:10:47 +00:00
Anna Zaks
d682741136
[analyzer] Add .cxx and .txx as known file extensions to ccc-analyzer.
...
A patch by Sean McBride.
llvm-svn: 154751
2012-04-14 16:30:00 +00:00
Ted Kremenek
415287d943
Add static analyzer support for new NSArray/NSDictionary/NSNumber literals.
...
llvm-svn: 152139
2012-03-06 20:06:12 +00:00
Ted Kremenek
d87cdd1d11
Update set-xcode-analyzer to work with Xcode repackaging in Xcode 4.3
...
llvm-svn: 151179
2012-02-22 18:44:35 +00:00