rewrite_to_chrome_style: blink::V8Document::openMethodCustom should not be renamed (b/c it has canonical method in generated code) |
||
Issue description
../../third_party/WebKit/Source/bindings/core/v8/custom/V8DocumentCustom.cpp:56:18: error: out-of-line definition of 'OpenMethodCustom' does not match any declaration in 'blink::V8Document'; did you mean 'openMethodCustom'?
void V8Document::OpenMethodCustom(
^~~~~~~~~~~~~~~~
openMethodCustom
gen/blink/bindings/core/v8/V8Document.h:49:15: note: 'openMethodCustom' declared here
static void openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&);
^
,
Jan 20 2017
It turns out that https://crrev.com/2640283003 regresses handling of function template specializations (|to| is not rewritten to |To| on lines 347, 352, 357, 361 below): 343 template <unsigned long sizeOfValue> 344 int toV8SignedIntegerInternal(long value); 345 346 template <> 347 int toV8SignedIntegerInternal<4>(long value) { 348 return 123 + value; 349 } 350 351 template <> 352 int toV8SignedIntegerInternal<8>(long value) { 353 return 456 + value; 354 } 355 356 int toV8(int value) { 357 return toV8SignedIntegerInternal<sizeof value>(value); 358 } 359 360 int toV8(long value) { 361 return toV8SignedIntegerInternal<sizeof value>(value); 362 } I still have to investigate what is happening here. Hypothesis 1: getCanonicalDecl does something weird for templates Hypothesis 2: using getCanonicalDecl messes up which AST node gets bound to "decl" id
,
Jan 20 2017
FWIW, the skipped / not renamed decl looks as follows:
FunctionDecl 0x400a2f0 prev 0x400a5a0 </usr/local/google/home/lukasza/src/chromium4/src/tools/clang/rewrite_to_chrome_style/tests/template-actual.cc:8:1, line:11:1> line:9:5 used toV8SignedIntegerInternal 'int (long)'
|-TemplateArgument integral 4
|-ParmVarDecl 0x400a260 <col:34, col:39> col:39 used value 'long'
`-CompoundStmt 0x400a7e8 <col:46, line:11:1>
`-ReturnStmt 0x400a7d0 <line:10:3, col:16>
`-ImplicitCastExpr 0x400a7b8 <col:10, col:16> 'int' <IntegralCast>
`-BinaryOperator 0x400a790 <col:10, col:16> 'long' '+'
|-ImplicitCastExpr 0x400a778 <col:10> 'long' <IntegralCast>
| `-IntegerLiteral 0x400a718 <col:10> 'int' 123
`-ImplicitCastExpr 0x400a760 <col:16> 'long' <LValueToRValue>
`-DeclRefExpr 0x400a738 <col:16> 'long' lvalue ParmVar 0x400a260 'value' 'long'
And its canonical decl is:
FunctionDecl 0x400a5a0 </usr/local/google/home/lukasza/src/chromium4/src/tools/clang/rewrite_to_chrome_style/tests/template-actual.cc:6:1, col:41> line:9:5 used toV8SignedIntegerInternal 'int (long)'
|-TemplateArgument integral 4
`-ParmVarDecl 0x400a510 <line:6:31, col:36> col:36 value 'long'
I think I will proceed with only applying hasCanonicalDecl matcher to detection of generated files, and keep using the main decl under consideration with |decl_under_blink_namespace|. This approach passes unit tests and seems to work fine with the big rename as well. OTOH, let me take a closer look at the remaining errors after the big rename.
,
Jan 26 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by lukasza@chromium.org
, Jan 19 2017