[flang] Back out needless macro change that led to clang-format grief

Original-commit: flang-compiler/f18@5a6e55df11
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
This commit is contained in:
peter klausler 2018-10-26 16:31:20 -07:00
parent 8832f8b144
commit 0a56867df9
9 changed files with 83 additions and 78 deletions

View File

@ -60,5 +60,5 @@ Expr<SubscriptInteger> ProcedureRef::LEN() const {
return proc_.LEN();
}
FOR_EACH_SPECIFIC_TYPE(template struct FunctionRef, ;)
FOR_EACH_SPECIFIC_TYPE(template struct FunctionRef)
}

View File

@ -178,14 +178,14 @@ int Expr<SomeDerived>::Rank() const {
// Template instantiations to resolve the "extern template" declarations
// that appear in expression.h.
FOR_EACH_INTRINSIC_KIND(template class Expr, ;)
FOR_EACH_CATEGORY_TYPE(template class Expr, ;)
FOR_EACH_INTEGER_KIND(template struct Relational, ;)
FOR_EACH_REAL_KIND(template struct Relational, ;)
FOR_EACH_CHARACTER_KIND(template struct Relational, ;)
FOR_EACH_INTRINSIC_KIND(template class Expr)
FOR_EACH_CATEGORY_TYPE(template class Expr)
FOR_EACH_INTEGER_KIND(template struct Relational)
FOR_EACH_REAL_KIND(template struct Relational)
FOR_EACH_CHARACTER_KIND(template struct Relational)
template struct Relational<SomeType>;
FOR_EACH_INTRINSIC_KIND(template struct ExpressionBase, ;)
FOR_EACH_CATEGORY_TYPE(template struct ExpressionBase, ;)
FOR_EACH_INTRINSIC_KIND(template struct ExpressionBase)
FOR_EACH_CATEGORY_TYPE(template struct ExpressionBase)
}
// For reclamation of analyzed expressions to which owning pointers have

View File

@ -453,9 +453,9 @@ public:
common::CombineVariants<Operations, Others> u;
};
FOR_EACH_INTEGER_KIND(extern template class Expr, ;)
FOR_EACH_REAL_KIND(extern template class Expr, ;)
FOR_EACH_COMPLEX_KIND(extern template class Expr, ;)
FOR_EACH_INTEGER_KIND(extern template class Expr)
FOR_EACH_REAL_KIND(extern template class Expr)
FOR_EACH_COMPLEX_KIND(extern template class Expr)
template<int KIND>
class Expr<Type<TypeCategory::Character, KIND>>
@ -473,7 +473,7 @@ public:
u;
};
FOR_EACH_CHARACTER_KIND(extern template class Expr, ;)
FOR_EACH_CHARACTER_KIND(extern template class Expr)
// The Relational class template is a helper for constructing logical
// expressions with polymorphism over the cross product of the possible
@ -521,9 +521,9 @@ public:
common::MapTemplate<Relational, DirectlyComparableTypes> u;
};
FOR_EACH_INTEGER_KIND(extern template struct Relational, ;)
FOR_EACH_REAL_KIND(extern template struct Relational, ;)
FOR_EACH_CHARACTER_KIND(extern template struct Relational, ;)
FOR_EACH_INTEGER_KIND(extern template struct Relational)
FOR_EACH_REAL_KIND(extern template struct Relational)
FOR_EACH_CHARACTER_KIND(extern template struct Relational)
extern template struct Relational<SomeType>;
// Logical expressions of a kind bigger than LogicalResult
@ -551,7 +551,7 @@ public:
common::CombineVariants<Operations, Relations, Others> u;
};
FOR_EACH_LOGICAL_KIND(extern template class Expr, ;)
FOR_EACH_LOGICAL_KIND(extern template class Expr)
// A polymorphic expression of known intrinsic type category, but dynamic
// kind, represented as a discriminated union over Expr<Type<CAT, K>>
@ -626,7 +626,7 @@ struct GenericExprWrapper {
Expr<SomeType> v;
};
FOR_EACH_CATEGORY_TYPE(extern template class Expr, ;)
FOR_EACH_TYPE_AND_KIND(extern template struct ExpressionBase, ;)
FOR_EACH_CATEGORY_TYPE(extern template class Expr)
FOR_EACH_TYPE_AND_KIND(extern template struct ExpressionBase)
}
#endif // FORTRAN_EVALUATE_EXPRESSION_H_

View File

@ -439,7 +439,7 @@ Expr<T> FoldHelper<T>::FoldExpr(FoldingContext &context, Expr<T> &&expr) {
std::move(expr.u));
}
FOR_EACH_TYPE_AND_KIND(template struct FoldHelper, ;)
FOR_EACH_TYPE_AND_KIND(template struct FoldHelper)
template<typename T>
std::optional<Constant<T>>
@ -453,5 +453,5 @@ GetScalarConstantValueHelper<T>::GetScalarConstantValue(const Expr<T> &expr) {
}
}
FOR_EACH_INTRINSIC_KIND(template struct GetScalarConstantValueHelper, ;)
} // namespace Fortran::evaluate
FOR_EACH_INTRINSIC_KIND(template struct GetScalarConstantValueHelper)
}

View File

@ -49,7 +49,7 @@ std::optional<Expr<T>> Fold(
}
}
FOR_EACH_TYPE_AND_KIND(extern template struct FoldHelper, ;)
FOR_EACH_TYPE_AND_KIND(extern template struct FoldHelper)
// GetScalarConstantValue() extracts the constant value of an expression,
// when it has one, even if it is parenthesized or optional.
@ -71,7 +71,6 @@ std::optional<Constant<T>> GetScalarConstantValue(
}
}
FOR_EACH_INTRINSIC_KIND(extern template struct GetScalarConstantValueHelper, ;)
} // namespace Fortran::evaluate
FOR_EACH_INTRINSIC_KIND(extern template struct GetScalarConstantValueHelper)
}
#endif // FORTRAN_EVALUATE_FOLD_H_

View File

@ -270,49 +270,52 @@ struct SomeType {
};
// For "[extern] template class", &c. boilerplate
#define FOR_EACH_INTEGER_KIND(PREFIX, SUFFIX) \
PREFIX<Type<TypeCategory::Integer, 1>> SUFFIX \
PREFIX<Type<TypeCategory::Integer, 2>> \
SUFFIX PREFIX<Type<TypeCategory::Integer, 4>> SUFFIX \
PREFIX<Type<TypeCategory::Integer, 8>> \
SUFFIX PREFIX<Type<TypeCategory::Integer, 16>> SUFFIX
#define FOR_EACH_REAL_KIND(PREFIX, SUFFIX) \
PREFIX<Type<TypeCategory::Real, 2>> SUFFIX \
PREFIX<Type<TypeCategory::Real, 4>> \
SUFFIX PREFIX<Type<TypeCategory::Real, 8>> SUFFIX \
PREFIX<Type<TypeCategory::Real, 10>> \
SUFFIX PREFIX<Type<TypeCategory::Real, 16>> SUFFIX
#define FOR_EACH_COMPLEX_KIND(PREFIX, SUFFIX) \
PREFIX<Type<TypeCategory::Complex, 2>> SUFFIX \
PREFIX<Type<TypeCategory::Complex, 4>> \
SUFFIX PREFIX<Type<TypeCategory::Complex, 8>> SUFFIX \
PREFIX<Type<TypeCategory::Complex, 10>> \
SUFFIX PREFIX<Type<TypeCategory::Complex, 16>> SUFFIX
#define FOR_EACH_CHARACTER_KIND(PREFIX, SUFFIX) \
PREFIX<Type<TypeCategory::Character, 1>> SUFFIX \
PREFIX<Type<TypeCategory::Character, 2>> \
SUFFIX PREFIX<Type<TypeCategory::Character, 4>> SUFFIX
#define FOR_EACH_LOGICAL_KIND(PREFIX, SUFFIX) \
PREFIX<Type<TypeCategory::Logical, 1>> \
SUFFIX PREFIX<Type<TypeCategory::Logical, 2>> SUFFIX \
PREFIX<Type<TypeCategory::Logical, 4>> \
SUFFIX PREFIX<Type<TypeCategory::Logical, 8>> SUFFIX
#define FOR_EACH_INTRINSIC_KIND(PREFIX, SUFFIX) \
FOR_EACH_INTEGER_KIND(PREFIX, SUFFIX) \
FOR_EACH_REAL_KIND(PREFIX, SUFFIX) \
FOR_EACH_COMPLEX_KIND(PREFIX, SUFFIX) \
FOR_EACH_CHARACTER_KIND(PREFIX, SUFFIX) \
FOR_EACH_LOGICAL_KIND(PREFIX, SUFFIX)
#define FOR_EACH_SPECIFIC_TYPE(PREFIX, SUFFIX) \
FOR_EACH_INTRINSIC_KIND(PREFIX, SUFFIX) \
PREFIX<SomeDerived> SUFFIX
#define FOR_EACH_CATEGORY_TYPE(PREFIX, SUFFIX) \
PREFIX<SomeInteger> SUFFIX PREFIX<SomeReal> SUFFIX PREFIX<SomeComplex> \
SUFFIX PREFIX<SomeCharacter> SUFFIX PREFIX<SomeLogical> \
SUFFIX PREFIX<SomeType> SUFFIX
#define FOR_EACH_TYPE_AND_KIND(PREFIX, SUFFIX) \
FOR_EACH_SPECIFIC_TYPE(PREFIX, SUFFIX) \
FOR_EACH_CATEGORY_TYPE(PREFIX, SUFFIX)
#define FOR_EACH_INTEGER_KIND(PREFIX) \
PREFIX<Type<TypeCategory::Integer, 1>>; \
PREFIX<Type<TypeCategory::Integer, 2>>; \
PREFIX<Type<TypeCategory::Integer, 4>>; \
PREFIX<Type<TypeCategory::Integer, 8>>; \
PREFIX<Type<TypeCategory::Integer, 16>>;
#define FOR_EACH_REAL_KIND(PREFIX) \
PREFIX<Type<TypeCategory::Real, 2>>; \
PREFIX<Type<TypeCategory::Real, 4>>; \
PREFIX<Type<TypeCategory::Real, 8>>; \
PREFIX<Type<TypeCategory::Real, 10>>; \
PREFIX<Type<TypeCategory::Real, 16>>;
#define FOR_EACH_COMPLEX_KIND(PREFIX) \
PREFIX<Type<TypeCategory::Complex, 2>>; \
PREFIX<Type<TypeCategory::Complex, 4>>; \
PREFIX<Type<TypeCategory::Complex, 8>>; \
PREFIX<Type<TypeCategory::Complex, 10>>; \
PREFIX<Type<TypeCategory::Complex, 16>>;
#define FOR_EACH_CHARACTER_KIND(PREFIX) \
PREFIX<Type<TypeCategory::Character, 1>>; \
PREFIX<Type<TypeCategory::Character, 2>>; \
PREFIX<Type<TypeCategory::Character, 4>>;
#define FOR_EACH_LOGICAL_KIND(PREFIX) \
PREFIX<Type<TypeCategory::Logical, 1>>; \
PREFIX<Type<TypeCategory::Logical, 2>>; \
PREFIX<Type<TypeCategory::Logical, 4>>; \
PREFIX<Type<TypeCategory::Logical, 8>>;
#define FOR_EACH_INTRINSIC_KIND(PREFIX) \
FOR_EACH_INTEGER_KIND(PREFIX) \
FOR_EACH_REAL_KIND(PREFIX) \
FOR_EACH_COMPLEX_KIND(PREFIX) \
FOR_EACH_CHARACTER_KIND(PREFIX) \
FOR_EACH_LOGICAL_KIND(PREFIX)
#define FOR_EACH_SPECIFIC_TYPE(PREFIX) \
FOR_EACH_INTRINSIC_KIND(PREFIX) \
PREFIX<SomeDerived>;
#define FOR_EACH_CATEGORY_TYPE(PREFIX) \
PREFIX<SomeInteger>; \
PREFIX<SomeReal>; \
PREFIX<SomeComplex>; \
PREFIX<SomeCharacter>; \
PREFIX<SomeLogical>; \
PREFIX<SomeType>;
#define FOR_EACH_TYPE_AND_KIND(PREFIX) \
FOR_EACH_SPECIFIC_TYPE(PREFIX) \
FOR_EACH_CATEGORY_TYPE(PREFIX)
// Wraps a constant scalar value of a specific intrinsic type
// in a class with its resolved type.

View File

@ -107,12 +107,15 @@ Expr<SubscriptInteger> Substring::last() const {
if (last_.has_value()) {
return **last_;
} else {
return std::visit([](const auto &x) {
if constexpr (std::is_same_v<DataRef, std::decay_t<decltype(x)>>) {
return x.LEN();
} else {
return AsExpr(Constant<SubscriptInteger>{x.size()});
}}, u_);
return std::visit(
[](const auto &x) {
if constexpr (std::is_same_v<DataRef, std::decay_t<decltype(x)>>) {
return x.LEN();
} else {
return AsExpr(Constant<SubscriptInteger>{x.size()});
}
},
u_);
}
}
@ -472,5 +475,5 @@ std::optional<DynamicType> ProcedureDesignator::GetType() const {
return std::nullopt;
}
FOR_EACH_CHARACTER_KIND(template class Designator, ;)
FOR_EACH_CHARACTER_KIND(template class Designator)
}

View File

@ -286,7 +286,7 @@ public:
Variant u;
};
FOR_EACH_CHARACTER_KIND(extern template class Designator, ;)
FOR_EACH_CHARACTER_KIND(extern template class Designator)
class ProcedureRef {
public:
@ -329,7 +329,7 @@ template<typename A> struct FunctionRef : public ProcedureRef {
std::optional<Constant<Result>> Fold(FoldingContext &); // for intrinsics
};
FOR_EACH_SPECIFIC_TYPE(extern template struct FunctionRef, ;)
FOR_EACH_SPECIFIC_TYPE(extern template struct FunctionRef)
template<typename A> struct Variable {
using Result = A;

View File

@ -42,7 +42,7 @@ ScopedHostFloatingPointEnvironment::ScopedHostFloatingPointEnvironment(
currentFenv_.__mxcsr &= ~0x8000;
}
#else
// TODO others
// TODO others
#endif
errno = 0;
if (fesetenv(&currentFenv_) != 0) {