-
Notifications
You must be signed in to change notification settings - Fork 122
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
Introduce type cloning. #651
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #651 +/- ##
==========================================
+ Coverage 94.13% 94.17% +0.03%
==========================================
Files 43 43
Lines 6312 6334 +22
==========================================
+ Hits 5942 5965 +23
+ Misses 370 369 -1
|
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.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 22. Check the log or trigger a new build to see more.
lib/Differentiator/StmtClone.cpp
Outdated
DEFINE_CLONE_EXPR(ImaginaryLiteral, (Clone(Node->getSubExpr()), Node->getType())) | ||
DEFINE_CREATE_EXPR(IntegerLiteral, (Ctx, Node->getValue(), CloneType(Node->getType()), Node->getLocation())) | ||
DEFINE_CLONE_EXPR_CO(PredefinedExpr, (CLAD_COMPAT_CLANG8_Ctx_ExtraParams Node->getLocation(), CloneType(Node->getType()), Node->getIdentKind() CLAD_COMPAT_CLANG17_IsTransparent(Node), Node->getFunctionName())) | ||
DEFINE_CLONE_EXPR(CharacterLiteral, (Node->getValue(), Node->getKind(), CloneType(Node->getType()), Node->getLocation())) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(CharacterLiteral, (Node->getValue(), Node->getKind(), CloneType(Node->getType()), Node->getLocation())) | |
DEFINE_CLONE_EXPR(auto, (Node->getValue(), Node->getKind(), CloneType(Node->getType()), Node->getLocation())) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
lib/Differentiator/StmtClone.cpp
Outdated
DEFINE_CREATE_EXPR(IntegerLiteral, (Ctx, Node->getValue(), CloneType(Node->getType()), Node->getLocation())) | ||
DEFINE_CLONE_EXPR_CO(PredefinedExpr, (CLAD_COMPAT_CLANG8_Ctx_ExtraParams Node->getLocation(), CloneType(Node->getType()), Node->getIdentKind() CLAD_COMPAT_CLANG17_IsTransparent(Node), Node->getFunctionName())) | ||
DEFINE_CLONE_EXPR(CharacterLiteral, (Node->getValue(), Node->getKind(), CloneType(Node->getType()), Node->getLocation())) | ||
DEFINE_CLONE_EXPR(ImaginaryLiteral, (Clone(Node->getSubExpr()), CloneType(Node->getType()))) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(ImaginaryLiteral, (Clone(Node->getSubExpr()), CloneType(Node->getType()))) | |
DEFINE_CLONE_EXPR(auto, (Clone(Node->getSubExpr()), CloneType(Node->getType()))) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
lib/Differentiator/StmtClone.cpp
Outdated
DEFINE_CLONE_EXPR(ParenExpr, (Node->getLParen(), Node->getRParen(), Clone(Node->getSubExpr()))) | ||
DEFINE_CLONE_EXPR(ArraySubscriptExpr, (Clone(Node->getLHS()), Clone(Node->getRHS()), Node->getType(), Node->getValueKind(), Node->getObjectKind(), Node->getRBracketLoc())) | ||
DEFINE_CLONE_EXPR(ArraySubscriptExpr, (Clone(Node->getLHS()), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind(), Node->getRBracketLoc())) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(ArraySubscriptExpr, (Clone(Node->getLHS()), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind(), Node->getRBracketLoc())) | |
DEFINE_CLONE_EXPR(auto, (Clone(Node->getLHS()), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind(), Node->getRBracketLoc())) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
lib/Differentiator/StmtClone.cpp
Outdated
DEFINE_CREATE_EXPR(CXXConstCastExpr, (Ctx, Node->getType(), Node->getValueKind(), Clone(Node->getSubExpr()), Node->getTypeInfoAsWritten(), Node->getOperatorLoc(), Node->getRParenLoc(), Node->getAngleBrackets())) | ||
DEFINE_CREATE_EXPR(CXXConstructExpr, (Ctx, Node->getType(), Node->getLocation(), Node->getConstructor(), Node->isElidable(), clad_compat::makeArrayRef(Node->getArgs(), Node->getNumArgs()), Node->hadMultipleCandidates(), Node->isListInitialization(), Node->isStdInitListInitialization(), Node->requiresZeroInitialization(), Node->getConstructionKind(), Node->getParenOrBraceRange())) | ||
DEFINE_CREATE_EXPR(CXXFunctionalCastExpr, (Ctx, Node->getType(), Node->getValueKind(), Node->getTypeInfoAsWritten(), Node->getCastKind(), Clone(Node->getSubExpr()), 0 /*EP*/CLAD_COMPAT_CLANG12_CastExpr_GetFPO(Node), Node->getLParenLoc(), Node->getRParenLoc())) | ||
DEFINE_CLONE_EXPR(CompoundLiteralExpr, (Node->getLParenLoc(), Node->getTypeSourceInfo(), CloneType(Node->getType()), Node->getValueKind(), Clone(Node->getInitializer()), Node->isFileScope())) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(CompoundLiteralExpr, (Node->getLParenLoc(), Node->getTypeSourceInfo(), CloneType(Node->getType()), Node->getValueKind(), Clone(Node->getInitializer()), Node->isFileScope())) | |
DEFINE_CLONE_EXPR(auto, (Node->getLParenLoc(), Node->getTypeSourceInfo(), CloneType(Node->getType()), Node->getValueKind(), Clone(Node->getInitializer()), Node->isFileScope())) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
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.
This should probably be ignored.
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.
Can we add a test case and address the clang-tidy issues?
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.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 12. Check the log or trigger a new build to see more.
lib/Differentiator/StmtClone.cpp
Outdated
|
||
DEFINE_CLONE_EXPR(MaterializeTemporaryExpr, (Node->getType(), CLAD_COMPAT_CLANG10_GetTemporaryExpr(Node), Node->isBoundToLvalueReference())) | ||
DEFINE_CLONE_EXPR_CO11(CompoundAssignOperator, (CLAD_COMPAT_CLANG11_Ctx_ExtraParams Clone(Node->getLHS()), Clone(Node->getRHS()), Node->getOpcode(), Node->getType(), | ||
DEFINE_CLONE_EXPR(MaterializeTemporaryExpr, (CloneType(Node->getType()), CLAD_COMPAT_CLANG10_GetTemporaryExpr(Node), Node->isBoundToLvalueReference())) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(MaterializeTemporaryExpr, (CloneType(Node->getType()), CLAD_COMPAT_CLANG10_GetTemporaryExpr(Node), Node->isBoundToLvalueReference())) | |
DEFINE_CLONE_EXPR(auto, (CloneType(Node->getType()), CLAD_COMPAT_CLANG10_GetTemporaryExpr(Node), Node->isBoundToLvalueReference())) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
lib/Differentiator/StmtClone.cpp
Outdated
DEFINE_CLONE_EXPR(GNUNullExpr, (Node->getType(), Node->getTokenLocation())) | ||
DEFINE_CLONE_EXPR(VAArgExpr, (Node->getBuiltinLoc(), Clone(Node->getSubExpr()), Node->getWrittenTypeInfo(), Node->getRParenLoc(), Node->getType(), Node->isMicrosoftABI())) | ||
DEFINE_CLONE_EXPR(ImplicitValueInitExpr, (Node->getType())) | ||
DEFINE_CLONE_EXPR(ConditionalOperator, (Clone(Node->getCond()), Node->getQuestionLoc(), Clone(Node->getLHS()), Node->getColonLoc(), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind())) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(ConditionalOperator, (Clone(Node->getCond()), Node->getQuestionLoc(), Clone(Node->getLHS()), Node->getColonLoc(), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind())) | |
DEFINE_CLONE_EXPR(auto, (Clone(Node->getCond()), Node->getQuestionLoc(), Clone(Node->getLHS()), Node->getColonLoc(), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind())) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
lib/Differentiator/StmtClone.cpp
Outdated
DEFINE_CLONE_EXPR(VAArgExpr, (Node->getBuiltinLoc(), Clone(Node->getSubExpr()), Node->getWrittenTypeInfo(), Node->getRParenLoc(), Node->getType(), Node->isMicrosoftABI())) | ||
DEFINE_CLONE_EXPR(ImplicitValueInitExpr, (Node->getType())) | ||
DEFINE_CLONE_EXPR(ConditionalOperator, (Clone(Node->getCond()), Node->getQuestionLoc(), Clone(Node->getLHS()), Node->getColonLoc(), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind())) | ||
DEFINE_CLONE_EXPR(AddrLabelExpr, (Node->getAmpAmpLoc(), Node->getLabelLoc(), Node->getLabel(), CloneType(Node->getType()))) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(AddrLabelExpr, (Node->getAmpAmpLoc(), Node->getLabelLoc(), Node->getLabel(), CloneType(Node->getType()))) | |
DEFINE_CLONE_EXPR(auto, (Node->getAmpAmpLoc(), Node->getLabelLoc(), Node->getLabel(), CloneType(Node->getType()))) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
lib/Differentiator/StmtClone.cpp
Outdated
DEFINE_CLONE_EXPR(ImplicitValueInitExpr, (Node->getType())) | ||
DEFINE_CLONE_EXPR(ConditionalOperator, (Clone(Node->getCond()), Node->getQuestionLoc(), Clone(Node->getLHS()), Node->getColonLoc(), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind())) | ||
DEFINE_CLONE_EXPR(AddrLabelExpr, (Node->getAmpAmpLoc(), Node->getLabelLoc(), Node->getLabel(), CloneType(Node->getType()))) | ||
DEFINE_CLONE_EXPR(StmtExpr, (Clone(Node->getSubStmt()), CloneType(Node->getType()), Node->getLParenLoc(), Node->getRParenLoc() CLAD_COMPAT_CLANG10_StmtExpr_Create_ExtraParams )) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(StmtExpr, (Clone(Node->getSubStmt()), CloneType(Node->getType()), Node->getLParenLoc(), Node->getRParenLoc() CLAD_COMPAT_CLANG10_StmtExpr_Create_ExtraParams )) | |
DEFINE_CLONE_EXPR(auto, (Clone(Node->getSubStmt()), CloneType(Node->getType()), Node->getLParenLoc(), Node->getRParenLoc() CLAD_COMPAT_CLANG10_StmtExpr_Create_ExtraParams )) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
lib/Differentiator/StmtClone.cpp
Outdated
DEFINE_CLONE_EXPR(ConditionalOperator, (Clone(Node->getCond()), Node->getQuestionLoc(), Clone(Node->getLHS()), Node->getColonLoc(), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind())) | ||
DEFINE_CLONE_EXPR(AddrLabelExpr, (Node->getAmpAmpLoc(), Node->getLabelLoc(), Node->getLabel(), CloneType(Node->getType()))) | ||
DEFINE_CLONE_EXPR(StmtExpr, (Clone(Node->getSubStmt()), CloneType(Node->getType()), Node->getLParenLoc(), Node->getRParenLoc() CLAD_COMPAT_CLANG10_StmtExpr_Create_ExtraParams )) | ||
DEFINE_CLONE_EXPR(ChooseExpr, (Node->getBuiltinLoc(), Clone(Node->getCond()), Clone(Node->getLHS()), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind(), Node->getRParenLoc(), Node->isConditionTrue() CLAD_COMPAT_CLANG11_ChooseExpr_EtraParams_Removed)) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(ChooseExpr, (Node->getBuiltinLoc(), Clone(Node->getCond()), Clone(Node->getLHS()), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind(), Node->getRParenLoc(), Node->isConditionTrue() CLAD_COMPAT_CLANG11_ChooseExpr_EtraParams_Removed)) | |
DEFINE_CLONE_EXPR(auto, (Node->getBuiltinLoc(), Clone(Node->getCond()), Clone(Node->getLHS()), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind(), Node->getRParenLoc(), Node->isConditionTrue() CLAD_COMPAT_CLANG11_ChooseExpr_EtraParams_Removed)) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
lib/Differentiator/StmtClone.cpp
Outdated
DEFINE_CLONE_EXPR(AddrLabelExpr, (Node->getAmpAmpLoc(), Node->getLabelLoc(), Node->getLabel(), CloneType(Node->getType()))) | ||
DEFINE_CLONE_EXPR(StmtExpr, (Clone(Node->getSubStmt()), CloneType(Node->getType()), Node->getLParenLoc(), Node->getRParenLoc() CLAD_COMPAT_CLANG10_StmtExpr_Create_ExtraParams )) | ||
DEFINE_CLONE_EXPR(ChooseExpr, (Node->getBuiltinLoc(), Clone(Node->getCond()), Clone(Node->getLHS()), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind(), Node->getRParenLoc(), Node->isConditionTrue() CLAD_COMPAT_CLANG11_ChooseExpr_EtraParams_Removed)) | ||
DEFINE_CLONE_EXPR(GNUNullExpr, (CloneType(Node->getType()), Node->getTokenLocation())) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(GNUNullExpr, (CloneType(Node->getType()), Node->getTokenLocation())) | |
DEFINE_CLONE_EXPR(auto, (CloneType(Node->getType()), Node->getTokenLocation())) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
lib/Differentiator/StmtClone.cpp
Outdated
DEFINE_CLONE_EXPR(StmtExpr, (Clone(Node->getSubStmt()), CloneType(Node->getType()), Node->getLParenLoc(), Node->getRParenLoc() CLAD_COMPAT_CLANG10_StmtExpr_Create_ExtraParams )) | ||
DEFINE_CLONE_EXPR(ChooseExpr, (Node->getBuiltinLoc(), Clone(Node->getCond()), Clone(Node->getLHS()), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind(), Node->getRParenLoc(), Node->isConditionTrue() CLAD_COMPAT_CLANG11_ChooseExpr_EtraParams_Removed)) | ||
DEFINE_CLONE_EXPR(GNUNullExpr, (CloneType(Node->getType()), Node->getTokenLocation())) | ||
DEFINE_CLONE_EXPR(VAArgExpr, (Node->getBuiltinLoc(), Clone(Node->getSubExpr()), Node->getWrittenTypeInfo(), Node->getRParenLoc(), CloneType(Node->getType()), Node->isMicrosoftABI())) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(VAArgExpr, (Node->getBuiltinLoc(), Clone(Node->getSubExpr()), Node->getWrittenTypeInfo(), Node->getRParenLoc(), CloneType(Node->getType()), Node->isMicrosoftABI())) | |
DEFINE_CLONE_EXPR(auto, (Node->getBuiltinLoc(), Clone(Node->getSubExpr()), Node->getWrittenTypeInfo(), Node->getRParenLoc(), CloneType(Node->getType()), Node->isMicrosoftABI())) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
DEFINE_CLONE_EXPR(ChooseExpr, (Node->getBuiltinLoc(), Clone(Node->getCond()), Clone(Node->getLHS()), Clone(Node->getRHS()), CloneType(Node->getType()), Node->getValueKind(), Node->getObjectKind(), Node->getRParenLoc(), Node->isConditionTrue() CLAD_COMPAT_CLANG11_ChooseExpr_EtraParams_Removed)) | ||
DEFINE_CLONE_EXPR(GNUNullExpr, (CloneType(Node->getType()), Node->getTokenLocation())) | ||
DEFINE_CLONE_EXPR(VAArgExpr, (Node->getBuiltinLoc(), Clone(Node->getSubExpr()), Node->getWrittenTypeInfo(), Node->getRParenLoc(), CloneType(Node->getType()), Node->isMicrosoftABI())) | ||
DEFINE_CLONE_EXPR(ImplicitValueInitExpr, (CloneType(Node->getType()))) |
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: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
DEFINE_CLONE_EXPR(ImplicitValueInitExpr, (CloneType(Node->getType()))) | |
DEFINE_CLONE_EXPR(auto, (CloneType(Node->getType()))) |
Additional context
lib/Differentiator/StmtClone.cpp:36: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^
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.
clang-tidy made some suggestions
clang-tidy review says "All clean, LGTM! 👍" |
9197070
to
0864e71
Compare
clang-tidy review says "All clean, LGTM! 👍" |
clang-tidy review says "All clean, LGTM! 👍" |
The coverage and osx timeouts seem unrelated. |
Currently, the differentiated function takes
Type
ofExpr
andDecl
from the original function. This is a problem forVariableArrayType
since it has a pointer to its size expression (e.g. the type ofint arr [k]
has aDeclRefExpr
ofk
, which has to be cloned). This pull request introduces type cloning to clone size expressions forVariableArrayType
.