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
readability-redundant-smartptr-get doesn't report get() usage in conditions #26178
Comments
Please provide a self-contained repro (system #includes are fine). |
The cases that are missing are:
|
I tried Clang-tidy trunk version on attached example and comaprison with nullptr are not reported. |
Are you using libc++? |
This seems to be related with how libc++ deals with ABI compatibility. We could try to fix hasName() to understand inline namespaces, or we could fix the checks to match the name differently. |
Yes, I used libc++. Just in case complete compile command line parameters: -Weverything -std=c++11 -m64 -stdlib=libc++ -lc++abi -lc++ SmartPtrGet.cpp -o SmartPtrGet.exe |
Fixing hasName to deal with inline namespaces seems like a better idea to me. Littering every STL specific checks with library implementation details might result in hard to maintain code. |
Sent http://reviews.llvm.org/D15506 for review |
Fixed in r259898. |
I run this check through LLDB code and next cases still not detected:
|
I'm not treating this as a 3.8 blocker. |
D24893 up for review. |
Fixed in r282386. |
Thank you for help, Kirill! |
Extended Description
I tried to run trunk Clang-tidy readability-redundant-smartptr-get for LLDB code (source/Target/Target.cpp) (as of r255174) and this check doesn't report get usage in conditions like:
if (m_process_sp.get())
if (m_source_manager_ap.get() == NULL)
if (rhs.m_thread_spec_ap.get() != NULL)
Such cases should be handled as http://en.cppreference.com/w/cpp/memory/shared_ptr/operator_bool.
The text was updated successfully, but these errors were encountered: