forked from OSchip/llvm-project
[flang] Ensure no failed expression analyses without fatal errors.
Original-commit: flang-compiler/f18@3ef8b43031 Reviewed-on: https://github.com/flang-compiler/f18/pull/406 Tree-same-pre-rewrite: false
This commit is contained in:
parent
8529034ea0
commit
a90455057c
|
@ -1832,6 +1832,9 @@ MaybeExpr ExpressionAnalyzer::Analyze(const parser::Expr &expr) {
|
|||
}
|
||||
if (result.has_value()) {
|
||||
expr.typedExpr.reset(new GenericExprWrapper{common::Clone(*result)});
|
||||
} else if (!fatalErrors_) {
|
||||
CHECK(context_.AnyFatalError()); // somewhat expensive
|
||||
fatalErrors_ = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1968,6 +1971,7 @@ evaluate::Expr<evaluate::SubscriptInteger> AnalyzeKindSelector(
|
|||
auto save{analyzer.GetContextualMessages().SetLocation(*context.location())};
|
||||
return analyzer.AnalyzeKindSelector(category, selector);
|
||||
}
|
||||
|
||||
bool ExprChecker::Walk(const parser::Program &program) {
|
||||
parser::Walk(program, *this);
|
||||
return !context_.AnyFatalError();
|
||||
|
|
|
@ -249,6 +249,7 @@ private:
|
|||
|
||||
semantics::SemanticsContext &context_;
|
||||
std::map<parser::CharBlock, int> acImpliedDos_; // values are INTEGER kinds
|
||||
bool fatalErrors_{false};
|
||||
};
|
||||
|
||||
template<typename L, typename R>
|
||||
|
@ -303,6 +304,7 @@ public:
|
|||
AnalyzeExpr(context_, x);
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename A> bool Pre(const parser::Scalar<A> &x) {
|
||||
AnalyzeExpr(context_, x);
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue