[llvm-bugs] [Bug 35513] New: Inconsistencies between BuiltinType::getName and CGDebugInfo::CreateType

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 4 01:28:51 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35513

            Bug ID: 35513
           Summary: Inconsistencies between BuiltinType::getName and
                    CGDebugInfo::CreateType
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gebhard at absint.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19514
  --> https://bugs.llvm.org/attachment.cgi?id=19514&action=edit
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 (https://clang.llvm.org/doxygen/Type_8cpp_source.html), 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
https://clang.llvm.org/doxygen/CGDebugInfo_8cpp_source.html), 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?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171204/45a85dd9/attachment.html>


More information about the llvm-bugs mailing list