-
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
Don't consider arrays as a special case in DifferentiateVarDecl #1164
Changes from all commits
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 |
---|---|---|
|
@@ -410,12 +410,13 @@ namespace clad { | |
|
||
Expr* VisitorBase::getZeroInit(QualType T) { | ||
// FIXME: Consolidate other uses of synthesizeLiteral for creation 0 or 1. | ||
if (T->isVoidType()) | ||
if (T->isVoidType() || isa<VariableArrayType>(T)) | ||
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. warning: no header providing "clang::VariableArrayType" is directly included [misc-include-cleaner] lib/Differentiator/VisitorBase.cpp:28: - #include <numeric>
+ #include <clang/AST/Type.h>
+ #include <numeric> |
||
return nullptr; | ||
if ((T->isScalarType() || T->isPointerType()) && !T->isReferenceType()) { | ||
ExprResult Zero = | ||
ConstantFolder::synthesizeLiteral(T, m_Context, /*val=*/0); | ||
return Zero.get(); | ||
if ((T->isScalarType() || T->isPointerType()) && !T->isReferenceType()) | ||
return ConstantFolder::synthesizeLiteral(T, m_Context, /*val=*/0); | ||
if (isa<ConstantArrayType>(T)) { | ||
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. warning: no header providing "clang::ConstantArrayType" is directly included [misc-include-cleaner] if (isa<ConstantArrayType>(T)) {
^ |
||
Expr* zero = ConstantFolder::synthesizeLiteral(T, m_Context, /*val=*/0); | ||
return m_Sema.ActOnInitList(noLoc, {zero}, noLoc).get(); | ||
} | ||
return m_Sema.ActOnInitList(noLoc, {}, noLoc).get(); | ||
} | ||
|
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.
warning: no header providing "clang::dyn_cast" is directly included [misc-include-cleaner]