<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[185906] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/185906">185906</a></dd>
<dt>Author</dt> <dd>zandobersek@gmail.com</dd>
<dt>Date</dt> <dd>2015-06-24 05:19:19 -0700 (Wed, 24 Jun 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Improve the source code generated by make_names.pl
https://bugs.webkit.org/show_bug.cgi?id=146208

Reviewed by Darin Adler.

Source/WebCore:

Clean up and optimize the output that's generated by the make_names.pl script
when generating large sets of DOM names for attributes and tags.

The GenerateStrings() function in the StaticString.pm module is split into
GenerateStringData() and GenerateASCIILiteral() so that the two new functions
can be used independently, with the original function still being called when
generating font names.

Tags and attributes have the corresponding static QualifiedName globals defined
as before. After that, two static const std::array&lt;&gt; objects are defined for
both types -- the first is an ordered array of addresses of the QualifiedName
objects (corresponding to the C array that was defined in getHTMLTags(),
getSVGAttrs() etc.), and the second is an ordered array of StringImpl::StaticASCIILiteral
objects that replaces separately defined StringImpl::StaticASCIILiteral objects
and the additional tables that contained pairs of QualifiedName object addresses
and the corresponding StaticASCIILiteral object references in the init() function.
This is all generated by the printStaticData() function in make_names.pl.

The printQualifiedNameCreation() function generates a static_assert() that ensures
that the corresponding std::array&lt;QualifiedName*&gt; and std::array&lt;StaticASCIILiteral&gt;
objects have the same amount of items, and then sets up a loop that walks through
the two arrays and properly constructs the QualifiedName objects from the static
literal data.

On the GTK port, this shaves off ~54kB from the final stripped shared library
on a 64-bit build, and ~21kB on a 32-bit build.

* bindings/scripts/StaticString.pm:
(GenerateStringData):
(GenerateASCIILiteral):
(GenerateStrings):
* dom/make_names.pl:
(printCppHead):
(printNamesCppFile):
(printStaticData):
(printQualifiedNameCreation):
(printInit): Deleted.
(printDefinitions): Deleted.

Source/WTF:

* wtf/text/StringImpl.h:
(WTF::StringImpl::assertHashIsCorrect): Make this method const-qualified.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtftextStringImplh">trunk/Source/WTF/wtf/text/StringImpl.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsStaticStringpm">trunk/Source/WebCore/bindings/scripts/StaticString.pm</a></li>
<li><a href="#trunkSourceWebCoredommake_namespl">trunk/Source/WebCore/dom/make_names.pl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (185905 => 185906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-06-24 09:25:06 UTC (rev 185905)
+++ trunk/Source/WTF/ChangeLog        2015-06-24 12:19:19 UTC (rev 185906)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-06-24  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
+
+        Improve the source code generated by make_names.pl
+        https://bugs.webkit.org/show_bug.cgi?id=146208
+
+        Reviewed by Darin Adler.
+
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::assertHashIsCorrect): Make this method const-qualified.
+
</ins><span class="cx"> 2015-06-22  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Make Array.join work directly on substrings without reifying them
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringImpl.h (185905 => 185906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringImpl.h        2015-06-24 09:25:06 UTC (rev 185905)
+++ trunk/Source/WTF/wtf/text/StringImpl.h        2015-06-24 12:19:19 UTC (rev 185906)
</span><span class="lines">@@ -901,7 +901,7 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><del>-    void assertHashIsCorrect()
</del><ins>+    void assertHashIsCorrect() const
</ins><span class="cx">     {
</span><span class="cx">         ASSERT(hasHash());
</span><span class="cx">         ASSERT(existingHash() == StringHasher::computeHashAndMaskTop8Bits(characters8(), length()));
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (185905 => 185906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-06-24 09:25:06 UTC (rev 185905)
+++ trunk/Source/WebCore/ChangeLog        2015-06-24 12:19:19 UTC (rev 185906)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2015-06-24  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
+
+        Improve the source code generated by make_names.pl
+        https://bugs.webkit.org/show_bug.cgi?id=146208
+
+        Reviewed by Darin Adler.
+
+        Clean up and optimize the output that's generated by the make_names.pl script
+        when generating large sets of DOM names for attributes and tags.
+
+        The GenerateStrings() function in the StaticString.pm module is split into
+        GenerateStringData() and GenerateASCIILiteral() so that the two new functions
+        can be used independently, with the original function still being called when
+        generating font names.
+
+        Tags and attributes have the corresponding static QualifiedName globals defined
+        as before. After that, two static const std::array&lt;&gt; objects are defined for
+        both types -- the first is an ordered array of addresses of the QualifiedName
+        objects (corresponding to the C array that was defined in getHTMLTags(),
+        getSVGAttrs() etc.), and the second is an ordered array of StringImpl::StaticASCIILiteral
+        objects that replaces separately defined StringImpl::StaticASCIILiteral objects
+        and the additional tables that contained pairs of QualifiedName object addresses
+        and the corresponding StaticASCIILiteral object references in the init() function.
+        This is all generated by the printStaticData() function in make_names.pl.
+
+        The printQualifiedNameCreation() function generates a static_assert() that ensures
+        that the corresponding std::array&lt;QualifiedName*&gt; and std::array&lt;StaticASCIILiteral&gt;
+        objects have the same amount of items, and then sets up a loop that walks through
+        the two arrays and properly constructs the QualifiedName objects from the static
+        literal data.
+
+        On the GTK port, this shaves off ~54kB from the final stripped shared library
+        on a 64-bit build, and ~21kB on a 32-bit build.
+
+        * bindings/scripts/StaticString.pm:
+        (GenerateStringData):
+        (GenerateASCIILiteral):
+        (GenerateStrings):
+        * dom/make_names.pl:
+        (printCppHead):
+        (printNamesCppFile):
+        (printStaticData):
+        (printQualifiedNameCreation):
+        (printInit): Deleted.
+        (printDefinitions): Deleted.
+
</ins><span class="cx"> 2015-06-24  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
</span><span class="cx"> 
</span><span class="cx">         Refactor UserMediaRequest to share more codes between MediaDevices.getUserMedia and legacy webkitGetUserMedia
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsStaticStringpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/StaticString.pm (185905 => 185906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/StaticString.pm        2015-06-24 09:25:06 UTC (rev 185905)
+++ trunk/Source/WebCore/bindings/scripts/StaticString.pm        2015-06-24 12:19:19 UTC (rev 185906)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> use strict;
</span><span class="cx"> use Hasher;
</span><span class="cx"> 
</span><del>-sub GenerateStrings($)
</del><ins>+sub GenerateStringData($)
</ins><span class="cx"> {
</span><span class="cx">     my $stringsRef = shift;
</span><span class="cx">     my %strings = %$stringsRef;
</span><span class="lines">@@ -37,20 +37,34 @@
</span><span class="cx">         push(@result, &quot;static const LChar ${name}String8[] = \&quot;$strings{$name}\&quot;;\n&quot;);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    return join &quot;&quot;, @result;
+}
+
+sub GenerateASCIILiteral($$)
+{
+    my $name = shift;
+    my $value = shift;
+
+    my $length = length($value);
+    my $hash = Hasher::GenerateHashValue($value);
+    return &quot;{ StaticASCIILiteral::s_initialRefCount, $length, ${name}String8, StaticASCIILiteral::s_initialFlags | (${hash} &lt;&lt; StaticASCIILiteral::s_hashShift) }&quot;;
+}
+
+sub GenerateStrings($)
+{
+    my $stringsRef = shift;
+    my %strings = %$stringsRef;
+
+    my @result = ();
+
+    push(@result, GenerateStringData($stringsRef));
</ins><span class="cx">     push(@result, &quot;\n&quot;);
</span><span class="cx"> 
</span><span class="cx">     for my $name (sort keys %strings) {
</span><span class="cx">         my $value = $strings{$name};
</span><del>-        my $length = length($value);
-        my $hash = Hasher::GenerateHashValue($value);
-        push(@result, &lt;&lt;END);
-static StringImpl::StaticASCIILiteral ${name}Data = {
-    StringImpl::StaticASCIILiteral::s_initialRefCount,
-    $length,
-    ${name}String8,
-    StringImpl::StaticASCIILiteral::s_initialFlags | (${hash} &lt;&lt; StringImpl::StaticASCIILiteral::s_hashShift)
-};
-END
</del><ins>+        push(@result, &quot;static StaticASCIILiteral ${name}Data = &quot;);
+        push(@result, GenerateASCIILiteral($name, $strings{$name}));
+        push(@result, &quot;;\n&quot;);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     push(@result, &quot;\n&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoredommake_namespl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/make_names.pl (185905 => 185906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/make_names.pl        2015-06-24 09:25:06 UTC (rev 185905)
+++ trunk/Source/WebCore/dom/make_names.pl        2015-06-24 12:19:19 UTC (rev 185906)
</span><span class="lines">@@ -573,11 +573,13 @@
</span><span class="cx">     print F &quot;#endif\n\n&quot;;
</span><span class="cx"> 
</span><span class="cx">     print F &quot;#include \&quot;${namespace}Names.h\&quot;\n\n&quot;;
</span><del>-    print F &quot;#include &lt;wtf/StaticConstructors.h&gt;\n&quot;;
</del><ins>+    print F &quot;#include &lt;array&gt;\n&quot;;
+    print F &quot;#include &lt;wtf/StaticConstructors.h&gt;\n\n&quot;;
</ins><span class="cx"> 
</span><span class="cx">     print F &quot;namespace WebCore {\n\n&quot;;
</span><span class="cx">     print F &quot;namespace ${namespace}Names {\n\n&quot;;
</span><del>-    print F &quot;using namespace $usedNamespace;\n\n&quot;;
</del><ins>+    print F &quot;using namespace $usedNamespace;\n&quot;;
+    print F &quot;using StaticASCIILiteral = StringImpl::StaticASCIILiteral;\n\n&quot;;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub printInit
</span><span class="lines">@@ -598,8 +600,6 @@
</span><span class="cx">         return;
</span><span class="cx">     initialized = true;
</span><span class="cx"> 
</span><del>-    // Use placement new to initialize the globals.
-
</del><span class="cx">     AtomicString::init();
</span><span class="cx"> &quot;;
</span><span class="cx"> }
</span><span class="lines">@@ -762,37 +762,15 @@
</span><span class="cx"> 
</span><span class="cx">     print F &quot;WEBCORE_EXPORT DEFINE_GLOBAL(AtomicString, ${lowercaseNamespacePrefix}NamespaceURI)\n\n&quot;;
</span><span class="cx"> 
</span><del>-    print F StaticString::GenerateStrings(\%allStrings);
</del><ins>+    print F StaticString::GenerateStringData(\%allStrings);
+    print F &quot;\n&quot;;
</ins><span class="cx"> 
</span><span class="cx">     if (keys %allTags) {
</span><del>-        print F &quot;// Tags\n&quot;;
-        for my $name (sort keys %allTags) {
-            print F &quot;WEBCORE_EXPORT DEFINE_GLOBAL($parameters{namespace}QualifiedName, &quot;, $name, &quot;Tag)\n&quot;;
-        }
-        
-        print F &quot;\n\nconst WebCore::$parameters{namespace}QualifiedName* const* get$parameters{namespace}Tags()\n&quot;;
-        print F &quot;{\n    static const WebCore::$parameters{namespace}QualifiedName* const $parameters{namespace}Tags[] = {\n&quot;;
-        for my $name (sort keys %allTags) {
-            print F &quot;        reinterpret_cast&lt;const WebCore::$parameters{namespace}QualifiedName*&gt;(&amp;${name}Tag),\n&quot;;
-        }
-        print F &quot;    };\n&quot;;
-        print F &quot;    return $parameters{namespace}Tags;\n&quot;;
-        print F &quot;}\n&quot;;
</del><ins>+        printStaticData($F, \%allTags, &quot;Tag&quot;, $parameters{namespace}, &quot;$parameters{namespace}QualifiedName&quot;);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (keys %allAttrs) {
</span><del>-        print F &quot;\n// Attributes\n&quot;;
-        for my $name (sort keys %allAttrs) {
-            print F &quot;WEBCORE_EXPORT DEFINE_GLOBAL(QualifiedName, &quot;, $name, &quot;Attr)\n&quot;;
-        }
-        print F &quot;\n\nconst WebCore::QualifiedName* const* get$parameters{namespace}Attrs()\n&quot;;
-        print F &quot;{\n    static const WebCore::QualifiedName* const $parameters{namespace}Attrs[] = {\n&quot;;
-        for my $name (sort keys %allAttrs) {
-            print F &quot;        reinterpret_cast&lt;const WebCore::QualifiedName*&gt;(&amp;${name}Attr),\n&quot;;
-        }
-        print F &quot;    };\n&quot;;
-        print F &quot;    return $parameters{namespace}Attrs;\n&quot;;
-        print F &quot;}\n&quot;;
</del><ins>+        printStaticData($F, \%allAttrs, &quot;Attr&quot;, $parameters{namespace}, &quot;QualifiedName&quot;);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     printInit($F, 0);
</span><span class="lines">@@ -801,16 +779,15 @@
</span><span class="cx"> 
</span><span class="cx">     print(F &quot;    // Namespace\n&quot;);
</span><span class="cx">     print(F &quot;    new (NotNull, (void*)&amp;${lowercaseNamespacePrefix}NamespaceURI) AtomicString(${lowercaseNamespacePrefix}NS);\n&quot;);
</span><del>-    print(F &quot;\n&quot;);
-    print F StaticString::GenerateStringAsserts(\%allStrings);
</del><span class="cx"> 
</span><span class="cx">     if (keys %allTags) {
</span><span class="cx">         my $tagsNamespace = $parameters{tagsNullNamespace} ? &quot;nullAtom&quot; : &quot;${lowercaseNamespacePrefix}NS&quot;;
</span><del>-        printDefinitions($F, \%allTags, &quot;tags&quot;, $tagsNamespace);
</del><ins>+        printQualifiedNameCreation($F, &quot;Tags&quot;, $parameters{namespace}, &quot;$parameters{namespace}QualifiedName&quot;, $tagsNamespace);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     if (keys %allAttrs) {
</span><span class="cx">         my $attrsNamespace = $parameters{attrsNullNamespace} ? &quot;nullAtom&quot; : &quot;${lowercaseNamespacePrefix}NS&quot;;
</span><del>-        printDefinitions($F, \%allAttrs, &quot;attributes&quot;, $attrsNamespace);
</del><ins>+        printQualifiedNameCreation($F, &quot;Attrs&quot;, $parameters{namespace}, &quot;QualifiedName&quot;, $attrsNamespace);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     print F &quot;}\n\n} }\n\n&quot;;
</span><span class="lines">@@ -893,38 +870,56 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-sub printDefinitions
</del><ins>+sub printStaticData
</ins><span class="cx"> {
</span><del>-    my ($F, $namesRef, $type, $namespaceURI) = @_;
</del><ins>+    my ($F, $namesRef, $type, $namespace, $qualifiedNameType) = @_;
</ins><span class="cx"> 
</span><del>-    my $shortCamelType = ucfirst(substr(substr($type, 0, -1), 0, 4));
-    my $capitalizedType = ucfirst($type);
-    
-print F &lt;&lt;END
</del><ins>+    my $nameCount = scalar(keys %$namesRef);
</ins><span class="cx"> 
</span><del>-    struct ${capitalizedType}TableEntry {
-        void* targetAddress;
-        StringImpl&amp; name;
-    };
</del><ins>+    print F &quot;// $type\n&quot;;
+    for my $name (sort keys %$namesRef) {
+        print F &quot;WEBCORE_EXPORT DEFINE_GLOBAL($qualifiedNameType, ${name}${type})\n&quot;;
+    }
</ins><span class="cx"> 
</span><del>-    static const ${capitalizedType}TableEntry ${type}Table[] = {
-END
-;
</del><ins>+    print F &quot;\n&quot;;
+    print F &quot;static const std::array&lt;const $qualifiedNameType*, $nameCount&gt; ${namespace}${type}s = { {\n&quot;;
</ins><span class="cx">     for my $name (sort keys %$namesRef) {
</span><del>-        print F &quot;        { (void*)&amp;$name$shortCamelType, *reinterpret_cast&lt;StringImpl*&gt;(&amp;${name}Data) },\n&quot;;
</del><ins>+        print F &quot;    reinterpret_cast&lt;const $qualifiedNameType*&gt;(&amp;${name}${type}),\n&quot;;
</ins><span class="cx">     }
</span><ins>+    print F &quot;} };\n\n&quot;;
</ins><span class="cx"> 
</span><del>-print F &lt;&lt;END
-    };
</del><ins>+    print F &quot;static const std::array&lt;StaticASCIILiteral, $nameCount&gt; ${namespace}${type}sLiterals = { {\n&quot;;
+    for my $name (sort keys %$namesRef) {
+        print F &quot;    &quot;, StaticString::GenerateASCIILiteral($name, valueForName($name)), &quot;,\n&quot;;
+    }
+    print F &quot;} };\n\n&quot;;
</ins><span class="cx"> 
</span><del>-    for (unsigned i = 0; i &lt; WTF_ARRAY_LENGTH(${type}Table); ++i)
-END
-;
</del><ins>+    print F &quot;const $qualifiedNameType* const* get${namespace}${type}s()\n&quot;;
+    print F &quot;{\n&quot;;
+    print F &quot;    return ${namespace}${type}s.data();\n&quot;;
+    print F &quot;}\n&quot;;
+}
+
+sub printQualifiedNameCreation
+{
+    my ($F, $type, $namespace, $qualifiedNameType, $namespaceURI) = @_;
+
+    print F &quot;\n&quot;;
+    print F &quot;    static_assert(${namespace}${type}.size() == ${namespace}${type}Literals.size(), \&quot;Arrays match in size\&quot;);\n&quot;;
+    print F &quot;    for (size_t i = 0; i &lt; ${namespace}${type}.size(); ++i) {\n&quot;;
+    print F &quot;#ifndef NDEBUG\n&quot;;
+    print F &quot;        reinterpret_cast&lt;const StringImpl&amp;&gt;(${namespace}${type}Literals[i]).assertHashIsCorrect();\n&quot;;
+    print F &quot;#endif\n&quot;;
+
</ins><span class="cx">     if ($namespaceURI eq &quot;nullAtom&quot;) {
</span><del>-        print F &quot;        createQualifiedName(${type}Table[i].targetAddress, &amp;${type}Table[i].name);\n&quot;;
</del><ins>+        print F &quot;        createQualifiedName(reinterpret_cast&lt;void*&gt;(const_cast&lt;$qualifiedNameType*&gt;(${namespace}${type}\[i\])),\n&quot;;
+        print F &quot;            reinterpret_cast&lt;StringImpl*&gt;(const_cast&lt;StaticASCIILiteral*&gt;(&amp;${namespace}${type}Literals\[i\])));\n&quot;;
</ins><span class="cx">     } else {
</span><del>-        print F &quot;        createQualifiedName(${type}Table[i].targetAddress, &amp;${type}Table[i].name, $namespaceURI);\n&quot;;
</del><ins>+        print F &quot;        createQualifiedName(reinterpret_cast&lt;void*&gt;(const_cast&lt;$qualifiedNameType*&gt;(${namespace}${type}\[i\])),\n&quot;;
+        print F &quot;            reinterpret_cast&lt;StringImpl*&gt;(const_cast&lt;StaticASCIILiteral*&gt;(&amp;${namespace}${type}Literals\[i\])), $namespaceURI);\n&quot;;
</ins><span class="cx">     }
</span><ins>+
+    print F &quot;    }\n&quot;;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ## ElementFactory routines
</span></span></pre>
</div>
</div>

</body>
</html>