Skip to content

Commit 49b4689

Browse files
committed
WIP: fix assert in hasInitWithSideEffects
1 parent a2dc64c commit 49b4689

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

clang/lib/AST/Decl.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,20 +2444,14 @@ bool VarDecl::hasInitWithSideEffects() const {
24442444
if (!hasInit())
24452445
return false;
24462446

2447-
// Check if we can get the initializer without deserializing
2448-
const Expr *E = nullptr;
2447+
// Check if we can get the initializer directly without an external source
24492448
if (auto *S = dyn_cast<Stmt *>(Init)) {
2450-
E = cast<Expr>(S);
2451-
} else {
2452-
E = cast_or_null<Expr>(getEvaluatedStmt()->Value.getWithoutDeserializing());
2453-
}
2454-
2455-
if (E)
2449+
const Expr *E = cast<Expr>(S);
24562450
return E->HasSideEffects(getASTContext()) &&
24572451
// We can get a value-dependent initializer during error recovery.
24582452
(E->isValueDependent() || !evaluateValue());
2453+
}
24592454

2460-
assert(getEvaluatedStmt()->Value.isOffset());
24612455
// ASTReader tracks this without having to deserialize the initializer
24622456
if (auto Source = getASTContext().getExternalSource())
24632457
return Source->hasInitializerWithSideEffects(this);

0 commit comments

Comments
 (0)