Commit 979eb57e authored by SND\ussrhero_cp's avatar SND\ussrhero_cp Committed by Mikhail I. Izmestev
Browse files

fixed print struct with function pointers

git-svn-id: https://kdlibcpp.svn.codeplex.com/svn@91180 9b283d60-5439-405e-af05-b73fd8c4d996
parent e08ba907
......@@ -103,6 +103,11 @@ TypeInfoPtr getTypeForClangType( ClangASTSessionPtr& astSession, const clang::Q
NOT_IMPLEMENTED();
}
if ( qualType->isFunctionType() )
{
return TypeInfoPtr( new TypeInfoClangFunc() );
}
throw TypeException(L"can not parse code");
}
......
......@@ -158,7 +158,23 @@ protected:
clang::ReferenceType* m_refType;
};
class TypeInfoClangFunc : public TypeInfoImp
{
protected:
virtual bool isFunction() {
return true;
}
virtual std::wstring getName() {
return L"function";
}
virtual std::wstring str() {
return L"function";
}
};
class TypeInfoProviderClang : public TypeInfoProvider
{
......
......@@ -219,20 +219,21 @@ TEST_F(ClangTest, Include)
TEST_F(ClangTest, WindowsH)
{
std::wstring src = L"#include <windef.h>\r\n";
std::wstring typeName = L"tagPOINT";
std::wstring src = L"#include <windows.h>\r\n";
std::wstring opt = L"-I\"C:/Program Files (x86)/Windows Kits/8.1/Include/um\" \
-I\"C:/Program Files (x86)/Windows Kits/8.1/Include/shared\" -Wno-missing-declarations -Wno-invalid-token-paste";
-I\"C:/Program Files (x86)/Windows Kits/8.1/Include/shared\" -w";
TypeInfoProviderPtr typeProvider;
ASSERT_NO_THROW( typeProvider = getTypeInfoProviderFromSource(src, opt) );
TypeInfoPtr type1;
ASSERT_NO_THROW( type1 = typeProvider->getTypeByName(typeName) );
for ( auto typeName : {L"tagPOINT", L"tagWNDCLASSA"} )
{
TypeInfoPtr type1;
ASSERT_NO_THROW( type1 = typeProvider->getTypeByName(typeName) );
std::wstring desc;
EXPECT_NO_THROW( desc = type1->str() );
std::wstring desc;
EXPECT_NO_THROW( desc = type1->str() );
}
}
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