std-like names in WTF containers should NOT be rewritten (i.e. pop_back -> Pop_back) |
||||||||||
Issue descriptionToday, the rewrite_to_chrome_style tool will make the following, undesired changes: - WTF::Vector<T> - pop_back -> Pop_back - emplace_back -> Emplace_back - front -> Front - back -> Back See also the following PSA about WTF:: container method names in blink-dev: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/UjgsNYcB3Qc
,
Dec 9 2016
,
Dec 9 2016
sgtm: let's coordinate with pilgrim@ and make sure the tool knows about all the planned replacements in advance.
,
Dec 19 2016
,
Dec 28 2016
,
Dec 28 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/fa323b77ef5fbe07d35990c36eb3ad84eece2d5f commit fa323b77ef5fbe07d35990c36eb3ad84eece2d5f Author: lukasza <lukasza@chromium.org> Date: Wed Dec 28 19:40:31 2016 Blacklisting of method names coming from std library. BUG= 672902 Review-Url: https://codereview.chromium.org/2601063002 Cr-Commit-Position: refs/heads/master@{#440879} [modify] https://crrev.com/fa323b77ef5fbe07d35990c36eb3ad84eece2d5f/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp [modify] https://crrev.com/fa323b77ef5fbe07d35990c36eb3ad84eece2d5f/tools/clang/rewrite_to_chrome_style/tests/function-templates-expected.cc [modify] https://crrev.com/fa323b77ef5fbe07d35990c36eb3ad84eece2d5f/tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc [modify] https://crrev.com/fa323b77ef5fbe07d35990c36eb3ad84eece2d5f/tools/clang/rewrite_to_chrome_style/tests/methods-original.cc
,
Dec 29 2016
,
Jan 25 2017
There is at least one more std-like thing: - We shouldn't rename |size()| to |Size()| (e.g. this is used in a template that accepts std:: and WTF:: things in mojo/public/cpp/bindings/lib/serialization.h:76) One quirk here is that blacklisting done by IsBlacklistedInstanceMethodName doesn't look at parameters. This is okay for |insert|, but we might want to consider only blacklisting if there are 0 parameters (which will be true for accessors like |back|, |empty|, |front|, |size| and also for |erase|).
,
Jan 26 2017
And maybe we shouldn't rename |length()| - for compatibility between std::string and WTF::String assumed by the code generator from third_party/inspector_protocol - for not having to blacklist individual length methods assumed by DOM bindings (see https://chromium.googlesource.com/chromium/src/+/c96e02d34a39e6a3e790c563cb506b73aa134e2b/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl#23)
,
Jan 27 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/265ae0467148c0872ccae6c862813d27f21ce031 commit 265ae0467148c0872ccae6c862813d27f21ce031 Author: lukasza <lukasza@chromium.org> Date: Fri Jan 27 15:07:58 2017 Blacklisting renaming of |size()| and |length()| methods. BUG= 672902 Review-Url: https://codereview.chromium.org/2657773003 Cr-Commit-Position: refs/heads/master@{#446667} [modify] https://crrev.com/265ae0467148c0872ccae6c862813d27f21ce031/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
,
Jan 27 2017
,
Apr 6 2017
There are some more cases of STL-like names that we should take into account. For sure, we should skip renaming "at". I don't know if there are others.
,
Apr 6 2017
pilgrim@: Could you please review the list of STL-like method names that should not be renamed to Chromium style by the rewriter tool? Currently IsBlacklistedInstanceMethodName in tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp has:
static const char* kBlacklistedNames[] = {
// We should avoid renaming the method names listed below, because
// 1. They are used in templated code (e.g. in <algorithms>)
// 2. They (begin+end) are used in range-based for syntax sugar
// - for (auto x : foo) { ... } // <- foo.begin() will be called.
"begin", "end", "rbegin", "rend", "lock", "unlock", "try_lock",
// https://crbug.com/672902 : Should not rewrite names that mimick methods
// from std library.
"back", "empty", "erase", "front", "insert", "length", "size",
};
Can you please help us identify other methods that should not be renamed? We accidentally found |at| (which should probably not be renamed to |At|), but you probably know better which other STL-like method names we should special case.
,
Apr 6 2017
https://crbug.com/662431 contains all the STL-related changes I've made to WTF. Searching the committed CL descriptions for the string "() to ::" yields the following list of new or updated method names: push_back insert erase at front back pop_back pop_front push_front
,
Apr 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5ecbba9425dfba1578ec8e2ff884130a2a2d2b9e commit 5ecbba9425dfba1578ec8e2ff884130a2a2d2b9e Author: lukasza <lukasza@chromium.org> Date: Thu Apr 06 19:25:03 2017 Stop renaming |at| method to maintain compatibility with STL algorithms. BUG= 672902 Review-Url: https://codereview.chromium.org/2796413004 Cr-Commit-Position: refs/heads/master@{#462581} [modify] https://crrev.com/5ecbba9425dfba1578ec8e2ff884130a2a2d2b9e/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
,
Apr 6 2017
|
||||||||||
►
Sign in to add a comment |
||||||||||
Comment 1 by lukasza@chromium.org
, Dec 9 2016