forked from OSchip/llvm-project
[flang] Change more pointers into references
Remove unused interface Respond to review comments Original-commit: flang-compiler/f18@7fdfe7b4ac Reviewed-on: https://github.com/flang-compiler/f18/pull/809
This commit is contained in:
parent
65791b2d0b
commit
a717d170cc
|
@ -85,10 +85,6 @@ public:
|
|||
const semantics::DeclTypeSpec &);
|
||||
static std::optional<TypeAndShape> Characterize(
|
||||
const Expr<SomeType> &, FoldingContext &);
|
||||
template<typename A>
|
||||
static std::optional<TypeAndShape> Characterize(const A *p) {
|
||||
return p ? Characterize(*p) : std::nullopt;
|
||||
}
|
||||
|
||||
DynamicType type() const { return type_; }
|
||||
TypeAndShape &set_type(DynamicType t) {
|
||||
|
|
|
@ -246,8 +246,8 @@ void ModFileWriter::PutSymbol(
|
|||
[&](const CommonBlockDetails &x) {
|
||||
decls_ << "common/" << symbol.name();
|
||||
char sep = '/';
|
||||
for (const auto *object : x.objects()) {
|
||||
decls_ << sep << DEREF(object).name();
|
||||
for (const Symbol &object : x.objects()) {
|
||||
decls_ << sep << object.name();
|
||||
sep = ',';
|
||||
}
|
||||
decls_ << '\n';
|
||||
|
@ -889,8 +889,8 @@ void SubprogramSymbolCollector::DoSymbol(
|
|||
}
|
||||
},
|
||||
[this](const CommonBlockDetails &details) {
|
||||
for (const Symbol *object : details.objects()) {
|
||||
DoSymbol(*object);
|
||||
for (const Symbol &object : details.objects()) {
|
||||
DoSymbol(object);
|
||||
}
|
||||
},
|
||||
[](const auto &) {},
|
||||
|
|
|
@ -1105,7 +1105,7 @@ private:
|
|||
static constexpr Symbol::Flags ompFlagsRequireMark{
|
||||
Symbol::Flag::OmpThreadprivate};
|
||||
|
||||
void AddDataSharingAttributeObject(const Symbol *object) {
|
||||
void AddDataSharingAttributeObject(SymbolRef object) {
|
||||
dataSharingAttributeObjects_.insert(object);
|
||||
}
|
||||
void ClearDataSharingAttributeObjects() {
|
||||
|
@ -1126,11 +1126,11 @@ private:
|
|||
void CheckMultipleAppearances(
|
||||
const parser::Name &, const Symbol &, Symbol::Flag);
|
||||
|
||||
std::set<const Symbol *> dataSharingAttributeObjects_; // on one directive
|
||||
SymbolSet dataSharingAttributeObjects_; // on one directive
|
||||
};
|
||||
|
||||
bool OmpVisitor::HasDataSharingAttributeObject(const Symbol &object) {
|
||||
auto it{dataSharingAttributeObjects_.find(&object)};
|
||||
auto it{dataSharingAttributeObjects_.find(object)};
|
||||
return it != dataSharingAttributeObjects_.end();
|
||||
}
|
||||
|
||||
|
@ -1190,9 +1190,10 @@ void OmpVisitor::ResolveOmpObject(
|
|||
// 2.15.3 When a named common block appears in a list, it has the
|
||||
// same meaning as if every explicit member of the common block
|
||||
// appeared in the list
|
||||
for (Symbol *object :
|
||||
for (const Symbol &object :
|
||||
symbol->get<CommonBlockDetails>().objects()) {
|
||||
ResolveOmp(*object, ompFlag);
|
||||
Symbol &mutableObject{const_cast<Symbol &>(object)};
|
||||
ResolveOmp(mutableObject, ompFlag);
|
||||
}
|
||||
} else {
|
||||
Say(name.source, // 2.15.3
|
||||
|
@ -1288,7 +1289,7 @@ void OmpVisitor::CheckMultipleAppearances(
|
|||
"on the same OpenMP directive"_err_en_US,
|
||||
name.ToString());
|
||||
} else {
|
||||
AddDataSharingAttributeObject(target);
|
||||
AddDataSharingAttributeObject(*target);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1867,10 +1868,10 @@ void ScopeHandler::SayLocalMustBeVariable(
|
|||
|
||||
void ScopeHandler::SayDerivedType(
|
||||
const SourceName &name, MessageFixedText &&msg, const Scope &type) {
|
||||
const Symbol *typeSymbol{type.GetSymbol()};
|
||||
Say(name, std::move(msg), name, DEREF(typeSymbol).name())
|
||||
.Attach(typeSymbol->name(), "Declaration of derived type '%s'"_en_US,
|
||||
typeSymbol->name());
|
||||
const Symbol &typeSymbol{DEREF(type.GetSymbol())};
|
||||
Say(name, std::move(msg), name, typeSymbol.name())
|
||||
.Attach(typeSymbol.name(), "Declaration of derived type '%s'"_en_US,
|
||||
typeSymbol.name());
|
||||
}
|
||||
void ScopeHandler::Say2(const SourceName &name1, MessageFixedText &&msg1,
|
||||
const SourceName &name2, MessageFixedText &&msg2) {
|
||||
|
@ -4184,8 +4185,9 @@ void DeclarationVisitor::CheckSaveStmts() {
|
|||
" common block name '%s'"_err_en_US);
|
||||
}
|
||||
} else {
|
||||
for (Symbol *object : symbol->get<CommonBlockDetails>().objects()) {
|
||||
SetSaveAttr(*object);
|
||||
for (const Symbol &object :
|
||||
symbol->get<CommonBlockDetails>().objects()) {
|
||||
SetSaveAttr(*const_cast<Symbol *>(&object));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -447,8 +447,8 @@ std::ostream &operator<<(std::ostream &os, const Details &details) {
|
|||
},
|
||||
[&](const CommonBlockDetails &x) {
|
||||
os << ':';
|
||||
for (const auto *object : x.objects()) {
|
||||
os << ' ' << object->name();
|
||||
for (const Symbol &object : x.objects()) {
|
||||
os << ' ' << object.name();
|
||||
}
|
||||
},
|
||||
[&](const FinalProcDetails &) {},
|
||||
|
|
|
@ -263,11 +263,11 @@ private:
|
|||
|
||||
class ProcBindingDetails : public WithPassArg {
|
||||
public:
|
||||
explicit ProcBindingDetails(const Symbol &symbol) : symbol_{&symbol} {}
|
||||
const Symbol &symbol() const { return *symbol_; }
|
||||
explicit ProcBindingDetails(const Symbol &symbol) : symbol_{symbol} {}
|
||||
const Symbol &symbol() const { return symbol_; }
|
||||
|
||||
private:
|
||||
const Symbol *symbol_; // procedure bound to; may be forward
|
||||
SymbolRef symbol_; // procedure bound to; may be forward
|
||||
};
|
||||
|
||||
ENUM_CLASS(GenericKind, // Kinds of generic-spec
|
||||
|
@ -304,14 +304,13 @@ private:
|
|||
|
||||
class CommonBlockDetails {
|
||||
public:
|
||||
std::list<Symbol *> &objects() { return objects_; }
|
||||
const std::list<Symbol *> &objects() const { return objects_; }
|
||||
void add_object(Symbol &object) { objects_.push_back(&object); }
|
||||
const SymbolVector &objects() const { return objects_; }
|
||||
void add_object(const Symbol &object) { objects_.emplace_back(object); }
|
||||
MaybeExpr bindName() const { return bindName_; }
|
||||
void set_bindName(MaybeExpr &&expr) { bindName_ = std::move(expr); }
|
||||
|
||||
private:
|
||||
std::list<Symbol *> objects_;
|
||||
SymbolVector objects_;
|
||||
MaybeExpr bindName_;
|
||||
};
|
||||
|
||||
|
@ -352,14 +351,14 @@ private:
|
|||
class UseDetails {
|
||||
public:
|
||||
UseDetails(const SourceName &location, const Symbol &symbol)
|
||||
: location_{location}, symbol_{&symbol} {}
|
||||
: location_{location}, symbol_{symbol} {}
|
||||
const SourceName &location() const { return location_; }
|
||||
const Symbol &symbol() const { return *symbol_; }
|
||||
const Symbol &symbol() const { return symbol_; }
|
||||
const Symbol &module() const;
|
||||
|
||||
private:
|
||||
SourceName location_;
|
||||
const Symbol *symbol_;
|
||||
SymbolRef symbol_;
|
||||
};
|
||||
|
||||
// A symbol with ambiguous use-associations. Record where they were so
|
||||
|
@ -378,11 +377,11 @@ private:
|
|||
// A symbol host-associated from an enclosing scope.
|
||||
class HostAssocDetails {
|
||||
public:
|
||||
HostAssocDetails(const Symbol &symbol) : symbol_{&symbol} {}
|
||||
const Symbol &symbol() const { return *symbol_; }
|
||||
HostAssocDetails(const Symbol &symbol) : symbol_{symbol} {}
|
||||
const Symbol &symbol() const { return symbol_; }
|
||||
|
||||
private:
|
||||
const Symbol *symbol_;
|
||||
SymbolRef symbol_;
|
||||
};
|
||||
|
||||
class GenericDetails {
|
||||
|
|
|
@ -88,7 +88,7 @@ bool IsGenericDefinedOp(const Symbol &symbol) {
|
|||
|
||||
bool IsCommonBlockContaining(const Symbol &block, const Symbol &object) {
|
||||
const auto &objects{block.get<CommonBlockDetails>().objects()};
|
||||
auto found{std::find(objects.begin(), objects.end(), &object)};
|
||||
auto found{std::find(objects.begin(), objects.end(), object)};
|
||||
return found != objects.end();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue