Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
KDevelop
KDevelop
Commits
6d5536da
Commit
6d5536da
authored
Nov 18, 2021
by
Pedro Olsen Ferreira
Browse files
Recognise the Half CXType
This occurs for OpenCL's "half" type. Use the Float Integral type internally.
parent
4f341479
Changes
7
Hide whitespace changes
Inline
Side-by-side
kdevplatform/language/duchain/types/constantintegraltype.cpp
View file @
6d5536da
...
...
@@ -84,6 +84,9 @@ QString ConstantIntegralType::toString() const
case
TypeInt
:
ret
=
(
modifiers
()
&
UnsignedModifier
)
?
QStringLiteral
(
"unsigned"
)
:
QStringLiteral
(
"int"
);
break
;
case
TypeHalf
:
ret
=
QStringLiteral
(
"half"
);
break
;
case
TypeFloat
:
ret
=
QStringLiteral
(
"float"
);
break
;
...
...
@@ -120,6 +123,7 @@ QString ConstantIntegralType::valueAsString() const
return
(
modifiers
()
&
UnsignedModifier
)
?
QString
::
number
((
uint
)
d_func
()
->
m_value
)
:
QString
::
number
((
int
)
d_func
()
->
m_value
);
case
TypeHalf
:
case
TypeFloat
:
return
QString
::
number
(
value
<
float
>
());
case
TypeDouble
:
...
...
kdevplatform/language/duchain/types/constantintegraltype.h
View file @
6d5536da
...
...
@@ -44,6 +44,8 @@ public:
{
if
(
AbstractType
::
modifiers
()
&
UnsignedModifier
)
setValueInternal
<
quint64
>
(
value
);
else
if
(
IntegralType
::
dataType
()
==
TypeHalf
)
setValueInternal
<
float
>
(
value
);
else
if
(
IntegralType
::
dataType
()
==
TypeFloat
)
setValueInternal
<
float
>
(
value
);
else
if
(
IntegralType
::
dataType
()
==
TypeDouble
)
...
...
@@ -62,6 +64,8 @@ public:
{
if
(
modifiers
()
&
UnsignedModifier
)
{
return
constant_value
<
quint64
>
(
&
d_func
()
->
m_value
);
}
else
if
(
dataType
()
==
TypeHalf
)
{
return
constant_value
<
float
>
(
&
d_func
()
->
m_value
);
}
else
if
(
dataType
()
==
TypeFloat
)
{
return
constant_value
<
float
>
(
&
d_func
()
->
m_value
);
}
else
if
(
dataType
()
==
TypeDouble
)
{
...
...
kdevplatform/language/duchain/types/integraltype.h
View file @
6d5536da
...
...
@@ -49,6 +49,7 @@ public:
TypeMixed
,
TypeChar16_t
,
TypeChar32_t
,
TypeHalf
,
TypeLanguageSpecific
=
200
};
...
...
plugins/clang/duchain/builder.cpp
View file @
6d5536da
...
...
@@ -1348,6 +1348,7 @@ AbstractType *Visitor::makeType(CXType type, CXCursor parent)
UseKind
(
CXType_ULong
);
UseKind
(
CXType_LongLong
);
UseKind
(
CXType_ULongLong
);
UseKind
(
CXType_Half
);
UseKind
(
CXType_Float
);
UseKind
(
CXType_LongDouble
);
UseKind
(
CXType_Double
);
...
...
plugins/clang/duchain/cursorkindtraits.h
View file @
6d5536da
...
...
@@ -191,6 +191,7 @@ constexpr IntegralType::CommonIntegralTypes integralType(CXTypeKind TK)
{
return
TK
==
CXType_Void
?
IntegralType
::
TypeVoid
:
TK
==
CXType_Bool
?
IntegralType
::
TypeBoolean
:
TK
==
CXType_Half
?
IntegralType
::
TypeHalf
:
TK
==
CXType_Float
?
IntegralType
::
TypeFloat
:
TK
==
CXType_Char16
?
IntegralType
::
TypeChar16_t
:
TK
==
CXType_Char32
?
IntegralType
::
TypeChar32_t
...
...
plugins/qmljs/duchain/declarationbuilder.cpp
View file @
6d5536da
...
...
@@ -1349,6 +1349,8 @@ AbstractType::Ptr DeclarationBuilder::typeFromName(const QString& name)
type
=
IntegralType
::
TypeBoolean
;
}
else
if
(
name
==
QLatin1String
(
"int"
))
{
type
=
IntegralType
::
TypeInt
;
}
else
if
(
name
==
QLatin1String
(
"half"
))
{
type
=
IntegralType
::
TypeHalf
;
}
else
if
(
name
==
QLatin1String
(
"float"
))
{
type
=
IntegralType
::
TypeFloat
;
}
else
if
(
name
==
QLatin1String
(
"double"
)
||
name
==
QLatin1String
(
"real"
))
{
...
...
@@ -1465,6 +1467,7 @@ static bool isNumeric(const IntegralType::Ptr& type)
{
return
type
->
dataType
()
==
IntegralType
::
TypeInt
||
type
->
dataType
()
==
IntegralType
::
TypeIntegral
||
type
->
dataType
()
==
IntegralType
::
TypeHalf
||
type
->
dataType
()
==
IntegralType
::
TypeFloat
||
type
->
dataType
()
==
IntegralType
::
TypeDouble
;
}
...
...
plugins/qmljs/duchain/helper.cpp
View file @
6d5536da
...
...
@@ -209,6 +209,7 @@ DUContext* getInternalContext(const DeclarationPointer& declaration)
baseClass
=
QStringLiteral
(
"String"
);
break
;
case
IntegralType
::
TypeInt
:
case
IntegralType
::
TypeHalf
:
case
IntegralType
::
TypeFloat
:
case
IntegralType
::
TypeDouble
:
baseClass
=
QStringLiteral
(
"Number"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment