#ifndef FORTRAN_SEMANTICS_RUNTIME_TYPE_INFO_H_
#define FORTRAN_SEMANTICS_RUNTIME_TYPE_INFO_H_
-#include "flang/Common/reference.h"
#include <set>
#include <string>
#include <vector>
class SemanticsContext;
class Symbol;
-using SymbolRef = common::Reference<const Symbol>;
-using SymbolVector = std::vector<SymbolRef>;
-
struct RuntimeDerivedTypeTables {
Scope *schemata{nullptr};
std::set<std::string> names;
/// to describe other derived types at runtime in flang descriptor.
constexpr char typeInfoBuiltinModule[]{"__fortran_type_info"};
-SymbolVector CollectBindings(const Scope &dtScope);
+std::vector<const Symbol *> CollectBindings(const Scope &dtScope);
} // namespace Fortran::semantics
#endif // FORTRAN_SEMANTICS_RUNTIME_TYPE_INFO_H_
parent ? Fortran::lower::mangle::mangleName(*parent) : "");
auto insertPt = builder.saveInsertionPoint();
- Fortran::semantics::SymbolVector bindings =
+ std::vector<const Fortran::semantics::Symbol *> bindings =
Fortran::semantics::CollectBindings(*info.typeSpec->scope());
if (!bindings.empty())
builder.createBlock(&dt.getRegion());
- for (const Fortran::semantics::SymbolRef binding : bindings) {
+ for (const Fortran::semantics::Symbol *binding : bindings) {
const auto *details =
- binding.get().detailsIf<Fortran::semantics::ProcBindingDetails>();
+ binding->detailsIf<Fortran::semantics::ProcBindingDetails>();
std::string bindingName =
Fortran::lower::mangle::mangleName(details->symbol());
builder.create<fir::DTEntryOp>(
info.loc,
mlir::StringAttr::get(builder.getContext(),
- binding.get().name().ToString()),
+ binding->name().ToString()),
mlir::SymbolRefAttr::get(builder.getContext(), bindingName));
}
if (!bindings.empty())
return StructureExpr(PackageIntValue(genre, n));
}
-SymbolVector CollectBindings(const Scope &dtScope) {
- SymbolVector result;
+std::vector<const Symbol *> CollectBindings(const Scope &dtScope) {
+ std::vector<const Symbol *> result;
std::map<SourceName, const Symbol *> localBindings;
// Collect local bindings
for (auto pair : dtScope) {
const Symbol &symbol{**iter};
auto overridden{localBindings.find(symbol.name())};
if (overridden != localBindings.end()) {
- *iter = *overridden->second;
+ *iter = overridden->second;
localBindings.erase(overridden);
}
}
}
// Add remaining (non-overriding) local bindings in name order to the result
for (auto pair : localBindings) {
- result.push_back(*pair.second);
+ result.push_back(pair.second);
}
return result;
}
std::vector<evaluate::StructureConstructor>
RuntimeTableBuilder::DescribeBindings(const Scope &dtScope, Scope &scope) {
std::vector<evaluate::StructureConstructor> result;
- for (const SymbolRef ref : CollectBindings(dtScope)) {
+ for (const Symbol *symbol : CollectBindings(dtScope)) {
evaluate::StructureConstructorValues values;
AddValue(values, bindingSchema_, "proc"s,
SomeExpr{evaluate::ProcedureDesignator{
- ref.get().get<ProcBindingDetails>().symbol()}});
+ symbol->get<ProcBindingDetails>().symbol()}});
AddValue(values, bindingSchema_, "name"s,
- SaveNameAsPointerTarget(scope, ref.get().name().ToString()));
+ SaveNameAsPointerTarget(scope, symbol->name().ToString()));
result.emplace_back(DEREF(bindingSchema_.AsDerived()), std::move(values));
}
return result;