Skip to content
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

performance-inefficient-vector-operation not detected in member function #49501

Closed
firewave opened this issue Apr 28, 2021 · 2 comments
Closed
Labels
bugzilla Issues migrated from bugzilla clang-tidy confirmed Verified by a second party

Comments

@firewave
Copy link

firewave commented Apr 28, 2021

Bugzilla Link 50157
Version unspecified
OS Windows NT
CC @EugeneZelenko,@hokein

Extended Description

#include <vector>

struct A
{
 void f() const
 {
   std::vector<int> v_s;

   for (const auto& s : v_) {
     v_s.emplace_back(s);
   }
 }

  std::vector<int> v_;
};

This was reduced from a much bigger class where the variable was actually filled.

If I make both members static or implement it with a function and a global warning the warning is being reported.

Tested with version 11.0.1.

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 30, 2021

Proposed patch - https://reviews.llvm.org/D101624

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
@llvmbot llvmbot added the confirmed Verified by a second party label Jan 26, 2022
@njames93
Copy link
Member

njames93 commented Apr 8, 2022

Fixed in 0e0b0fe

@njames93 njames93 closed this as completed Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-tidy confirmed Verified by a second party
Projects
None yet
Development

No branches or pull requests

3 participants