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 &);
|
const semantics::DeclTypeSpec &);
|
||||||
static std::optional<TypeAndShape> Characterize(
|
static std::optional<TypeAndShape> Characterize(
|
||||||
const Expr<SomeType> &, FoldingContext &);
|
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_; }
|
DynamicType type() const { return type_; }
|
||||||
TypeAndShape &set_type(DynamicType t) {
|
TypeAndShape &set_type(DynamicType t) {
|
||||||
|
|
|
@ -246,8 +246,8 @@ void ModFileWriter::PutSymbol(
|
||||||
[&](const CommonBlockDetails &x) {
|
[&](const CommonBlockDetails &x) {
|
||||||
decls_ << "common/" << symbol.name();
|
decls_ << "common/" << symbol.name();
|
||||||
char sep = '/';
|
char sep = '/';
|
||||||
for (const auto *object : x.objects()) {
|
for (const Symbol &object : x.objects()) {
|
||||||
decls_ << sep << DEREF(object).name();
|
decls_ << sep << object.name();
|
||||||
sep = ',';
|
sep = ',';
|
||||||
}
|
}
|
||||||
decls_ << '\n';
|
decls_ << '\n';
|
||||||
|
@ -889,8 +889,8 @@ void SubprogramSymbolCollector::DoSymbol(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[this](const CommonBlockDetails &details) {
|
[this](const CommonBlockDetails &details) {
|
||||||
for (const Symbol *object : details.objects()) {
|
for (const Symbol &object : details.objects()) {
|
||||||
DoSymbol(*object);
|
DoSymbol(object);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[](const auto &) {},
|
[](const auto &) {},
|
||||||
|
|
|
@ -1105,7 +1105,7 @@ private:
|
||||||
static constexpr Symbol::Flags ompFlagsRequireMark{
|
static constexpr Symbol::Flags ompFlagsRequireMark{
|
||||||
Symbol::Flag::OmpThreadprivate};
|
Symbol::Flag::OmpThreadprivate};
|
||||||
|
|
||||||
void AddDataSharingAttributeObject(const Symbol *object) {
|
void AddDataSharingAttributeObject(SymbolRef object) {
|
||||||
dataSharingAttributeObjects_.insert(object);
|
dataSharingAttributeObjects_.insert(object);
|
||||||
}
|
}
|
||||||
void ClearDataSharingAttributeObjects() {
|
void ClearDataSharingAttributeObjects() {
|
||||||
|
@ -1126,11 +1126,11 @@ private:
|
||||||
void CheckMultipleAppearances(
|
void CheckMultipleAppearances(
|
||||||
const parser::Name &, const Symbol &, Symbol::Flag);
|
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) {
|
bool OmpVisitor::HasDataSharingAttributeObject(const Symbol &object) {
|
||||||
auto it{dataSharingAttributeObjects_.find(&object)};
|
auto it{dataSharingAttributeObjects_.find(object)};
|
||||||
return it != dataSharingAttributeObjects_.end();
|
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
|
// 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
|
// same meaning as if every explicit member of the common block
|
||||||
// appeared in the list
|
// appeared in the list
|
||||||
for (Symbol *object :
|
for (const Symbol &object :
|
||||||
symbol->get<CommonBlockDetails>().objects()) {
|
symbol->get<CommonBlockDetails>().objects()) {
|
||||||
ResolveOmp(*object, ompFlag);
|
Symbol &mutableObject{const_cast<Symbol &>(object)};
|
||||||
|
ResolveOmp(mutableObject, ompFlag);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Say(name.source, // 2.15.3
|
Say(name.source, // 2.15.3
|
||||||
|
@ -1288,7 +1289,7 @@ void OmpVisitor::CheckMultipleAppearances(
|
||||||
"on the same OpenMP directive"_err_en_US,
|
"on the same OpenMP directive"_err_en_US,
|
||||||
name.ToString());
|
name.ToString());
|
||||||
} else {
|
} else {
|
||||||
AddDataSharingAttributeObject(target);
|
AddDataSharingAttributeObject(*target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1867,10 +1868,10 @@ void ScopeHandler::SayLocalMustBeVariable(
|
||||||
|
|
||||||
void ScopeHandler::SayDerivedType(
|
void ScopeHandler::SayDerivedType(
|
||||||
const SourceName &name, MessageFixedText &&msg, const Scope &type) {
|
const SourceName &name, MessageFixedText &&msg, const Scope &type) {
|
||||||
const Symbol *typeSymbol{type.GetSymbol()};
|
const Symbol &typeSymbol{DEREF(type.GetSymbol())};
|
||||||
Say(name, std::move(msg), name, DEREF(typeSymbol).name())
|
Say(name, std::move(msg), name, typeSymbol.name())
|
||||||
.Attach(typeSymbol->name(), "Declaration of derived type '%s'"_en_US,
|
.Attach(typeSymbol.name(), "Declaration of derived type '%s'"_en_US,
|
||||||
typeSymbol->name());
|
typeSymbol.name());
|
||||||
}
|
}
|
||||||
void ScopeHandler::Say2(const SourceName &name1, MessageFixedText &&msg1,
|
void ScopeHandler::Say2(const SourceName &name1, MessageFixedText &&msg1,
|
||||||
const SourceName &name2, MessageFixedText &&msg2) {
|
const SourceName &name2, MessageFixedText &&msg2) {
|
||||||
|
@ -4184,8 +4185,9 @@ void DeclarationVisitor::CheckSaveStmts() {
|
||||||
" common block name '%s'"_err_en_US);
|
" common block name '%s'"_err_en_US);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Symbol *object : symbol->get<CommonBlockDetails>().objects()) {
|
for (const Symbol &object :
|
||||||
SetSaveAttr(*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) {
|
[&](const CommonBlockDetails &x) {
|
||||||
os << ':';
|
os << ':';
|
||||||
for (const auto *object : x.objects()) {
|
for (const Symbol &object : x.objects()) {
|
||||||
os << ' ' << object->name();
|
os << ' ' << object.name();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[&](const FinalProcDetails &) {},
|
[&](const FinalProcDetails &) {},
|
||||||
|
|
|
@ -263,11 +263,11 @@ private:
|
||||||
|
|
||||||
class ProcBindingDetails : public WithPassArg {
|
class ProcBindingDetails : public WithPassArg {
|
||||||
public:
|
public:
|
||||||
explicit ProcBindingDetails(const Symbol &symbol) : symbol_{&symbol} {}
|
explicit ProcBindingDetails(const Symbol &symbol) : symbol_{symbol} {}
|
||||||
const Symbol &symbol() const { return *symbol_; }
|
const Symbol &symbol() const { return symbol_; }
|
||||||
|
|
||||||
private:
|
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
|
ENUM_CLASS(GenericKind, // Kinds of generic-spec
|
||||||
|
@ -304,14 +304,13 @@ private:
|
||||||
|
|
||||||
class CommonBlockDetails {
|
class CommonBlockDetails {
|
||||||
public:
|
public:
|
||||||
std::list<Symbol *> &objects() { return objects_; }
|
const SymbolVector &objects() const { return objects_; }
|
||||||
const std::list<Symbol *> &objects() const { return objects_; }
|
void add_object(const Symbol &object) { objects_.emplace_back(object); }
|
||||||
void add_object(Symbol &object) { objects_.push_back(&object); }
|
|
||||||
MaybeExpr bindName() const { return bindName_; }
|
MaybeExpr bindName() const { return bindName_; }
|
||||||
void set_bindName(MaybeExpr &&expr) { bindName_ = std::move(expr); }
|
void set_bindName(MaybeExpr &&expr) { bindName_ = std::move(expr); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<Symbol *> objects_;
|
SymbolVector objects_;
|
||||||
MaybeExpr bindName_;
|
MaybeExpr bindName_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -352,14 +351,14 @@ private:
|
||||||
class UseDetails {
|
class UseDetails {
|
||||||
public:
|
public:
|
||||||
UseDetails(const SourceName &location, const Symbol &symbol)
|
UseDetails(const SourceName &location, const Symbol &symbol)
|
||||||
: location_{location}, symbol_{&symbol} {}
|
: location_{location}, symbol_{symbol} {}
|
||||||
const SourceName &location() const { return location_; }
|
const SourceName &location() const { return location_; }
|
||||||
const Symbol &symbol() const { return *symbol_; }
|
const Symbol &symbol() const { return symbol_; }
|
||||||
const Symbol &module() const;
|
const Symbol &module() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SourceName location_;
|
SourceName location_;
|
||||||
const Symbol *symbol_;
|
SymbolRef symbol_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A symbol with ambiguous use-associations. Record where they were so
|
// A symbol with ambiguous use-associations. Record where they were so
|
||||||
|
@ -378,11 +377,11 @@ private:
|
||||||
// A symbol host-associated from an enclosing scope.
|
// A symbol host-associated from an enclosing scope.
|
||||||
class HostAssocDetails {
|
class HostAssocDetails {
|
||||||
public:
|
public:
|
||||||
HostAssocDetails(const Symbol &symbol) : symbol_{&symbol} {}
|
HostAssocDetails(const Symbol &symbol) : symbol_{symbol} {}
|
||||||
const Symbol &symbol() const { return *symbol_; }
|
const Symbol &symbol() const { return symbol_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Symbol *symbol_;
|
SymbolRef symbol_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GenericDetails {
|
class GenericDetails {
|
||||||
|
|
|
@ -88,7 +88,7 @@ bool IsGenericDefinedOp(const Symbol &symbol) {
|
||||||
|
|
||||||
bool IsCommonBlockContaining(const Symbol &block, const Symbol &object) {
|
bool IsCommonBlockContaining(const Symbol &block, const Symbol &object) {
|
||||||
const auto &objects{block.get<CommonBlockDetails>().objects()};
|
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();
|
return found != objects.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue