[flang] Run clang-format.

Original-commit: flang-compiler/f18@cd52d99f21
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
Tree-same-pre-rewrite: false
This commit is contained in:
peter klausler 2018-02-28 14:53:04 -08:00
parent 601e0acdeb
commit 65ed9e1dae
2 changed files with 20 additions and 20 deletions

View File

@ -88,18 +88,23 @@ template<typename A> struct BadType : std::false_type {};
// in template specialization definitions.
#define CLASS_TRAIT(T) \
namespace class_trait_ns_##T { \
template<typename A> std::true_type test(typename A::T *); \
template<typename A> std::false_type test(...); \
template<typename A> \
template<typename A> std::true_type test(typename A::T *); \
template<typename A> std::false_type test(...); \
template<typename A> \
constexpr bool has_trait{decltype(test<A>(nullptr))::value}; \
template<typename A> \
template<typename A> \
constexpr typename std::enable_if<has_trait<A>, bool>::type \
trait_value() { using U = typename A::T; return U::value; } \
template<typename A> \
trait_value() { \
using U = typename A::T; \
return U::value; \
} \
template<typename A> \
constexpr typename std::enable_if<!has_trait<A>, bool>::type \
trait_value() { return false; } \
trait_value() { \
return false; \
} \
} \
template<typename A> constexpr bool T{class_trait_ns_##T::trait_value<A>()}
template<typename A> constexpr bool T { class_trait_ns_##T::trait_value<A>() }
// Formatting
// TODO: remove when unparser is up and running

View File

@ -21,10 +21,10 @@ namespace parser {
// Default case for visitation of non-class data members (and strings)
template<typename A, typename V>
typename std::enable_if<!std::is_class_v<A> ||
std::is_same_v<std::string, A>>::type
std::is_same_v<std::string, A>>::type
Walk(const A &x, V &visitor) {
if (visitor.Pre(x)) {
visitor.Post(x);
visitor.Post(x);
}
}
@ -64,16 +64,14 @@ void Walk(const std::variant<A...> &x, V &visitor) {
// Trait-determined traversal of empty, tuple, union, and wrapper classes.
template<typename A, typename V>
typename std::enable_if<EmptyTrait<A>>::type
Walk(const A &x, V &visitor) {
typename std::enable_if<EmptyTrait<A>>::type Walk(const A &x, V &visitor) {
if (visitor.Pre(x)) {
visitor.Post(x);
}
}
template<typename A, typename V>
typename std::enable_if<TupleTrait<A>>::type
Walk(const A &x, V &visitor) {
typename std::enable_if<TupleTrait<A>>::type Walk(const A &x, V &visitor) {
if (visitor.Pre(x)) {
Walk(x.t, visitor);
visitor.Post(x);
@ -81,8 +79,7 @@ Walk(const A &x, V &visitor) {
}
template<typename A, typename V>
typename std::enable_if<UnionTrait<A>>::type
Walk(const A &x, V &visitor) {
typename std::enable_if<UnionTrait<A>>::type Walk(const A &x, V &visitor) {
if (visitor.Pre(x)) {
Walk(x.u, visitor);
visitor.Post(x);
@ -90,8 +87,7 @@ Walk(const A &x, V &visitor) {
}
template<typename A, typename V>
typename std::enable_if<WrapperTrait<A>>::type
Walk(const A &x, V &visitor) {
typename std::enable_if<WrapperTrait<A>>::type Walk(const A &x, V &visitor) {
if (visitor.Pre(x)) {
Walk(x.v, visitor);
visitor.Post(x);
@ -150,8 +146,7 @@ void Walk(const CharSelector::LengthAndKind &x, V &visitor) {
visitor.Post(x);
}
}
template<typename V>
void Walk(const CaseValueRange::Range &x, V &visitor) {
template<typename V> void Walk(const CaseValueRange::Range &x, V &visitor) {
if (visitor.Pre(x)) {
Walk(x.lower, visitor);
Walk(x.upper, visitor);