Skip to content

Static analyzer cherrypicks 2023/12 #7893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 17, 2023

Conversation

haoNoQ
Copy link

@haoNoQ haoNoQ commented Dec 16, 2023

Cherry-pick [[clang::suppress]] and a couple patches for WebKit checkers.

haoNoQ and others added 3 commits December 15, 2023 19:11
…c analysis warnings.

The new attribute can be placed on statements in order to suppress
arbitrary warnings produced by static analysis tools at those statements.

Previously such suppressions were implemented as either informal comments
(eg. clang-tidy `// NOLINT:`) or with preprocessor macros (eg.
clang static analyzer's `#ifdef __clang_analyzer__`). The attribute
provides a universal, formal, flexible and neat-looking suppression mechanism.

Implement support for the new attribute in the clang static analyzer;
clang-tidy coming soon.

The attribute allows specifying which specific warnings to suppress,
in the form of free-form strings that are intended to be specific to
the tools, but currently none are actually supported; so this is also
going to be a future improvement.

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

(cherry picked from commit ef3f476)

Conflicts:
	clang/test/SemaCXX/suppress.cpp
…fined on different classes. (llvm#69985)

(cherry picked from commit 09273d4)
…ion.

It can take raw pointers without triggering a warning.

Also retire the support for makeRef and makeWeakPtr as they have been removed
from WebKit.

(cherry picked from commit 5070c1e)
@haoNoQ
Copy link
Author

haoNoQ commented Dec 16, 2023

@swift-ci please test

@haoNoQ haoNoQ merged commit 7c01133 into stable/20230725 Dec 17, 2023
[[gsl::suppress]] int x; // expected-error {{'suppress' attribute takes at least 1 argument}}
[[gsl::suppress()]] int y; // expected-error {{'suppress' attribute takes at least 1 argument}}
int [[gsl::suppress("r")]] z; // expected-error {{'suppress' attribute cannot be applied to types}}
[[gsl::suppress(f_)]] float f; // expected-error {{expected string literal as argument of 'suppress' attribute}}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be incorrect for stable/20230725 because the wording only seem implemented in https://reviews.llvm.org/D156237, which was only merged in August 15th.

The generated message in this branch is ”'suppress' attribute requires a string”.

All three instances of ”expected string literal…” in this change should be changed to the former spelling.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh-oh! I'll fix.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like I forgot to run tests entirely. Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants