diff options
author | Andrzej Warzynski <andrzej.warzynski@arm.com> | 2022-03-28 10:46:47 +0000 |
---|---|---|
committer | Andrzej Warzynski <andrzej.warzynski@arm.com> | 2022-03-28 10:46:47 +0000 |
commit | 4ca111d4cb4c0b425268c86b54fb19c4be2e88dd (patch) | |
tree | 6d91dd6a88db439cb9a40447525270865fcae20d /flang/lib/Semantics/mod-file.cpp | |
parent | 8a2a966520023cd7d424e89b730c054f1f06f496 (diff) | |
download | llvm-4ca111d4cb4c0b425268c86b54fb19c4be2e88dd.zip llvm-4ca111d4cb4c0b425268c86b54fb19c4be2e88dd.tar.gz llvm-4ca111d4cb4c0b425268c86b54fb19c4be2e88dd.tar.bz2 |
Revert "[flang] Add & use a better visit()"
This reverts commit 2ab9990c9eb79682a4d4b183dfbc7612d3e55328. It has
caused multiple build failures:
* https://lab.llvm.org/buildbot/#/builders/177/builds/4346
* https://lab.llvm.org/buildbot/#/builders/180/builds/3803
* https://lab.llvm.org/buildbot/#/builders/175/builds/10419
* https://lab.llvm.org/buildbot/#/builders/191/builds/4318
* https://lab.llvm.org/buildbot/#/builders/173/builds/4274
* https://lab.llvm.org/buildbot/#/builders/181/builds/4297
All these bots failed with a time-out:
```
command timed out: 1200 seconds without output running [b'ninja', b'-j', b'32'], attempting to kill
```
I'm guessing that that's due to template instantiations failing at some
point (https://reviews.llvm.org/D122441 introduced a custom
implementation of std::visit). Everything seems fine when either:
* building on X86 with GCC or Clang (tested with GCC 9.3 and Clang 12)
* building on AArch64 with GCC (tested with GCC 11)
Diffstat (limited to 'flang/lib/Semantics/mod-file.cpp')
-rw-r--r-- | flang/lib/Semantics/mod-file.cpp | 179 |
1 files changed, 89 insertions, 90 deletions
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp index d19dc5c..10d56b2 100644 --- a/flang/lib/Semantics/mod-file.cpp +++ b/flang/lib/Semantics/mod-file.cpp @@ -257,74 +257,73 @@ static llvm::raw_ostream &PutGenericName( // procedures, type-bound generics, final procedures) which go to typeBindings. void ModFileWriter::PutSymbol( llvm::raw_ostream &typeBindings, const Symbol &symbol) { - common::visit( - common::visitors{ - [&](const ModuleDetails &) { /* should be current module */ }, - [&](const DerivedTypeDetails &) { PutDerivedType(symbol); }, - [&](const SubprogramDetails &) { PutSubprogram(symbol); }, - [&](const GenericDetails &x) { - if (symbol.owner().IsDerivedType()) { - // generic binding - for (const Symbol &proc : x.specificProcs()) { - PutGenericName(typeBindings << "generic::", symbol) - << "=>" << proc.name() << '\n'; - } - } else { - PutGeneric(symbol); - if (x.specific()) { - PutSymbol(typeBindings, *x.specific()); - } - if (x.derivedType()) { - PutSymbol(typeBindings, *x.derivedType()); - } - } - }, - [&](const UseDetails &) { PutUse(symbol); }, - [](const UseErrorDetails &) {}, - [&](const ProcBindingDetails &x) { - bool deferred{symbol.attrs().test(Attr::DEFERRED)}; - typeBindings << "procedure"; - if (deferred) { - typeBindings << '(' << x.symbol().name() << ')'; - } - PutPassName(typeBindings, x.passName()); - auto attrs{symbol.attrs()}; - if (x.passName()) { - attrs.reset(Attr::PASS); - } - PutAttrs(typeBindings, attrs); - typeBindings << "::" << symbol.name(); - if (!deferred && x.symbol().name() != symbol.name()) { - typeBindings << "=>" << x.symbol().name(); - } - typeBindings << '\n'; - }, - [&](const NamelistDetails &x) { - decls_ << "namelist/" << symbol.name(); - char sep{'/'}; - for (const Symbol &object : x.objects()) { - decls_ << sep << object.name(); - sep = ','; - } - decls_ << '\n'; - }, - [&](const CommonBlockDetails &x) { - decls_ << "common/" << symbol.name(); - char sep = '/'; - for (const auto &object : x.objects()) { - decls_ << sep << object->name(); - sep = ','; - } - decls_ << '\n'; - if (symbol.attrs().test(Attr::BIND_C)) { - PutAttrs(decls_, symbol.attrs(), x.bindName(), ""s); - decls_ << "::/" << symbol.name() << "/\n"; - } - }, - [](const HostAssocDetails &) {}, - [](const MiscDetails &) {}, - [&](const auto &) { PutEntity(decls_, symbol); }, - }, + std::visit(common::visitors{ + [&](const ModuleDetails &) { /* should be current module */ }, + [&](const DerivedTypeDetails &) { PutDerivedType(symbol); }, + [&](const SubprogramDetails &) { PutSubprogram(symbol); }, + [&](const GenericDetails &x) { + if (symbol.owner().IsDerivedType()) { + // generic binding + for (const Symbol &proc : x.specificProcs()) { + PutGenericName(typeBindings << "generic::", symbol) + << "=>" << proc.name() << '\n'; + } + } else { + PutGeneric(symbol); + if (x.specific()) { + PutSymbol(typeBindings, *x.specific()); + } + if (x.derivedType()) { + PutSymbol(typeBindings, *x.derivedType()); + } + } + }, + [&](const UseDetails &) { PutUse(symbol); }, + [](const UseErrorDetails &) {}, + [&](const ProcBindingDetails &x) { + bool deferred{symbol.attrs().test(Attr::DEFERRED)}; + typeBindings << "procedure"; + if (deferred) { + typeBindings << '(' << x.symbol().name() << ')'; + } + PutPassName(typeBindings, x.passName()); + auto attrs{symbol.attrs()}; + if (x.passName()) { + attrs.reset(Attr::PASS); + } + PutAttrs(typeBindings, attrs); + typeBindings << "::" << symbol.name(); + if (!deferred && x.symbol().name() != symbol.name()) { + typeBindings << "=>" << x.symbol().name(); + } + typeBindings << '\n'; + }, + [&](const NamelistDetails &x) { + decls_ << "namelist/" << symbol.name(); + char sep{'/'}; + for (const Symbol &object : x.objects()) { + decls_ << sep << object.name(); + sep = ','; + } + decls_ << '\n'; + }, + [&](const CommonBlockDetails &x) { + decls_ << "common/" << symbol.name(); + char sep = '/'; + for (const auto &object : x.objects()) { + decls_ << sep << object->name(); + sep = ','; + } + decls_ << '\n'; + if (symbol.attrs().test(Attr::BIND_C)) { + PutAttrs(decls_, symbol.attrs(), x.bindName(), ""s); + decls_ << "::/" << symbol.name() << "/\n"; + } + }, + [](const HostAssocDetails &) {}, + [](const MiscDetails &) {}, + [&](const auto &) { PutEntity(decls_, symbol); }, + }, symbol.details()); } @@ -595,7 +594,7 @@ void CollectSymbols( } void ModFileWriter::PutEntity(llvm::raw_ostream &os, const Symbol &symbol) { - common::visit( + std::visit( common::visitors{ [&](const ObjectEntityDetails &) { PutObjectEntity(os, symbol); }, [&](const ProcEntityDetails &) { PutProcEntity(os, symbol); }, @@ -1106,27 +1105,27 @@ void SubprogramSymbolCollector::DoSymbol( if (!needSet_.insert(symbol).second) { return; // already done } - common::visit(common::visitors{ - [this](const ObjectEntityDetails &details) { - for (const ShapeSpec &spec : details.shape()) { - DoBound(spec.lbound()); - DoBound(spec.ubound()); - } - for (const ShapeSpec &spec : details.coshape()) { - DoBound(spec.lbound()); - DoBound(spec.ubound()); - } - if (const Symbol * commonBlock{details.commonBlock()}) { - DoSymbol(*commonBlock); - } - }, - [this](const CommonBlockDetails &details) { - for (const auto &object : details.objects()) { - DoSymbol(*object); - } - }, - [](const auto &) {}, - }, + std::visit(common::visitors{ + [this](const ObjectEntityDetails &details) { + for (const ShapeSpec &spec : details.shape()) { + DoBound(spec.lbound()); + DoBound(spec.ubound()); + } + for (const ShapeSpec &spec : details.coshape()) { + DoBound(spec.lbound()); + DoBound(spec.ubound()); + } + if (const Symbol * commonBlock{details.commonBlock()}) { + DoSymbol(*commonBlock); + } + }, + [this](const CommonBlockDetails &details) { + for (const auto &object : details.objects()) { + DoSymbol(*object); + } + }, + [](const auto &) {}, + }, symbol.details()); if (!symbol.has<UseDetails>()) { DoType(symbol.GetType()); |