Skip to content

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