Chromium Code Reviews
Descriptionclang-plugins: Don't strip non const references in auto raw ptr fixits.
This patch updates the clang plugin not to strip references to non const
pointers, since the fixit might modify behavior:
int number;
std::vector<int*> vector{&number};
auto& a = vector[0];
a = nullptr; // Modifies the vector.
Without this patch, the suggestions is to replace auto& with auto*
yielding:
int number;
std::vector<int*> vector{&number};
auto* a = vector[0];
a = nullptr; // Does not modify the vector anymore.
With this patch, the suggestion is the following:
int number;
std::vector<int*> vector{&number};
auto*& a = vector[0];
a = nullptr; // Modifies the vector.
R=dcheng
BUG=554600
Committed: https://crrev.com/678f0872c6250ab00efda5f6aba79b923585dc71
Cr-Commit-Position: refs/heads/master@{#403005}
Patch Set 1 #
Total comments: 1
Messages
Total messages: 13 (5 generated)
|
|||||||||||||||||||||||||||||||||||||