rewrite_to_chrome_style: handle UnresolvedUsingValueDecl renaming |
|||
Issue description
In wtf/Vector.h, declaration of |m_size| in VectorBufferBase gets rewritten to |size_| (so far so good), but references to this field do not always get rewritten - for example:
Vector(size_t size, const T& val)
: Base(size)
{
ANNOTATE_NEW_BUFFER(begin(), Capacity(), size);
m_size = size;
TypeOperations::uninitializedFill(begin(), end(), val);
}
,
Aug 22 2016
It seems to me that the problem is that ...
unresolvedMemberExpr(
allOverloadsMatch(
anyOf(method_decl_matcher, method_template_decl_matcher)))));
... only matches methods and in our case, |allOverloadsMatch| iterates only over one candidate: UnresolvedUsingValueDecl ... Base::m_size ...
I am trying to figure out which inner matcher I can use to match UnresolvedUsingValueDecl (+ bind the "decl" id to the right decl).
,
Aug 24 2016
,
Aug 24 2016
,
Aug 24 2016
Fix proposed at https://codereview.chromium.org/2274653002
,
Nov 30 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ff1d946e89c5fc53fb7c6f2e41b1bcbd9a06b238 commit ff1d946e89c5fc53fb7c6f2e41b1bcbd9a06b238 Author: lukasza <lukasza@chromium.org> Date: Wed Nov 30 14:52:49 2016 Handling of UnresolvedUsingValueDecl nodes. BUG= 640016 Review-Url: https://codereview.chromium.org/2274653002 Cr-Commit-Position: refs/heads/master@{#435259} [modify] https://crrev.com/ff1d946e89c5fc53fb7c6f2e41b1bcbd9a06b238/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp [modify] https://crrev.com/ff1d946e89c5fc53fb7c6f2e41b1bcbd9a06b238/tools/clang/rewrite_to_chrome_style/tests/template-expected.cc [modify] https://crrev.com/ff1d946e89c5fc53fb7c6f2e41b1bcbd9a06b238/tools/clang/rewrite_to_chrome_style/tests/template-original.cc
,
Nov 30 2016
|
|||
►
Sign in to add a comment |
|||
Comment 1 by lukasza@chromium.org
, Aug 22 2016I think I have a small repro: template <typename T> class BaseClass { public: unsigned long m_size; }; template <typename T> class DerivedClass : protected BaseClass<T> { private: using Base = BaseClass<T>; using Base::m_size; void method() { m_size = 123; // <- |m_size| should get rewritten to |size_|. } }; And it seems that the trouble comes from UnresolvedMemberExpr: `-CXXMethodDecl 0x5c7ced0 <line:138:3, line:140:3> line:138:8 method 'void (void)' `-CompoundStmt 0x5c7d028 <col:17, line:140:3> `-BinaryOperator 0x5c7d000 <line:139:5, col:14> '<dependent type>' '=' |-UnresolvedMemberExpr 0x5c7cf78 <col:5> '<dependent type>' lvalue `-IntegerLiteral 0x5c7cfe0 <col:14> 'int' 123