Commit 9b4175e2 authored by Pedro Olsen Ferreira's avatar Pedro Olsen Ferreira
Browse files

Add OpenCL types

This makes KDevelop recognise the Clang OpenCL type enums.
These aren't defined in the language, so they are left as opaque
structure types.
parent 6d5536da
......@@ -514,6 +514,12 @@ struct Visitor
return new IntegralType(CursorKindTraits::integralType(TK));
}
template <CXTypeKind TK, EnableIf<CursorKindTraits::isOpenCLType(TK)> = dummy>
AbstractType* createType(CXType, CXCursor)
{
return new StructureType();
}
template <CXTypeKind TK, EnableIf<TK == CXType_Atomic> = dummy>
AbstractType* createType(CXType type, CXCursor parent)
{
......@@ -1395,6 +1401,46 @@ AbstractType *Visitor::makeType(CXType type, CXCursor parent)
#endif
UseKind(CXType_Atomic);
UseKind(CXType_Complex);
UseKind(CXType_OCLImage1dRO);
UseKind(CXType_OCLImage1dArrayRO);
UseKind(CXType_OCLImage1dBufferRO);
UseKind(CXType_OCLImage2dRO);
UseKind(CXType_OCLImage2dArrayRO);
UseKind(CXType_OCLImage2dDepthRO);
UseKind(CXType_OCLImage2dArrayDepthRO);
UseKind(CXType_OCLImage2dMSAARO);
UseKind(CXType_OCLImage2dArrayMSAARO);
UseKind(CXType_OCLImage2dMSAADepthRO);
UseKind(CXType_OCLImage2dArrayMSAADepthRO);
UseKind(CXType_OCLImage3dRO);
UseKind(CXType_OCLImage1dWO);
UseKind(CXType_OCLImage1dArrayWO);
UseKind(CXType_OCLImage1dBufferWO);
UseKind(CXType_OCLImage2dWO);
UseKind(CXType_OCLImage2dArrayWO);
UseKind(CXType_OCLImage2dDepthWO);
UseKind(CXType_OCLImage2dArrayDepthWO);
UseKind(CXType_OCLImage2dMSAAWO);
UseKind(CXType_OCLImage2dArrayMSAAWO);
UseKind(CXType_OCLImage2dMSAADepthWO);
UseKind(CXType_OCLImage2dArrayMSAADepthWO);
UseKind(CXType_OCLImage3dWO);
UseKind(CXType_OCLImage1dRW);
UseKind(CXType_OCLImage1dArrayRW);
UseKind(CXType_OCLImage1dBufferRW);
UseKind(CXType_OCLImage2dRW);
UseKind(CXType_OCLImage2dArrayRW);
UseKind(CXType_OCLImage2dDepthRW);
UseKind(CXType_OCLImage2dArrayDepthRW);
UseKind(CXType_OCLImage2dMSAARW);
UseKind(CXType_OCLImage2dArrayMSAARW);
UseKind(CXType_OCLImage2dMSAADepthRW);
UseKind(CXType_OCLImage2dArrayMSAADepthRW);
UseKind(CXType_OCLImage3dRW);
UseKind(CXType_OCLSampler);
UseKind(CXType_OCLEvent);
UseKind(CXType_OCLQueue);
UseKind(CXType_OCLReserveID);
case CXType_Invalid:
return nullptr;
default:
......
......@@ -233,6 +233,51 @@ constexpr bool isPointerType(CXTypeKind TK)
|| TK == CXType_ObjCObjectPointer;
}
constexpr bool isOpenCLType(CXTypeKind CK)
{
return (CK == CXType_OCLImage1dRO ||
CK == CXType_OCLImage1dArrayRO ||
CK == CXType_OCLImage1dBufferRO ||
CK == CXType_OCLImage2dRO ||
CK == CXType_OCLImage2dArrayRO ||
CK == CXType_OCLImage2dDepthRO ||
CK == CXType_OCLImage2dArrayDepthRO ||
CK == CXType_OCLImage2dMSAARO ||
CK == CXType_OCLImage2dArrayMSAARO ||
CK == CXType_OCLImage2dMSAADepthRO ||
CK == CXType_OCLImage2dArrayMSAADepthRO ||
CK == CXType_OCLImage3dRO ||
CK == CXType_OCLImage1dWO ||
CK == CXType_OCLImage1dArrayWO ||
CK == CXType_OCLImage1dBufferWO ||
CK == CXType_OCLImage2dWO ||
CK == CXType_OCLImage2dArrayWO ||
CK == CXType_OCLImage2dDepthWO ||
CK == CXType_OCLImage2dArrayDepthWO ||
CK == CXType_OCLImage2dMSAAWO ||
CK == CXType_OCLImage2dArrayMSAAWO ||
CK == CXType_OCLImage2dMSAADepthWO ||
CK == CXType_OCLImage2dArrayMSAADepthWO ||
CK == CXType_OCLImage3dWO ||
CK == CXType_OCLImage1dRW ||
CK == CXType_OCLImage1dArrayRW ||
CK == CXType_OCLImage1dBufferRW ||
CK == CXType_OCLImage2dRW ||
CK == CXType_OCLImage2dArrayRW ||
CK == CXType_OCLImage2dDepthRW ||
CK == CXType_OCLImage2dArrayDepthRW ||
CK == CXType_OCLImage2dMSAARW ||
CK == CXType_OCLImage2dArrayMSAARW ||
CK == CXType_OCLImage2dMSAADepthRW ||
CK == CXType_OCLImage2dArrayMSAADepthRW ||
CK == CXType_OCLImage3dRW ||
CK == CXType_OCLSampler ||
CK == CXType_OCLEvent ||
CK == CXType_OCLQueue ||
CK == CXType_OCLReserveID);
}
constexpr bool isAliasType(CXCursorKind CK)
{
return CK == CXCursor_TypedefDecl || CK == CXCursor_TypeAliasDecl;
......
Supports Markdown
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