forked from OSchip/llvm-project
[flang] Move ExprChecker into separate pass
DoConcurrentChecker depends on expressions being fully resolved so it can't be in the same pass as ExprChecker. The same will probably apply to AssignmentChecker when its finished. Checks that don't depend on expressions can go in the first pass with ExprChecker. Original-commit: flang-compiler/f18@c0785ec06f Reviewed-on: https://github.com/flang-compiler/f18/pull/315
This commit is contained in:
parent
d19308787c
commit
f85ac283c5
|
@ -48,10 +48,12 @@ template<typename... C> struct SemanticsVisitor : public virtual C... {
|
|||
return true;
|
||||
}
|
||||
template<typename N> void Post(const N &node) { Leave(node); }
|
||||
void Walk(const parser::Program &program) { parser::Walk(program, *this); }
|
||||
};
|
||||
|
||||
using StatementSemantics =
|
||||
SemanticsVisitor<ExprChecker, AssignmentChecker, DoConcurrentChecker>;
|
||||
using StatementSemanticsPass1 = SemanticsVisitor<ExprChecker>;
|
||||
using StatementSemanticsPass2 =
|
||||
SemanticsVisitor<AssignmentChecker, DoConcurrentChecker>;
|
||||
|
||||
SemanticsContext::SemanticsContext(
|
||||
const common::IntrinsicTypeDefaultKinds &defaultKinds)
|
||||
|
@ -102,8 +104,11 @@ bool Semantics::Perform() {
|
|||
if (AnyFatalError()) {
|
||||
return false;
|
||||
}
|
||||
StatementSemantics visitor{context_};
|
||||
parser::Walk(program_, visitor);
|
||||
StatementSemanticsPass1{context_}.Walk(program_);
|
||||
if (AnyFatalError()) {
|
||||
return false;
|
||||
}
|
||||
StatementSemanticsPass2{context_}.Walk(program_);
|
||||
if (AnyFatalError()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -122,8 +122,8 @@ private:
|
|||
|
||||
// Base class for semantics checkers.
|
||||
struct BaseChecker {
|
||||
template<typename C> void Enter(const C &x) {}
|
||||
template<typename C> void Leave(const C &x) {}
|
||||
template<typename N> void Enter(const N &) {}
|
||||
template<typename N> void Leave(const N &) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue