forked from OSchip/llvm-project
[flang] Changed ```PushConstruct()``` to be a template, which moves the implicit
creation of the ```ConstructNode``` into ```PushConstruct()```. Original-commit: flang-compiler/f18@3984566858 Reviewed-on: https://github.com/flang-compiler/f18/pull/686 Tree-same-pre-rewrite: false
This commit is contained in:
parent
9cc2f8300b
commit
74112759c3
|
@ -82,67 +82,67 @@ public:
|
|||
}
|
||||
|
||||
bool Pre(const parser::AssociateConstruct &associateConstruct) {
|
||||
context_.PushConstruct(ConstructNode{&associateConstruct});
|
||||
context_.PushConstruct(associateConstruct);
|
||||
Enter(associateConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::BlockConstruct &blockConstruct) {
|
||||
context_.PushConstruct(ConstructNode{&blockConstruct});
|
||||
context_.PushConstruct(blockConstruct);
|
||||
Enter(blockConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::CaseConstruct &caseConstruct) {
|
||||
context_.PushConstruct(ConstructNode{&caseConstruct});
|
||||
context_.PushConstruct(caseConstruct);
|
||||
Enter(caseConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::CriticalConstruct &criticalConstruct) {
|
||||
context_.PushConstruct(ConstructNode{&criticalConstruct});
|
||||
context_.PushConstruct(criticalConstruct);
|
||||
Enter(criticalConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::ChangeTeamConstruct &changeTeamConstruct) {
|
||||
context_.PushConstruct(ConstructNode{&changeTeamConstruct});
|
||||
context_.PushConstruct(changeTeamConstruct);
|
||||
Enter(changeTeamConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::DoConstruct &doConstruct) {
|
||||
context_.PushConstruct(ConstructNode{&doConstruct});
|
||||
context_.PushConstruct(doConstruct);
|
||||
Enter(doConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::ForAllConstruct &forAllConstruct) {
|
||||
context_.PushConstruct(ConstructNode{&forAllConstruct});
|
||||
context_.PushConstruct(&forAllConstruct);
|
||||
Enter(forAllConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::IfConstruct &ifConstruct) {
|
||||
context_.PushConstruct(ConstructNode{&ifConstruct});
|
||||
context_.PushConstruct(ifConstruct);
|
||||
Enter(ifConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::SelectRankConstruct &selectRankConstruct) {
|
||||
context_.PushConstruct(ConstructNode{&selectRankConstruct});
|
||||
context_.PushConstruct(selectRankConstruct);
|
||||
Enter(selectRankConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::SelectTypeConstruct &selectTypeConstruct) {
|
||||
context_.PushConstruct(ConstructNode{&selectTypeConstruct});
|
||||
context_.PushConstruct(selectTypeConstruct);
|
||||
Enter(selectTypeConstruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pre(const parser::WhereConstruct &whereConstruct) {
|
||||
context_.PushConstruct(ConstructNode{&whereConstruct});
|
||||
context_.PushConstruct(whereConstruct);
|
||||
Enter(whereConstruct);
|
||||
return true;
|
||||
}
|
||||
|
@ -298,10 +298,6 @@ Scope &SemanticsContext::FindScope(parser::CharBlock source) {
|
|||
}
|
||||
}
|
||||
|
||||
void SemanticsContext::PushConstruct(ConstructNode &&construct) {
|
||||
constructStack_.emplace_back(construct);
|
||||
}
|
||||
|
||||
void SemanticsContext::PopConstruct() {
|
||||
CHECK(!constructStack_.empty());
|
||||
constructStack_.pop_back();
|
||||
|
|
|
@ -140,7 +140,9 @@ public:
|
|||
Scope &FindScope(parser::CharBlock);
|
||||
|
||||
const ConstructStack &constructStack() const { return constructStack_; }
|
||||
void PushConstruct(ConstructNode &&construct);
|
||||
template<typename N> void PushConstruct(const N &node) {
|
||||
constructStack_.emplace_back(&node);
|
||||
}
|
||||
void PopConstruct();
|
||||
bool InsideDoConstruct() const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue