Commit 2473dcb4 authored by ussrhero's avatar ussrhero

added an implementation for typedef

parent 803c85d0
......@@ -413,6 +413,20 @@ public:
return false;
}
bool VisitTypedefDecl(TypedefDecl *Declaration)
{
std::string& name = Declaration->getQualifiedNameAsString();
if ( name != m_typeName)
return true;
QualType decl = Declaration->getUnderlyingType().getCanonicalType();
m_typeInfo = getTypeForClangType(m_session, decl);
return false;
}
bool VisitFunctionDecl(FunctionDecl *Declaration)
{
std::string& name = Declaration->getQualifiedNameAsString();
......
......@@ -340,9 +340,11 @@ static const wchar_t test_typedef_src[] = L"\
typedef int int_def; \
\
typedef struct _Test { \
int field; \
int field1; \
int_def field2; \
} TestDef; \
\
typedef TestDef TEST; \
";
TEST_F(ClangTest, Typedef)
......@@ -362,5 +364,6 @@ TEST_F(ClangTest, Typedef)
ASSERT_EQ(L"Int4B", structType->getElement(L"field1")->getName() );
ASSERT_EQ(L"Int4B", structType->getElement(L"field2")->getName() );
ASSERT_EQ(L"_Test", typeProvider->getTypeByName(L"TEST")->getName() );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment