Commit Graph

239 Commits

Author SHA1 Message Date
Boris Zbarsky
e348ad0b6c Improve the documentation around the MOZ_CAN_RUN_SCRIPT analysis. No bug. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D23762

--HG--
extra : moz-landing-system : lando
2019-03-16 12:52:33 +00:00
Boris Zbarsky
135d0b832e Bug 1535651. Whitelist std::__pair_base as memmovable for static analysis purposes. r=emilio
In at least some libstdc++ versions, std::pair (which we want to be
memmovable) inherits from __pair_base.  We have a similar setup
already for __atomic_base.

Differential Revision: https://phabricator.services.mozilla.com/D23698

--HG--
extra : moz-landing-system : lando
2019-03-15 16:17:52 +00:00
Boris Zbarsky
f3173cde3f Bug 1534421. Fix the CAN_RUN_SCRIPT analysis to treat a deref of an arg as live if it would treat the arg as live. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D23071

--HG--
extra : moz-landing-system : lando
2019-03-13 12:13:08 +00:00
Boris Zbarsky
b969a0f9f0 Bug 1534518. Change CanRunScriptChecker caller function note to point to the declaration, not the definition. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D23082

--HG--
extra : moz-landing-system : lando
2019-03-13 12:11:34 +00:00
Boris Zbarsky
4b76c0a954 Bug 1506439 part 1. Fix CanRunScript analysis handling of arguments that default to null. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D23064

--HG--
extra : moz-landing-system : lando
2019-03-13 02:33:57 +00:00
Boris Zbarsky
5bf2e408e6 Bug 1534608. MOZ_CAN_RUN_SCRIPT should disallow non-stack refptr arguments. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D23217

--HG--
extra : moz-landing-system : lando
2019-03-13 00:30:11 +00:00
Boris Zbarsky
cb94672630 Bug 1533617 part 5. Disallow virtual MOZ_CAN_RUN_SCRIPT methods overriding a non-MOZ_CAN_RUN_SCRIPT superclass method. r=andi
This way if a caller calls a method that has a MOZ_CAN_RUN_SCRIPT override, it
can detect that it's possibly calling a MOZ_CAN_RUN_SCRIPT thing without having
to know about the override.

Differential Revision: https://phabricator.services.mozilla.com/D22839

--HG--
extra : moz-landing-system : lando
2019-03-11 14:20:27 +00:00
Andi-Bogdan Postelnicu
891cf78a33 Bug 1529650 - For SprintfLiteral checker also disallow it in third party paths. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D21240

--HG--
extra : moz-landing-system : lando
2019-02-27 15:15:24 +00:00
Masatoshi Kimura
e59e3b3e20 Bug 1528651 - Fix some trivial warnings and re-enable warnings-as-errors on Windows in some directories. r=dmajor
--HG--
extra : source : 5ee9efeda9e67f6af0521be85266703763cc4c50
2019-02-19 20:42:11 +09:00
Kartikaya Gupta
6969f0ccfb Bug 1523082 - Remove assertion and more robustly handle destructor decls. r=emilio
Clang 8 seems to generate destructor decls from different source
locations which breaks an assertion in the code. This patch updates the
code to remove the assertion and more robustly handle the new
declarations.

Differential Revision: https://phabricator.services.mozilla.com/D17902

--HG--
extra : moz-landing-system : lando
2019-01-29 03:06:35 +00:00
David Major
fffbdc0db1 Bug 1522771: Use -brepro to build clang-plugin.dll deterministically. r=mshal 2019-01-25 11:09:13 -05:00
Emilio Cobos Álvarez
dc03fce9b5 Bug 1515314 - Fix the build of Searchfox's indexer with trunk clang and with assertions enabled. r=kats
CLANG_VERSION_FULL is a macro that lives in mozilla-central, so it doesn't exist
while building the indexer. Just use the macro clang provides.
2018-12-20 04:40:37 +01:00
Emilio Cobos Álvarez
092964cd45 Bug 1514599 - Remove code for clang <6 from the indexer plugin. r=kats
This picks up changes from https://github.com/mozsearch/mozsearch/pull/173.
2018-12-16 18:39:34 +01:00
Andi-Bogdan Postelnicu
fbd9a10021 Bug 1511889 - Update clang-plugin LoadLibraryUsageChecker to use getBeginLoc. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D13726

--HG--
extra : moz-landing-system : lando
2018-12-06 16:34:13 +00:00
Sylvestre Ledru
ef05004811 Bug 1503537 - Get rid of the pdfium & mortar code r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D10352

--HG--
extra : moz-landing-system : lando
2018-11-28 19:31:21 +00:00
Mike Hommey
cb4aa814b8 Bug 1506756 - Remove the use of real_path added in bug 1501903. r=andi
In the first part of bug 1501903, paths were canonicalized in
inThirdPartyPath. For some reason, this seems to add a non-negligible
overhead on Windows. OTOH, most include paths handed by the build system
are absolute, and most paths that contains .. are for system headers,
which don't matter for the inThirdPartyPath test.

Considering the inThirdPartyPath has been using non-canonicalized paths
for the longest, we'll assume it's fine to come back to that mode.

Differential Revision: https://phabricator.services.mozilla.com/D11725

--HG--
extra : moz-landing-system : lando
2018-11-13 08:22:25 +00:00
Andi-Bogdan Postelnicu
4f5c3e9078 Bug 1501821 - Update clang-plugin in order to make it compatiable with clang 8.0.0 trunk. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D10806

--HG--
extra : moz-landing-system : lando
2018-11-03 13:41:36 +00:00
Kartikaya Gupta
86cb4f4e4d Bug 1418415 - Do more error checking. r=mccr8
While looking at this code I found a couple of places where errors could
get ignored or silently discarded and result in corrupt data. This
checks for the errors and fails harder.

Depends on D10353

Differential Revision: https://phabricator.services.mozilla.com/D10354

--HG--
extra : moz-landing-system : lando
2018-10-31 20:45:13 +00:00
Kartikaya Gupta
160df1fcad Bug 1418415 - Read and write analysis files in binary mode. r=mccr8
This is necessary because:
(a) the JSONFormatter emits a \n newline for each analysis line
(b) we truncate the file to the expected length after writing it
(c) on Windows writing the file in text mode replaces \n with \r\n
    and invalidates our computed "expected length"

Differential Revision: https://phabricator.services.mozilla.com/D10353

--HG--
extra : moz-landing-system : lando
2018-10-31 20:44:50 +00:00
Mike Hommey
3dabb0f250 Bug 1501903 - Cache the results of inThirdPartyPath. r=andi
The function is called a lot for the same paths and is rather costly, so
cache the results for each path.

Depends on D9758

Differential Revision: https://phabricator.services.mozilla.com/D9759

--HG--
extra : moz-landing-system : lando
2018-10-25 21:21:36 +00:00
Mike Hommey
371b282c0f Bug 1501903 - Properly handle paths in inThirdPartyPath. r=andi
SourceLocation that are passed to inThirdPartyPath might be macro
expansion locations, for which SourceManager.getFilename returns the
path of the directory containing the source, rather than of the
expansion location.

Furthermore, the paths getFileName returns are not canonical, and can
contain e.g. `..`.

Differential Revision: https://phabricator.services.mozilla.com/D9758

--HG--
extra : moz-landing-system : lando
2018-10-25 11:05:27 +00:00
Kartikaya Gupta
2e8b3b16f3 Bug 1501129 - Use field names instead of their index when mangling. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D9558

--HG--
extra : moz-landing-system : lando
2018-10-23 17:58:11 +00:00
Kartikaya Gupta
5f7bc9a6a0 Bug 1497914 - Add a platform-specific piece into the symbol hash from generated files. r=mccr8
--HG--
extra : rebase_source : ca626a5357fb29a220f6c4e1cc3ee600b651eeec
2018-10-11 10:01:31 -04:00
Mike Hommey
b487ebbc58 Bug 1493093 - Allow to relax MOZ_NON_TEMPORARY_CLASS for some specific constructors r=andi
Differential Revision: https://phabricator.services.mozilla.com/D6566

--HG--
extra : moz-landing-system : lando
2018-09-24 22:47:12 +00:00
Mike Hommey
0848e2d157 Bug 1479232 - Only use one matcher for varDecl and parmVarDecl r=andi
ParmVarDecl being a subclass of VarDecl, using two matchers then caused
ScopeChecker::check to be called twice for ParmVarDecl nodes, once for
each match. But the code in ScopeCheck::check is written with the
assumption that it's called only once for such nodes.

Somehow, this didn't cause problems with clang up to version 6, but
makes the plugin spuriously warn about already_AddRefed not being used
as temporaries when used as argument in function declarations, with
clang 7.

Differential Revision: https://phabricator.services.mozilla.com/D6360

--HG--
extra : moz-landing-system : lando
2018-09-20 08:17:52 +00:00
Mike Hommey
f8798bbeb2 Bug 1487622 - Refactor the clang plugin wrt attributes r=andi
- We forcefully remove annotations from the AST so that they don't end
up impacting codegen.
- We change the API such that we use identifiers instead of strings,
reducing the chances of typo errors.

Differential Revision: https://phabricator.services.mozilla.com/D5493

--HG--
extra : moz-landing-system : lando
2018-09-18 13:03:33 +00:00
Mike Hommey
88314c2170 Bug 1488631 - Remove annotations that the clang plugin doesn't handle. r=andi
As per bug 1487622, annotations have side effects on codegen, one of
which changes a leak signature that the wpt harness doesn't match
against its whitelist anymore.

Interestingly, while looking at the issue, I found multiple moz_*
annotations that weren't actually looked for by the clang plugin,
making them useless. Even more interestingly, removing them changes
codegen in such a way that the leak signature mentioned above is not
altered anymore.

Differential Revision: https://phabricator.services.mozilla.com/D5000
2018-09-08 06:49:48 +09:00
Myk Melez
7978cd2fe4 Bug 1482810 - set COMPILE_FLAGS var to hide warnings for Rust crates r=chmanchester
In conjunction with the cc crate changes in https://github.com/alexcrichton/cc-rs/pull/342 (which I'll land in https://phabricator.services.mozilla.com/D4699), this hides warnings generated by C code in Rust crates (by removing warnings flags from CFLAGS when compiling Rust libraries).

MozReview-Commit-ID: 9CZgLGbWjbA

Differential Revision: https://phabricator.services.mozilla.com/D3939

--HG--
extra : moz-landing-system : lando
2018-08-30 17:29:54 +00:00
Andi-Bogdan Postelnicu
2238536677 Bug 1483953 - Add a FixIt hint for the ExplicitImplicitChecker analysis. r=Ehsan
Differential Revision: https://phabricator.services.mozilla.com/D4191

--HG--
extra : moz-landing-system : lando
2018-08-24 14:11:26 +00:00
Andi-Bogdan Postelnicu
34a6c4ff8f Bug 1466427 - Migrate clang-tidy package from 5.0.1 to 7.0.0-rc2. r=glandium,janx
Differential Revision: https://phabricator.services.mozilla.com/D3980

--HG--
rename : tools/clang-tidy/test/misc-bool-pointer-implicit-conversion.cpp => tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.cpp
rename : tools/clang-tidy/test/misc-forward-declaration-namespace.cpp => tools/clang-tidy/test/bugprone-forward-declaration-namespace.cpp
rename : tools/clang-tidy/test/misc-macro-repeated-side-effects.cpp => tools/clang-tidy/test/bugprone-macro-repeated-side-effects.cpp
rename : tools/clang-tidy/test/misc-string-constructor.cpp => tools/clang-tidy/test/bugprone-string-constructor.cpp
rename : tools/clang-tidy/test/misc-string-integer-assignment.cpp => tools/clang-tidy/test/bugprone-string-integer-assignment.cpp
rename : tools/clang-tidy/test/misc-suspicious-missing-comma.cpp => tools/clang-tidy/test/bugprone-suspicious-missing-comma.cpp
rename : tools/clang-tidy/test/misc-swapped-arguments.cpp => tools/clang-tidy/test/bugprone-swapped-arguments.cpp
rename : tools/clang-tidy/test/misc-unused-raii.cpp => tools/clang-tidy/test/bugprone-unused-raii.cpp
extra : moz-landing-system : lando
2018-08-24 12:39:58 +00:00
Andi-Bogdan Postelnicu
d25759d92e Bug 1485949 - fix busted build of clang-plugin on MacOS native build. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D4204

--HG--
extra : moz-landing-system : lando
2018-08-24 11:44:38 +00:00
Masatoshi Kimura
3b21b7868b Bug 1090497 - Re-enable warnings as errors on clang-cl. r=froydnj
--HG--
extra : rebase_source : c09366fb93e5b0f72abe1e99d3094e3d96a934fb
extra : intermediate-source : 5950c9d63c3b4fd63a25464a7b50944aaec7079f
extra : source : ca1b9a2bcc4381795f556fea2fb59066567c30f3
2018-07-31 22:10:07 +09:00
Kartikaya Gupta
7906d74d42 Bug 1478097 - Follow-up to address review comments. r=me 2018-07-28 04:20:14 -04:00
Kartikaya Gupta
7d34b79e90 Bug 1478097 - Update indexer to visit implicit code inside constructors. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D2461

--HG--
extra : moz-landing-system : lando
2018-07-27 16:05:26 +00:00
Mike Hommey
b2837054ff Bug 1469091 - Build the clang plugin as a host shared library. r=ted
This adds just enough host shared library support for this one use case,
but also takes shortcuts, because fully supporting host shared library
is a deep rabbit hole I'm not ready to take just to fix --enable-lto
--enable-clang-plugin on mac builds.

One downside is that one my machine the plugin now takes > 80s to build,
instead of 15s before, thanks to the lack of unified sources.

--HG--
extra : rebase_source : bf52a72a01d4e3eb77cf52b646b19734b9273075
2018-07-05 14:58:09 +09:00
Mike Hommey
e22b35cf77 Bug 1470055 - Lift libstdc++ requirement relaxation when building clang-plugin. r=froydnj
--HG--
extra : rebase_source : 6c313ce673ff45fb1ca07530f801aef2f78be7e7
2018-06-21 11:45:30 +09:00
Mike Hommey
67a5371f47 Bug 1467658 - Upgrade the default clang toolchain to clang 6. r=chmanchester
The linux64-clang toolchain alias is currently clang 5. Switch it to
clang 6, but keep the spidermonkey tsan builds on clang 5 because of
bug 1467673.

The LLVM headers that come with clang 6 contain a DEBUG define that
conflicts with our DEBUG define and breaks the clang-plugin build,
so force unset ours.

--HG--
extra : rebase_source : aae88f1166108f003b06c022f14d5f4c61fc1ed9
2018-06-08 10:36:07 +09:00
Mike Hommey
27988b7ff9 Bug 1467658 - Allow the mozsearch-plugin code to build against clang 6. r=kats
Also work around https://bugs.llvm.org/show_bug.cgi?id=37746 by
explicitly handling ObjC interface variables separately. This actually
allows the searchfox macosx build to go much further than it used to (it
now fails during make package with apparently no output for rust code)

--HG--
extra : rebase_source : 354981ca9deebed5c60d3684f5c3abc554422393
2018-06-08 13:18:53 +09:00
Sylvestre Ledru
dcfef841a7 bug 1463425 - Fix flake8/pep8 issue by hand in build/ r=gps
MozReview-Commit-ID: AZdcEWyVV6e

--HG--
extra : rebase_source : b1c45028c8d46be5ba590a27a2f9f20e248a26b1
2018-05-21 23:58:19 +02:00
Sylvestre Ledru
8cd16bb55b bug 1463425 - autopep8 on build/ r=gps
MozReview-Commit-ID: ETzx4HsjbEF

--HG--
extra : rebase_source : 7e27a4cfe2bb358d513a18a33c245bcc6d559c46
2018-05-21 23:56:34 +02:00
Andi-Bogdan Postelnicu
c523c8faa9 Bug 1440886 - Implement a static analysis checker to detect usage of PR_LoadLibrary and LoadLibraryA/LoadLibraryExA/LoadLibrary/LoadLibraryEx. r=Nika
MozReview-Commit-ID: CUjfeBeOdsk

--HG--
extra : rebase_source : 633b900794cba24030c2b93d4d070d1447fff39b
2018-03-07 14:36:44 +02:00
Jeff Walden
cba0aa5d89 Bug 1452754 - Add tests to TestMustReturnFromCaller.cpp that verify that RAII destruction after a must-return-after expression is permitted. r=mystor
--HG--
extra : rebase_source : 6ca1082b766393fa90f3631fd09a399e01c9e6e6
2018-04-09 12:56:37 -07:00
Kartikaya Gupta
904dd3f563 Bug 1449291 - Use the macro expansion location for all tokens. r=emilio
MozReview-Commit-ID: 8lbpGSt6z4p

--HG--
extra : rebase_source : 048e11795f755391eca15666651dfc883b5ad8d9
2018-04-04 08:53:16 -04:00
Nathan Froyd
864247e806 Bug 1448028 - use third-party path list for implicit constructor checks; r=andi
The check for whether an implicit constructor is in a third-party
directory currently has a homegrown list of directories to ignore.
Let's move this over to the (more complete!) list of third-party
directories maintained elsewhere.
2018-03-27 10:51:31 -04:00
Chris Manchester
de12a7992b Bug 1429875 - Remove expandlibs and instead generate list files in the mozbuild backend. r=glandium
MozReview-Commit-ID: 5eLwnh1HHGj

--HG--
extra : rebase_source : cd308adc4542be0f9b33b64d31a2d0dc0310fcd4
2018-03-20 16:31:05 -07:00
Emilio Cobos Álvarez
b4171daa96 Bug 1444416: Make the diagnostic point to the bogus argument. r=mystor
It's much easier to find that way, specially for functions with tons of
argument.

MozReview-Commit-ID: i3PMjDOcH7

--HG--
extra : rebase_source : 2c79f0b4eb5c6022c3896ded3bd26ceda524ce5a
2018-03-09 19:37:58 +01:00
Emilio Cobos Álvarez
2125f0fbd4 Bug 1444416: Handle references in the "can run script" checker. r=mystor
MozReview-Commit-ID: 8F9HjiFqbGN

--HG--
extra : rebase_source : 03d49b9a605ff5eade81a814b0903f81d87720ab
2018-03-09 17:51:59 +01:00
Andi-Bogdan Postelnicu
87f362c024 Bug 1443438 - Modify matcher isInSystemHeader to be polymorphic. r=mystor
MozReview-Commit-ID: sA4XmHMkaR

--HG--
extra : rebase_source : 76e33cfe1b1de1df5e2cfcc36160d04fec98fdfc
2018-03-06 11:59:05 +02:00
Kartikaya Gupta
e9cad65dd5 Bug 1438866 - Mark empty filenames not interesting. r=emilio
In some cases we have SourceLocation objections that are isMacroId()
rather than isFileId() and so don't have a filename at all. In other
cases the filename is something clang-internal like "<scratch>". In
both of these situations we don't want to output any analysis data.
However, the code previously was taking the empty filename and resolving
it relative to the source folder, and then tried to write to the
source folder or create a file corresponding to a subfolder. This
resulted in general badness. This patch makes sure we ignore analysis
from places that don't have a corresponding file so that we don't
have this problem.

MozReview-Commit-ID: 7WluygY9Uy8

--HG--
extra : rebase_source : 35d7e71fc05bbd5a3357a57db9de25782178622a
2018-02-18 22:18:57 -05:00
Kartikaya Gupta
87bfbc06cf Bug 1438866 - Add some utility code to help with debugging. r=emilio
This adds an RAII class and macro that can be quickly added in functions
to log entry/exit from the function. This is useful to debugging.

MozReview-Commit-ID: 4Ud8jLOxI0R

--HG--
extra : rebase_source : 518d30fe44dff67bffb186e23c1eb858c02280af
2018-02-16 17:07:39 -05:00