<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Inconsistencies between BuiltinType::getName and CGDebugInfo::CreateType"
   href="https://bugs.llvm.org/show_bug.cgi?id=35513">35513</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Inconsistencies between BuiltinType::getName and CGDebugInfo::CreateType
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>gebhard@absint.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19514" name="attach_19514" title="Example source code">attachment 19514</a> <a href="attachment.cgi?id=19514&action=edit" title="Example source code">[details]</a></span>
Example source code

I have noticed a minor inconsistency between how BuildinType are printing
opposing to what is exported in DWARF debug info.
This appears to affect long integer types only.

In "StringRef BuiltinType::getName(const PrintingPolicy &Policy) const",
Type.cpp:2580ff (<a href="https://clang.llvm.org/doxygen/Type_8cpp_source.html">https://clang.llvm.org/doxygen/Type_8cpp_source.html</a>), long
integer types are printed as:

   ...
   case Long:
     return "long";
   case LongLong:
     return "long long";
   ...
   case ULong:
     return "unsigned long";
   case ULongLong:
     return "unsigned long long";
   ...

where is in the DWARF debug info emitter, i.e., "llvm::DIType
CGDebugInfo::CreateType(const BuiltinType *BT)", CGDebugInfo.cpp:686ff (see
<a href="https://clang.llvm.org/doxygen/CGDebugInfo_8cpp_source.html">https://clang.llvm.org/doxygen/CGDebugInfo_8cpp_source.html</a>), long integer
types are exported as:

   ...
   case BuiltinType::Long:
     BTName = "long int";
     break;
   case BuiltinType::LongLong:
     BTName = "long long int";
     break;
   case BuiltinType::ULong:
     BTName = "long unsigned int";
     break;
   case BuiltinType::ULongLong:
     BTName = "long long unsigned int";
     break;
   ...


This leads to problems when mapping class types printed via (Class is of type
'const clang::CXXRecordDecl *'):

Class->getNameForDiagnostic(out, clang::PrintingPolicy(clang::LangOptions()),
true);

and mapping that to the information we get from DWARF debug info as we can see
in the attached example.

Here, clang will print the pointer type of "ptr" as "Container<long>" whereas
in the debug info we get "Container<long int>".
Without additional post-processing to map DWARF debug information to the way
clang print types it is not possible to map both type names to each other.


Is it possible to unify this behavior to make clang in itself consistent?
Or is there some other way to achieve that behavior?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>