Commit ce122a05 authored by ussrhero's avatar ussrhero

added clang type enumerator

parent 1f251395
This diff is collapsed.
......@@ -15,6 +15,7 @@ namespace kdlib {
class ClangASTSession;
typedef boost::shared_ptr<ClangASTSession> ClangASTSessionPtr;
class TypeInfoProviderClang;
class ClangASTSession : public boost::enable_shared_from_this<ClangASTSession>
......@@ -25,7 +26,7 @@ public:
return ClangASTSessionPtr( new ClangASTSession(astUnit) );
}
TypeInfoPtr getTypeInfo(const std::wstring& name);
//TypeInfoPtr getTypeInfo(const std::wstring& name);
clang::ASTContext& getASTContext() {
return m_astUnit->getASTContext();
......@@ -308,24 +309,25 @@ protected:
class TypeInfoProviderClangEnum : public TypeInfoEnumerator{
public:
virtual TypeInfoPtr Next();
TypeInfoProviderClangEnum(const std::wstring& mask, ClangASTSessionPtr ast) :
m_mask(wstrToStr(mask)),
m_astSession(ast),
m_pos(0)
{}
TypeInfoProviderClangEnum(const std::wstring& mask, boost::shared_ptr<TypeInfoProviderClang>& clangProvider );
private:
std::string m_mask;
ClangASTSessionPtr m_astSession;
size_t m_pos;
size_t m_index;
std::vector<TypeInfoPtr> m_typeList;
};
class TypeInfoProviderClang : public TypeInfoProvider
class TypeInfoProviderClang : public TypeInfoProvider, public boost::enable_shared_from_this<TypeInfoProviderClang>
{
friend TypeInfoProviderClangEnum;
public:
TypeInfoProviderClang( const std::wstring& sourceCode, const std::wstring& compileOptions);
......@@ -340,6 +342,8 @@ private:
ClangASTSessionPtr m_astSession;
std::map< std::string, TypeInfoPtr> m_typeCache;
};
......
......@@ -384,7 +384,7 @@ TEST_F(ClangTest, TypeProviderEnum)
ASSERT_NO_THROW( typeEnum = typeProvider->getTypeEnumerator(L"struct*") );
for ( count = 0; 0 != typeEnum->Next(); ++count);
EXPECT_EQ(8, count);
EXPECT_EQ(13, count);
}
......
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