www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22033] New: importC: Add C++ helper function to return Type

https://issues.dlang.org/show_bug.cgi?id=22033

          Issue ID: 22033
           Summary: importC: Add C++ helper function to return Type for
                    given Identifier or string
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

For example, GCC provides the "C" wchar_t type as a macro, which could be
defined as "int", or "short unsigned int", or "long int", or "long unsigned
int", etc...

As DMD now has the ability to parse C types, it would be great to expose this
from CParser to convert these strings to get D Types.

e.g:
---
Type *ctype = CParser::getType("short unsigned int");
assert(ctype->ty == TY::Tuns16);

--
Jun 17 2021