Skip to content

Avoid IWYU False Positives on external libraries #266

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 1 commit into from
Mar 20, 2024

Conversation

geoffviola
Copy link
Contributor

Follow-up to #217

Here is another try at addressing #27. Instead of only checking against the qualified call (i.e. std::), it also checks against the unqualified call. This change should preserve backward compatibility while preventing false positives for common names in other namespaces.

Here is a quick list of checks

These emit warnings

std::make_pair(1, 2)
std::make_pair(1, 2)
make_pair(1, 2)
auto foo = std::make_pair(1, 2)

These do not emit warnings

boost::make_pair(1, 2)
asdfasdf::make_pair(1, 2)
asdfasdfstd::make_pair(1, 2)
.make_pair(1, 2)

Copy link
Member

@aaronliu0130 aaronliu0130 left a comment

Choose a reason for hiding this comment

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

Seems good, although...

  1. The added test case violates IWYU (include-what-you-use), as boost::range::transform isn't included. Regardless, as agreed upon in #94, we shouldn't make implementing IWYU functionality an explicit goal.
  2. A better approach might be to check for using namespace ... declarations and modify the regex/use a different regex for lines after such declarations, though this approach works well enough.

@aaronliu0130 aaronliu0130 changed the title Avoid False Positives on Transform Issue27 Try2 Avoid IWYU False Positives on external libraries Mar 20, 2024
@aaronliu0130 aaronliu0130 merged commit 3791cc4 into cpplint:develop Mar 20, 2024
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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy