Skip to content

Commit 4302acb

Browse files
committed
AST: Make absence of discriminator into a fatal error
... even in noassert builds. This is always a miscompile and should be prevented.
1 parent 6f996ef commit 4302acb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/AST/Expr.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,7 +1934,12 @@ unsigned AbstractClosureExpr::getDiscriminator() const {
19341934
Bits.AbstractClosureExpr.Discriminator = discriminator;
19351935
}
19361936

1937-
assert(getRawDiscriminator() != InvalidDiscriminator);
1937+
if (getRawDiscriminator() == InvalidDiscriminator) {
1938+
llvm::errs() << "Closure does not have an assigned discriminator:\n";
1939+
dump(llvm::errs());
1940+
abort();
1941+
}
1942+
19381943
return getRawDiscriminator();
19391944
}
19401945

0 commit comments

Comments
 (0)