File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
clang/lib/Analysis/FlowSensitive Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 27
27
#include < cassert>
28
28
#include < utility>
29
29
30
+ #define DEBUG_TYPE " dataflow"
31
+
30
32
namespace clang {
31
33
namespace dataflow {
32
34
@@ -553,8 +555,10 @@ class ResultObjectVisitor : public RecursiveASTVisitor<ResultObjectVisitor> {
553
555
// All other expression nodes that propagate a record prvalue should have
554
556
// exactly one child.
555
557
llvm::SmallVector<Stmt *> Children (E->child_begin (), E->child_end ());
556
- if (Children.size () != 1 )
557
- E->dump ();
558
+ LLVM_DEBUG ({
559
+ if (Children.size () != 1 )
560
+ E->dump ();
561
+ });
558
562
assert (Children.size () == 1 );
559
563
for (Stmt *S : Children)
560
564
PropagateResultObject (cast<Expr>(S), Loc);
Original file line number Diff line number Diff line change @@ -470,8 +470,14 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
470
470
void VisitCXXDefaultInitExpr (const CXXDefaultInitExpr *S) {
471
471
const Expr *InitExpr = S->getExpr ();
472
472
assert (InitExpr != nullptr );
473
- if (!(S->getType ()->isRecordType () && S->isPRValue ()))
474
- propagateValueOrStorageLocation (*InitExpr, *S, Env);
473
+
474
+ // If this is a prvalue of record type, the handler for `*InitExpr` (if one
475
+ // exists) will initialize the result object; there is no value to propgate
476
+ // here.
477
+ if (S->getType ()->isRecordType () && S->isPRValue ())
478
+ return ;
479
+
480
+ propagateValueOrStorageLocation (*InitExpr, *S, Env);
475
481
}
476
482
477
483
void VisitCXXConstructExpr (const CXXConstructExpr *S) {
You can’t perform that action at this time.
0 commit comments