-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
[clang][dataflow]Propagate the result object location for CXXDefaultInitExpr. #98490
Conversation
These are not "original initializers"; the single node underneath represents the initializing node.
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-analysis Author: Samira Bazuzi (bazuzi) ChangesThese are not "original initializers"; the single node underneath represents the initializing node. Full diff: https://github.com/llvm/llvm-project/pull/98490.diff 1 Files Affected:
diff --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
index 7c88917faf9c6..f734168e647bd 100644
--- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -15,6 +15,7 @@
#include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
+#include "clang/AST/ExprCXX.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/Type.h"
@@ -414,8 +415,8 @@ class ResultObjectVisitor : public AnalysisASTVisitor<ResultObjectVisitor> {
// lowest-level AST node that initializes a given object, and nothing
// below them can initialize the same object (or part of it).
if (isa<CXXConstructExpr>(E) || isa<CallExpr>(E) || isa<LambdaExpr>(E) ||
- isa<CXXDefaultArgExpr>(E) || isa<CXXDefaultInitExpr>(E) ||
- isa<CXXStdInitializerListExpr>(E) || isa<AtomicExpr>(E) ||
+ isa<CXXDefaultArgExpr>(E) || isa<CXXStdInitializerListExpr>(E) ||
+ isa<AtomicExpr>(E) ||
// We treat `BuiltinBitCastExpr` as an "original initializer" too as
// it may not even be casting from a record type -- and even if it is,
// the two objects are in general of unrelated type.
@@ -463,6 +464,11 @@ class ResultObjectVisitor : public AnalysisASTVisitor<ResultObjectVisitor> {
return;
}
+ if (auto *DIE = dyn_cast<CXXDefaultInitExpr>(E)) {
+ PropagateResultObject(DIE->getExpr(), Loc);
+ return;
+ }
+
// All other expression nodes that propagate a record prvalue should have
// exactly one child.
SmallVector<Stmt *, 1> Children(E->child_begin(), E->child_end());
|
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.
LGTM, thanks!
Thanks for the review. Could you merge for me? I don't have commit access. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/141/builds/738 Here is the relevant piece of the build log for the reference:
|
…nitExpr. (llvm#98490) These are not "original initializers"; the single node underneath represents the initializing node.
…nitExpr. (llvm#98490) These are not "original initializers"; the single node underneath represents the initializing node.
These are not "original initializers"; the single node underneath represents the initializing node.