-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
clang-tidy: readability-redundant-smartptr-get does not remove -> (#97964) #98757
Conversation
…vm#97964) added a check to remove '->' if exists
@llvm/pr-subscribers-libc @llvm/pr-subscribers-clang-tidy Author: None (akshaykumars614) Changesadded a check to remove '->' if exists Full diff: https://github.com/llvm/llvm-project/pull/98757.diff 1 Files Affected:
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
index 8837ac16e8828..be52af77ae0a5 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
@@ -164,6 +164,10 @@ void RedundantSmartptrGetCheck::check(const MatchFinder::MatchResult &Result) {
StringRef SmartptrText = Lexer::getSourceText(
CharSourceRange::getTokenRange(Smartptr->getSourceRange()),
*Result.SourceManager, getLangOpts());
+ // Check if the last two characters are "->" and remove them
+ if (SmartptrText.ends_with("->")) {
+ SmartptrText = SmartptrText.drop_back(2);
+ }
// Replace foo->get() with *foo, and foo.get() with foo.
std::string Replacement = Twine(IsPtrToPtr ? "*" : "", SmartptrText).str();
diag(GetCall->getBeginLoc(), "redundant get() call on smart pointer")
|
I am not sure if I need to write a test case for clang-tidy |
Yes, and release notes entry, |
can you tell me where to add test case and release notes entry |
I am new here |
Tests: Release notes: |
This addresses the build error introduced in llvm#98287 where src/errno/errno.h is included instead of the system errno.h. We instead move the declaration to libc_errno.h.
The declaration must match the previous declaration in errno.h.
The definitions must match the previous declaration in errno.h.
…97964) Added test case and updated Release Notes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix release notes, and remove not related changed to errno (i assume due to merge).
fell free to rebase branch if needed
…97964) Added test case and updated Release Notes
added a check to remove '->' if exists
Fixes #97964