forked from OSchip/llvm-project
[flang] Combined the implementations to ```Pre()``` and ```Post()``` functions that
call `PushConstruct()``` and ```PopConstruct()``` following a genius suggestion from Peter. Original-commit: flang-compiler/f18@be2a03ebf4 Reviewed-on: https://github.com/flang-compiler/f18/pull/686
This commit is contained in:
parent
74112759c3
commit
97d7b398e4
|
@ -57,10 +57,18 @@ public:
|
|||
: C{context}..., context_{context} {}
|
||||
|
||||
template<typename N> bool Pre(const N &node) {
|
||||
if constexpr (common::HasMember<const N *, ConstructNode>) {
|
||||
context_.PushConstruct(node);
|
||||
}
|
||||
Enter(node);
|
||||
return true;
|
||||
}
|
||||
template<typename N> void Post(const N &node) { Leave(node); }
|
||||
template<typename N> void Post(const N &node) {
|
||||
Leave(node);
|
||||
if constexpr (common::HasMember<const N *, ConstructNode>) {
|
||||
context_.PopConstruct();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> bool Pre(const parser::Statement<T> &node) {
|
||||
context_.set_location(node.source);
|
||||
|
@ -81,127 +89,6 @@ public:
|
|||
context_.set_location(std::nullopt);
|
||||
}
|
||||
|
||||
bool Pre(const parser::AssociateConstruct &associateConstruct) {
|
||||
context_.PushConstruct(associateConstruct);
|
||||
Enter(associateConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::BlockConstruct &blockConstruct) {
|
||||
context_.PushConstruct(blockConstruct);
|
||||
Enter(blockConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::CaseConstruct &caseConstruct) {
|
||||
context_.PushConstruct(caseConstruct);
|
||||
Enter(caseConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::CriticalConstruct &criticalConstruct) {
|
||||
context_.PushConstruct(criticalConstruct);
|
||||
Enter(criticalConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::ChangeTeamConstruct &changeTeamConstruct) {
|
||||
context_.PushConstruct(changeTeamConstruct);
|
||||
Enter(changeTeamConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::DoConstruct &doConstruct) {
|
||||
context_.PushConstruct(doConstruct);
|
||||
Enter(doConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::ForAllConstruct &forAllConstruct) {
|
||||
context_.PushConstruct(&forAllConstruct);
|
||||
Enter(forAllConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::IfConstruct &ifConstruct) {
|
||||
context_.PushConstruct(ifConstruct);
|
||||
Enter(ifConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::SelectRankConstruct &selectRankConstruct) {
|
||||
context_.PushConstruct(selectRankConstruct);
|
||||
Enter(selectRankConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::SelectTypeConstruct &selectTypeConstruct) {
|
||||
context_.PushConstruct(selectTypeConstruct);
|
||||
Enter(selectTypeConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::WhereConstruct &whereConstruct) {
|
||||
context_.PushConstruct(whereConstruct);
|
||||
Enter(whereConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Post(const parser::AssociateConstruct &associateConstruct) {
|
||||
Leave(associateConstruct);
|
||||
context_.PopConstruct();
|
||||
}
|
||||
|
||||
void Post(const parser::BlockConstruct &blockConstruct) {
|
||||
Leave(blockConstruct);
|
||||
context_.PopConstruct();
|
||||
}
|
||||
|
||||
void Post(const parser::CaseConstruct &caseConstruct) {
|
||||
Leave(caseConstruct);
|
||||
context_.PopConstruct();
|
||||
}
|
||||
|
||||
void Post(const parser::DoConstruct &doConstruct) {
|
||||
Leave(doConstruct);
|
||||
context_.PopConstruct();
|
||||
}
|
||||
|
||||
void Post(const parser::CriticalConstruct &criticalConstruct) {
|
||||
Leave(criticalConstruct);
|
||||
context_.PopConstruct();
|
||||
}
|
||||
|
||||
void Post(const parser::ChangeTeamConstruct &changeTeamConstruct) {
|
||||
Leave(changeTeamConstruct);
|
||||
context_.PopConstruct();
|
||||
}
|
||||
|
||||
void Post(const parser::ForAllConstruct &forAllConstruct) {
|
||||
Leave(forAllConstruct);
|
||||
context_.PopConstruct();
|
||||
}
|
||||
|
||||
void Post(const parser::IfConstruct &ifConstruct) {
|
||||
Leave(ifConstruct);
|
||||
context_.PopConstruct();
|
||||
}
|
||||
|
||||
void Post(const parser::SelectRankConstruct &selectRankConstruct) {
|
||||
Leave(selectRankConstruct);
|
||||
context_.PopConstruct();
|
||||
}
|
||||
|
||||
void Post(const parser::SelectTypeConstruct &selectTypeConstruct) {
|
||||
Leave(selectTypeConstruct);
|
||||
context_.PopConstruct();
|
||||
}
|
||||
|
||||
void Post(const parser::WhereConstruct &whereConstruct) {
|
||||
Leave(whereConstruct);
|
||||
context_.PopConstruct();
|
||||
}
|
||||
|
||||
bool Walk(const parser::Program &program) {
|
||||
parser::Walk(program, *this);
|
||||
return !context_.AnyFatalError();
|
||||
|
|
Loading…
Reference in New Issue