New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 685357 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 645511
Owner: ----
Closed: Jan 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 578344



Sign in to add a comment

rewrite_to_chrome_style: extern template declarations don't get rewritten

Project Member Reported by lukasza@chromium.org, Jan 25 2017

Issue description

Example came from third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.h:

...
template <typename Strategy>
String SerializeNodes(MarkupAccumulator&, Node&, EChildrenOnly);

extern template String serializeNodes<EditingStrategy>(MarkupAccumulator&,
                                                       Node&,
                                                       EChildrenOnly);
...
 
Interestingly, the extern template declaration is not visible in the AST at all - AFAICT the AST doesn't have any node referring to anything after line 9.

$ nl -b a -n rn -s ' ' $HOME/src/chromium4/src/tools/clang/rewrite_to_chrome_style/tests/template-original.cc
     1 namespace blink {
     2 
     3 namespace extern_template_declaration {
     4 
     5 class EditingStrategy {};
     6 
     7 template <typename Strategy>
     8 void serializeNodes();
     9 
    10 //  https://crbug.com/685357  - we didn't rename serializeNodes below.
    11 extern template void serializeNodes<EditingStrategy>();
    12 
    13 }  // namespace extern_template_declaration
    14 
    15 }  // namespace blink


$ clang++ -Xclang -ast-dump -std=c++11 -fsyntax-only -I $HOME/src/chromium4/src -I $HOME/src/chromium4/src/testing/gtest/include -c $HOME/src/chromium4/src/tools/clang/rewrite_to_chrome_style/tests/template-original.cc
...
`-NamespaceDecl 0x66313e0 </usr/local/google/home/lukasza/src/chromium4/src/tools/clang/rewrite_to_chrome_style/tests/template-original.cc:1:1, line:15:1> line:1:11 blink
  `-NamespaceDecl 0x6631448 <line:3:1, line:13:1> line:3:11 extern_template_declaration
    |-CXXRecordDecl 0x66314b0 <line:5:1, col:24> col:7 referenced class EditingStrategy definition
    | `-CXXRecordDecl 0x66315d0 <col:1, col:7> col:7 implicit class EditingStrategy
    `-FunctionTemplateDecl 0x6631828 <line:7:1, line:8:21> col:6 serializeNodes
      |-TemplateTypeParmDecl 0x6631688 <line:7:11, col:20> col:20 typename Strategy
      |-FunctionDecl 0x6631790 <line:8:1, col:21> col:6 serializeNodes 'void (void)'
      `-FunctionDecl 0x6631980 <col:1, col:21> col:6 serializeNodes 'void (void)'
        `-TemplateArgument type 'class blink::extern_template_declaration::EditingStrategy'
(END)
Ooops, actually the second FunctionDecl seems to correspond to the extern template decl.  I am guessing that the trouble is that the location is wrong, because of https://llvm.org/bugs/show_bug.cgi?id=30338.
Mergedinto: 645511
Status: Duplicate (was: Available)

Sign in to add a comment