Conversation
| void UsefulAnalyzer::AnalyzeCFGBlock(const CFGBlock& block) { | ||
| for (auto ib = block.end(); ib != block.begin() - 1; ib--) { | ||
| if (ib->getKind() == clang::CFGElement::Statement) { | ||
| for (const auto& Element : llvm::reverse(block)) { |
There was a problem hiding this comment.
warning: no header providing "llvm::reverse" is directly included [misc-include-cleaner]
lib/Differentiator/UsefulAnalyzer.cpp:1:
+ #include <llvm/ADT/STLExtras.h>| if (ib->getKind() == clang::CFGElement::Statement) { | ||
| for (const auto& Element : llvm::reverse(block)) { | ||
| if (Element.getKind() == clang::CFGElement::Statement) { | ||
| const clang::Stmt* S = Element.castAs<clang::CFGStmt>().getStmt(); |
There was a problem hiding this comment.
warning: no header providing "clang::Stmt" is directly included [misc-include-cleaner]
lib/Differentiator/UsefulAnalyzer.cpp:1:
+ #include <clang/AST/Stmt.h>4411956 to
01f3196
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
01f3196 to
ce3dc19
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ce3dc19 to
e074f79
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
e074f79 to
593a699
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
0faa242 to
50b23e4
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
1 similar comment
|
clang-tidy review says "All clean, LGTM! 👍" |
| if (auto* IL = | ||
| dyn_cast<IntegerLiteral>(Init->IgnoreParenImpCasts())) { | ||
| if (IL->getValue() == 0) | ||
| VD->setInit(getZeroInit(VD->getType())); |
There was a problem hiding this comment.
Shouldn't this happen in DSClone when building the declaration statement?
There was a problem hiding this comment.
Thanks for the review!
That makes sense handling the getZeroInit during the declaration is cleaner and more efficient way than patching in the later stages.
I will make the changes accordingly and push the update.
|
clang-tidy review says "All clean, LGTM! 👍" |
…or assignments and initializations of variables Fixes vgvassilev#1074
b4cbb53 to
bb9d2f3
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
I have configured the clad both reverse mode and the forward mode to use 'getZeroInit()' for initialization and assignments of variable. I have changed the test suite to align with the changes made. While running the tests locally with ASAN enabled i encountered use-after-poison crash in clad/lib/Analyses/UsefulAnalyzer.cpp. And the fix of that problem (in the UsefulAnalyzer.cpp) is also made in this PR.
Below is the stack trace of the crash which has been resolved:-