forked from OSchip/llvm-project
[flang] Remove dead code
Original-commit: flang-compiler/f18@4d90aad361 Reviewed-on: https://github.com/flang-compiler/f18/pull/755 Tree-same-pre-rewrite: false
This commit is contained in:
parent
32f2ea0753
commit
686baf0b0e
|
@ -76,8 +76,9 @@ template bool IsConstantExpr(const Expr<SomeType> &);
|
|||
// data address used to initialize a pointer with "=> x". See C765.
|
||||
// The caller is responsible for checking the base object symbol's
|
||||
// characteristics (TARGET, SAVE, &c.) since this code can't use GetUltimate().
|
||||
struct IsInitialDataTargetHelper
|
||||
class IsInitialDataTargetHelper
|
||||
: public AllTraverse<IsInitialDataTargetHelper> {
|
||||
public:
|
||||
using Base = AllTraverse<IsInitialDataTargetHelper>;
|
||||
using Base::operator();
|
||||
IsInitialDataTargetHelper() : Base{*this} {}
|
||||
|
@ -125,6 +126,9 @@ struct IsInitialDataTargetHelper
|
|||
return (*this)(x.left());
|
||||
}
|
||||
bool operator()(const Relational<SomeType> &) const { return false; }
|
||||
|
||||
private:
|
||||
const semantics::Symbol &(*GetUltimate)(const semantics::Symbol &);
|
||||
};
|
||||
|
||||
bool IsInitialDataTarget(const Expr<SomeType> &x) {
|
||||
|
|
|
@ -365,132 +365,5 @@ private:
|
|||
VISITOR &visitor_;
|
||||
};
|
||||
|
||||
template<typename Derived> class ExpressionPredicateHelperBase {
|
||||
private:
|
||||
Derived &derived() { return *static_cast<Derived *>(this); }
|
||||
const Derived &derived() const { return *static_cast<const Derived *>(this); }
|
||||
|
||||
public:
|
||||
template<typename A, bool C>
|
||||
bool operator()(const common::Indirection<A, C> &x) {
|
||||
return derived()(x.value());
|
||||
}
|
||||
template<typename A> bool operator()(const A *x) {
|
||||
if (x != nullptr) {
|
||||
return derived()(*x);
|
||||
} else {
|
||||
return Derived::DefaultResult;
|
||||
}
|
||||
}
|
||||
template<typename A> bool operator()(const std::optional<A> &x) {
|
||||
if (x.has_value()) {
|
||||
return derived()(*x);
|
||||
} else {
|
||||
return Derived::DefaultResult;
|
||||
}
|
||||
}
|
||||
template<typename... A> bool operator()(const std::variant<A...> &u) {
|
||||
return std::visit(derived(), u);
|
||||
}
|
||||
template<typename A> bool operator()(const std::vector<A> &x) {
|
||||
if constexpr (Derived::IsConjunction) {
|
||||
return std::all_of(x.begin(), x.end(), derived());
|
||||
} else {
|
||||
return std::any_of(x.begin(), x.end(), derived());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Derived> struct ExpressionPredicateHelperSumTypeMixins {
|
||||
private:
|
||||
Derived &derived() { return *static_cast<Derived *>(this); }
|
||||
const Derived &derived() const { return *static_cast<const Derived *>(this); }
|
||||
|
||||
public:
|
||||
template<typename T> bool operator()(const ArrayConstructorValue<T> &x) {
|
||||
return derived()(x.u);
|
||||
}
|
||||
template<typename T> bool operator()(const ArrayConstructorValues<T> &x) {
|
||||
if constexpr (Derived::IsConjunction) {
|
||||
return std::all_of(x.begin(), x.end(), *this);
|
||||
} else {
|
||||
return std::any_of(x.begin(), x.end(), *this);
|
||||
}
|
||||
}
|
||||
template<typename T> bool operator()(const ImpliedDo<T> &x) {
|
||||
if constexpr (Derived::IsConjunction) {
|
||||
return derived()(x.lower()) && derived()(x.upper()) &&
|
||||
derived()(x.stride()) && derived()(x.values());
|
||||
} else {
|
||||
return derived()(x.lower()) || derived()(x.upper()) ||
|
||||
derived()(x.stride()) || derived()(x.values());
|
||||
}
|
||||
}
|
||||
bool operator()(const StructureConstructor &x) {
|
||||
if constexpr (Derived::IsConjunction) {
|
||||
return std::all_of(x.begin(), x.end(), *this);
|
||||
} else {
|
||||
return std::any_of(x.begin(), x.end(), *this);
|
||||
}
|
||||
}
|
||||
bool operator()(const StructureConstructorValues::value_type &x) {
|
||||
return derived()(x.second);
|
||||
}
|
||||
template<typename D, typename R, typename O>
|
||||
bool operator()(const Operation<D, R, O> &op) {
|
||||
return derived()(op.left());
|
||||
}
|
||||
template<typename D, typename R, typename LO, typename RO>
|
||||
bool operator()(const Operation<D, R, LO, RO> &op) {
|
||||
return derived()(op.left()) && derived()(op.right());
|
||||
}
|
||||
template<typename T> bool operator()(const Expr<T> &x) {
|
||||
return derived()(x.u);
|
||||
}
|
||||
bool operator()(const Relational<SomeType> &x) { return derived()(x.u); }
|
||||
};
|
||||
|
||||
template<typename Derived> struct ExpressionPredicateHelperVariableMixins {
|
||||
private:
|
||||
Derived &derived() { return *static_cast<Derived *>(this); }
|
||||
const Derived &derived() const { return *static_cast<const Derived *>(this); }
|
||||
|
||||
public:
|
||||
bool operator()(const NamedEntity &x) {
|
||||
if (const Component * component{x.UnwrapComponent()}) {
|
||||
return derived()(*component);
|
||||
} else {
|
||||
return derived()(x.GetFirstSymbol());
|
||||
}
|
||||
}
|
||||
bool operator()(const Triplet &x) {
|
||||
if constexpr (Derived::IsConjunction) {
|
||||
return derived()(x.lower()) && derived()(x.upper()) &&
|
||||
derived()(x.stride());
|
||||
} else {
|
||||
return derived()(x.lower()) || derived()(x.upper()) ||
|
||||
derived()(x.stride());
|
||||
}
|
||||
}
|
||||
bool operator()(const Substring &x) {
|
||||
if constexpr (Derived::IsConjunction) {
|
||||
return derived()(x.parent()) && derived()(x.lower()) &&
|
||||
derived()(x.upper());
|
||||
} else {
|
||||
return derived()(x.parent()) || derived()(x.lower()) ||
|
||||
derived()(x.upper());
|
||||
}
|
||||
}
|
||||
bool operator()(const Subscript &x) { return derived()(x.u); }
|
||||
bool operator()(const DataRef &x) { return derived()(x.u); }
|
||||
bool operator()(const ComplexPart &x) { return derived()(x.complex()); }
|
||||
template<typename T> bool operator()(const Designator<T> &x) {
|
||||
return derived()(x.u);
|
||||
}
|
||||
template<typename T> bool operator()(const Variable<T> &x) {
|
||||
return derived()(x.u);
|
||||
}
|
||||
bool operator()(const DescriptorInquiry &x) { return derived()(x.base()); }
|
||||
};
|
||||
}
|
||||
#endif // FORTRAN_EVALUATE_DESCENDER_H_
|
||||
|
|
Loading…
Reference in New Issue