-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to improve literal types #998
Changes from all commits
2b2af14
61982a1
4432e1f
4b57f76
1f4e2a3
97acf5f
aee91cd
6130c91
98352a8
1de6bbe
17012c0
9feae1b
03fbcec
1a1e25b
2dc1126
ac042f9
69075f1
3a593d0
d3740e4
2e6b9d0
2a8655e
df2617d
6816d9a
f7b3caa
c74882d
fd45301
0413ab7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,11 +379,10 @@ namespace clad { | |
// FIXME: Consolidate other uses of synthesizeLiteral for creation 0 or 1. | ||
if (T->isVoidType()) | ||
return nullptr; | ||
if (T->isScalarType()) { | ||
if ((T->isScalarType() || T->isPointerType()) && !T->isReferenceType()) { | ||
ExprResult Zero = | ||
ConstantFolder::synthesizeLiteral(m_Context.IntTy, m_Context, 0); | ||
CastKind CK = m_Sema.PrepareScalarCast(Zero, T); | ||
return m_Sema.ImpCastExprToType(Zero.get(), T, CK).get(); | ||
ConstantFolder::synthesizeLiteral(T, m_Context, /*val=*/0); | ||
return Zero.get(); | ||
} | ||
vgvassilev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return m_Sema.ActOnInitList(noLoc, {}, noLoc).get(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably sink There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it makes sense to be in |
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should extend visitorbase::getZeroInit as discussed here #989 (comment)
cc: @gojakuch