Skip to content

Commit fc61400

Browse files
committed
[flang] Fix llvm::Optional warning caused by D140220
Using llvm::Optional::value() was just deprecated in LLVM. Remove the usage that was added by D140220 and replace it by an assert. https://lab.llvm.org/buildbot/#/builders/160/builds/14222
1 parent 8ef5da7 commit fc61400

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

flang/lib/Lower/Bridge.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,13 @@ class FirConverter : public Fortran::lower::AbstractConverter {
449449

450450
void copySymbolBinding(Fortran::lower::SymbolRef src,
451451
Fortran::lower::SymbolRef target) override final {
452-
if (bridge.getLoweringOptions().getLowerToHighLevelFIR())
453-
localSymbols.addVariableDefinition(
454-
target, localSymbols.lookupVariableDefinition(src).value());
455-
else
452+
if (bridge.getLoweringOptions().getLowerToHighLevelFIR()) {
453+
auto srcDef = localSymbols.lookupVariableDefinition(src);
454+
assert(srcDef && "source binding does not exists");
455+
localSymbols.addVariableDefinition(target, *srcDef);
456+
} else {
456457
localSymbols.addSymbol(target, lookupSymbol(src).toExtendedValue());
458+
}
457459
}
458460

459461
/// Add the symbol binding to the inner-most level of the symbol map and

0 commit comments

Comments
 (0)