How to get original parameter type and not an expanded typedef

Abierto
#50 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
cpp, csharp

Línea de trabajo

Empieza examinando cómo las opciones del parser, especialmente AutoSquashTypedef, afectan a los tipos de los parámetros, y compara la salida de la biblioteca con la interfaz C de Clang y el comportamiento de los tipos canónicos. El cambio tendría que conservar la escritura original del typedef y los argumentos de plantilla para los tres parámetros de método de ejemplo, manteniendo al mismo tiempo el acceso a sus tipos expandidos.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

question

Let's say I have the following code

template<class T>
class MyTemplateClass
{
    ....
};

typedef unsigned int MyInt;
typedef ::MyTemplateClass<char> MyCharClass;
typedef ::MyTemplateClass<::MyInt> MyMyIntClass;

class MyTestClass
{
    void TestMethod1(::MyInt param);
    void TestMethod2(::MyCharClass& param);
    void TestMethod3(::MyMyIntClass& param);
};

When I parse this, I get the following parameter information for the methods:
TestMethod1 -> param type is unsigned int
TestMethod2 -> param type is MyTemplateClass (wihtout the template arguments!)
TestMethod3 -> param type is MyTemplateClass (wihtout the template arguments!)

When I look at the C interface of clang, it seems that this is solved by using the canonical types, where the original (non-expanded type) is the actual type and holds a pointer to the underlying expanded type (not tested as I am writing C# code using this library).
However using this library, I am not able to get the original type as it is declared in the method signature.

I would like to know the original parameter type as it is written in the code and not the already expanded typedef. My parse configuration is as follows:

new CppParserOptions
{
    AutoSquashTypedef = false,
    ParseAsCpp = true,
    ParseAttributes = false,
    ParseComments = false,
    ParseMacros = true,
    ParseSystemIncludes = false,
    TargetCpu = CppTargetCpu.X86,
    TargetSystem = @"windows",
    TargetVendor = @"pc"
};
Lenguaje dominante
C#
Estrellas
625
Forks
79
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de xoofx/CppAst.NET

Todos los issues de xoofx/CppAst.NET

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.