forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 344
Cherrypicks NSDateFormatter checker and other related (missing) commits in clang-tidy #5075
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
t-rasmud
merged 24 commits into
swiftlang:stable/20220421
from
t-rasmud:cherrypick-nsdate-checker
Aug 9, 2022
Merged
Cherrypicks NSDateFormatter checker and other related (missing) commits in clang-tidy #5075
t-rasmud
merged 24 commits into
swiftlang:stable/20220421
from
t-rasmud:cherrypick-nsdate-checker
Aug 9, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Detect identifiers that are confusable using a variant of Unicode definition http://www.unicode.org/reports/tr39/#Confusable_Detection and have conflicting scopes. This a recommit (with portability and feature fixes) of b94db7e Differential Revision: https://reviews.llvm.org/D112916 (cherry picked from commit c3574ef)
Properly checks enclosing DeclContext, and add the related test case. It would be great to be able to use Sema to check conflicting scopes, but that's not something clang-tidy seems to be able to do :-/ Fix llvm#56221 Differential Revision: https://reviews.llvm.org/D128715 (cherry picked from commit 7a55021)
Differential Revision: https://reviews.llvm.org/D128103 (cherry picked from commit eb1d908)
Differential Revision: https://reviews.llvm.org/D126097 (cherry picked from commit 95a9299)
Eliminate clutter by reorganizing the Lit test files for clang-tidy: - Move checkers/<module>-* to checkers/<module>/*. - Move module specific inputs from Inputs to <module>/Inputs. Remove any module prefix from the file or subdirectory name as they are no longer needed. - Introduce a Lit substitution %clang_tidy_headers for the system headers in checkers/Inputs/Headers and use this throughout. This avoids referencing system headers through a relative path to the parent directory and makes it clear that these fake system headers are shared among all modules. - Update add_new_check.py to follow the above conventions when creating the boiler plate test files for a new check. - Update Contributing.rst to describe per-module Inputs directory and fix link to test source code. Differential Revision: https://reviews.llvm.org/D128072 (cherry picked from commit 89a1d03)
The misc-unused-parameters check would trigger false positive warnings about the parameter being unused when the parameter declaration was invalid. No longer issue the warning in that case on the assumption that most parameters are used in practice, so the extra diagnostic is most likely a false positive. Fixes llvm#56152 (cherry picked from commit bb29702)
Add a recursive descent parser to match macro expansion tokens against fully formed valid expressions of integral literals. Partial expressions will not be matched -- they can't be valid initializing expressions for an enum. Differential Revision: https://reviews.llvm.org/D124500 Fixes llvm#55055 (cherry picked from commit 5122738)
Modernize-macro-to-enum shouldn't try to convert macros to enums when they are defined inside a declaration or definition, only when the macros are defined at the top level. Since preprocessing is disconnected from AST traversal, match nodes in the AST and then invalidate source ranges spanning AST nodes before issuing diagnostics. ClangTidyCheck::onEndOfTranslationUnit is called before PPCallbacks::EndOfMainFile, so defer final diagnostics to the PPCallbacks implementation. Differential Revision: https://reviews.llvm.org/D124066 Fixes llvm#54883 (cherry picked from commit b985b6e)
…gRef would suffice. There's many instances in clang tidy checks where owning strings are used when we already have a stable string from the options, so using a StringRef makes much more sense. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D124341 (cherry picked from commit 12cb540)
(cherry picked from commit a308a55)
…sitors Reimplement the matching logic using Visitors instead of matchers. Benchmarks from running the check over SemaCodeComplete.cpp Before 0.20s, After 0.04s Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D125026 (cherry picked from commit 6f87261)
…t cast in return. Fixes llvm#55557 Reviewed By: LegalizeAdulthood Differential Revision: https://reviews.llvm.org/D125877 (cherry picked from commit 4739176)
…nit statement or condition variable Fixes llvm#55553. Reviewed By: LegalizeAdulthood Differential Revision: https://reviews.llvm.org/D125874 (cherry picked from commit 3566024)
(cherry picked from commit 07c6635)
…lify-bool-expr Adds support for recognising and converting boolean expressions that can be simplified using De Morgans Law. This is a different implementation to D124650. Fixes llvm#55092 Reviewed By: LegalizeAdulthood Differential Revision: https://reviews.llvm.org/D124806 (cherry picked from commit af77b1d)
(cherry picked from commit 9d0d24e)
Adds an option SimplifyDemorganRelaxed which, when enabled, will transform negated conjunctions or disjunctions when neither operand is a negation. Default value is `false`. Reviewed By: LegalizeAdulthood Differential Revision: https://reviews.llvm.org/D126162 (cherry picked from commit f3c1d28)
(cherry picked from commit b831786)
- Rename doc files to subdirs by module - Update release notes and check list to use subdirs - Update add_new_check.py to handle doc subdirs Differential Revision: https://reviews.llvm.org/D126495 (cherry picked from commit 6e566bc)
… "C" blocks The check should not report includes wrapped by `extern "C" { ... }` blocks, such as: ```lang=C++ extern "C" { } ``` This pattern comes up sometimes in header files designed to be consumed by both C and C++ source files. The check now reports false reports when the header file is consumed by a C++ translation unit. In this change, I'm not emitting the reports immediately from the `PPCallback`, rather aggregating them for further processing. After all preprocessing is done, the matcher will be called on the `TranslationUnitDecl`, ensuring that the check callback is called only once. Within that callback, I'm recursively visiting each decls, looking for `LinkageSpecDecls` which represent the `extern "C"` specifier. After this, I'm dropping all the reports coming from inside of it. After the visitation is done, I'm emitting the reports I'm left with. For performance reasons, I'm sorting the `IncludeMarkers` by their corresponding locations. This makes the scan `O(log(N)` when looking up the `IncludeMarkers` affected by the given `extern "C"` block. For this, I'm using `lower_bound()` and `upper_bound()`. Reviewed By: whisperity Differential Revision: https://reviews.llvm.org/D125209 (cherry picked from commit 7e3ea55)
…t extern "C" blocks" This reverts commit 7e3ea55. Looks like this breaks tests: http://45.33.8.238/linux/76033/step_8.txt (cherry picked from commit e8cae48)
…t extern "C" blocks"" This partially reverts commit e8cae48. Changes since that commit: - Use `SourceManager::isBeforeInTranslationUnit` instead of the fancy decomposed decl logarithmic search. - Add a test for including a system header containing a deprecated include. - Add `REQUIRES: system-linux` clause to the test. Reviewed By: LegalizeAdulthood, whisperity Differential Revision: https://reviews.llvm.org/D125209 (cherry picked from commit 665bfbb)
modernize-use-emplace only recommends going from a push_back to an emplace_back, but does not provide a recommendation when emplace_back is improperly used. This adds the functionality of warning the user when an unecessary temporary is created while calling emplace_back or other "emplacy" functions from the STL containers. Reviewed By: kuhar, ivanmurashko Differential Revision: https://reviews.llvm.org/D101471 (cherry picked from commit 987f9cb)
C requires that enum values fit into an int. Scan the macro tokens present in an initializing expression and reject macros that contain tokens that have suffixes making them larger than int. C forbids the comma operator in enum initializing expressions, so optionally reject comma operator. Differential Revision: https://reviews.llvm.org/D125622 Fixes llvm#55467 (cherry picked from commit b418ef5)
@swift-ci test |
1 similar comment
@swift-ci test |
@swift-ci please test |
haoNoQ
approved these changes
Aug 8, 2022
swift-ci please test macOS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.