[flang][NFC] Reformat files with current clang-format

Differential Revision: https://reviews.llvm.org/D85489
This commit is contained in:
peter klausler 2020-08-06 16:56:14 -07:00
parent 7764b52cbd
commit 0e9e06a6d4
19 changed files with 39 additions and 40 deletions

View File

@ -60,7 +60,7 @@ public:
bool operator==(const Indirection &that) const { return *p_ == *that.p_; }
template <typename... ARGS>
static common::IfNoLvalue<Indirection, ARGS...> Make(ARGS &&... args) {
static common::IfNoLvalue<Indirection, ARGS...> Make(ARGS &&...args) {
return {new A(std::move(args)...)};
}
@ -112,7 +112,7 @@ public:
bool operator==(const Indirection &that) const { return *p_ == *that.p_; }
template <typename... ARGS>
static common::IfNoLvalue<Indirection, ARGS...> Make(ARGS &&... args) {
static common::IfNoLvalue<Indirection, ARGS...> Make(ARGS &&...args) {
return {new A(std::move(args)...)};
}

View File

@ -135,7 +135,7 @@ common::IfNoLvalue<TOV, FROMV> MoveVariant(FROMV &&u) {
// CombineTuples<std::tuple<char, int>, std::tuple<float, double>>
// is std::tuple<char, int, float, double>.
template <typename... TUPLES> struct CombineTuplesHelper {
static decltype(auto) f(TUPLES *... a) {
static decltype(auto) f(TUPLES *...a) {
return std::tuple_cat(std::move(*a)...);
}
using type = decltype(f(static_cast<TUPLES *>(nullptr)...));
@ -265,7 +265,7 @@ std::optional<std::vector<A>> AllElementsPresent(
// i.e., given some number of optional values, return a optional tuple of
// those values that is present only of all of the values were so.
template <typename... A>
std::optional<std::tuple<A...>> AllPresent(std::optional<A> &&... x) {
std::optional<std::tuple<A...>> AllPresent(std::optional<A> &&...x) {
return AllElementsPresent(std::make_tuple(std::move(x)...));
}
@ -276,14 +276,14 @@ std::optional<std::tuple<A...>> AllPresent(std::optional<A> &&... x) {
// run it through JoinOptional to "squash" it.
template <typename R, typename... A>
std::optional<R> MapOptional(
std::function<R(A &&...)> &&f, std::optional<A> &&... x) {
std::function<R(A &&...)> &&f, std::optional<A> &&...x) {
if (auto args{AllPresent(std::move(x)...)}) {
return std::make_optional(std::apply(std::move(f), std::move(*args)));
}
return std::nullopt;
}
template <typename R, typename... A>
std::optional<R> MapOptional(R (*f)(A &&...), std::optional<A> &&... x) {
std::optional<R> MapOptional(R (*f)(A &&...), std::optional<A> &&...x) {
return MapOptional(std::function<R(A && ...)>{f}, std::move(x)...);
}

View File

@ -129,8 +129,8 @@ private:
public:
CLASS_BOILERPLATE(Operation)
explicit Operation(const Expr<OPERANDS> &... x) : operand_{x...} {}
explicit Operation(Expr<OPERANDS> &&... x) : operand_{std::move(x)...} {}
explicit Operation(const Expr<OPERANDS> &...x) : operand_{x...} {}
explicit Operation(Expr<OPERANDS> &&...x) : operand_{std::move(x)...} {}
Derived &derived() { return *static_cast<Derived *>(this); }
const Derived &derived() const { return *static_cast<const Derived *>(this); }

View File

@ -864,7 +864,7 @@ parser::Message *AttachDeclaration(parser::Message &, const Symbol &);
parser::Message *AttachDeclaration(parser::Message *, const Symbol &);
template <typename MESSAGES, typename... A>
parser::Message *SayWithDeclaration(
MESSAGES &messages, const Symbol &symbol, A &&... x) {
MESSAGES &messages, const Symbol &symbol, A &&...x) {
return AttachDeclaration(messages.Say(std::forward<A>(x)...), symbol);
}

View File

@ -241,7 +241,7 @@ private:
}
template <typename A, typename... Bs>
Result Combine(const A &x, const Bs &... ys) const {
Result Combine(const A &x, const Bs &...ys) const {
if constexpr (sizeof...(Bs) == 0) {
return visitor_(x);
} else {

View File

@ -67,7 +67,7 @@ constexpr MessageFixedText operator""_err_en_US(
class MessageFormattedText {
public:
template <typename... A>
MessageFormattedText(const MessageFixedText &text, A &&... x)
MessageFormattedText(const MessageFixedText &text, A &&...x)
: isFatal_{text.isFatal()} {
Format(&text, Convert(std::forward<A>(x))...);
}
@ -166,7 +166,7 @@ public:
: location_{csr}, text_{t} {}
template <typename RANGE, typename A, typename... As>
Message(RANGE r, const MessageFixedText &t, A &&x, As &&... xs)
Message(RANGE r, const MessageFixedText &t, A &&x, As &&...xs)
: location_{r}, text_{MessageFormattedText{
t, std::forward<A>(x), std::forward<As>(xs)...}} {}
@ -179,7 +179,7 @@ public:
}
Message &Attach(Message *);
Message &Attach(std::unique_ptr<Message> &&);
template <typename... A> Message &Attach(A &&... args) {
template <typename... A> Message &Attach(A &&...args) {
return Attach(new Message{std::forward<A>(args)...}); // reference-counted
}
@ -234,7 +234,7 @@ public:
bool empty() const { return messages_.empty(); }
void clear();
template <typename... A> Message &Say(A &&... args) {
template <typename... A> Message &Say(A &&...args) {
last_ = messages_.emplace_after(last_, std::forward<A>(args)...);
return *last_;
}
@ -298,7 +298,7 @@ public:
return common::ScopedSet(messages_, nullptr);
}
template <typename... A> Message *Say(CharBlock at, A &&... args) {
template <typename... A> Message *Say(CharBlock at, A &&...args) {
if (messages_ != nullptr) {
return &messages_->Say(at, std::forward<A>(args)...);
} else {
@ -306,7 +306,7 @@ public:
}
}
template <typename... A> Message *Say(A &&... args) {
template <typename... A> Message *Say(A &&...args) {
return Say(at_, std::forward<A>(args)...);
}

View File

@ -131,19 +131,18 @@ public:
context_ = context_->attachment();
}
template <typename... A> void Say(CharBlock range, A &&... args) {
template <typename... A> void Say(CharBlock range, A &&...args) {
if (deferMessages_) {
anyDeferredMessages_ = true;
} else {
messages_.Say(range, std::forward<A>(args)...).SetContext(context_.get());
}
}
template <typename... A>
void Say(const MessageFixedText &text, A &&... args) {
template <typename... A> void Say(const MessageFixedText &text, A &&...args) {
Say(p_, text, std::forward<A>(args)...);
}
template <typename... A>
void Say(const MessageExpectedText &text, A &&... args) {
void Say(const MessageExpectedText &text, A &&...args) {
Say(p_, text, std::forward<A>(args)...);
}

View File

@ -108,7 +108,7 @@ class ProcedureRef; // forward definition, represents a CALL statement
// is conventionally named "t".
#define TUPLE_CLASS_BOILERPLATE(classname) \
template <typename... Ts, typename = common::NoLvalue<Ts...>> \
classname(Ts &&... args) : t(std::move(args)...) {} \
classname(Ts &&...args) : t(std::move(args)...) {} \
using TupleTrait = std::true_type; \
BOILERPLATE(classname)

View File

@ -115,12 +115,12 @@ public:
return foldingContext_.messages();
}
template <typename... A> parser::Message *Say(A &&... args) {
template <typename... A> parser::Message *Say(A &&...args) {
return GetContextualMessages().Say(std::forward<A>(args)...);
}
template <typename T, typename... A>
parser::Message *SayAt(const T &parsed, A &&... args) {
parser::Message *SayAt(const T &parsed, A &&...args) {
return Say(parser::FindSourceLocation(parsed), std::forward<A>(args)...);
}

View File

@ -133,12 +133,12 @@ public:
bool HasError(const parser::Name &);
void SetError(Symbol &, bool = true);
template <typename... A> parser::Message &Say(A &&... args) {
template <typename... A> parser::Message &Say(A &&...args) {
CHECK(location_);
return messages_.Say(*location_, std::forward<A>(args)...);
}
template <typename... A>
parser::Message &Say(parser::CharBlock at, A &&... args) {
parser::Message &Say(parser::CharBlock at, A &&...args) {
return messages_.Say(at, std::forward<A>(args)...);
}
parser::Message &Say(parser::Message &&msg) {
@ -146,7 +146,7 @@ public:
}
template <typename... A>
void SayWithDecl(const Symbol &symbol, const parser::CharBlock &at,
parser::MessageFixedText &&msg, A &&... args) {
parser::MessageFixedText &&msg, A &&...args) {
auto &message{Say(at, std::move(msg), args...)};
evaluate::AttachDeclaration(&message, symbol);
}

View File

@ -78,7 +78,7 @@ template <int Kind> struct Flusher<Type<TypeCategory::Complex, Kind>> {
template <typename TR, typename... ArgInfo> struct CallableHostWrapper {
static Scalar<TR> scalarCallable(FoldingContext &context,
HostFuncPointer<TR, ArgInfo...> func,
const Scalar<typename ArgInfo::Type> &... x) {
const Scalar<typename ArgInfo::Type> &...x) {
if constexpr (host::HostTypeExists<TR, typename ArgInfo::Type...>()) {
host::HostFloatingPointEnvironment hostFPE;
hostFPE.SetUpHostFloatingPointEnvironment(context);
@ -192,7 +192,7 @@ HostIntrinsicProceduresLibrary::GetHostProcedureWrapper(
if (match) {
return {HostProcedureWrapper<ConstantContainer, TR, TA...>{
[=](FoldingContext &context,
const ConstantContainer<TA> &... args) {
const ConstantContainer<TA> &...args) {
auto callable{FromGenericFunctionPointer<ConstantContainer<TR>,
FoldingContext &, GenericFunctionPointer,
const ConstantContainer<TA> &...>(iter->second.callable)};

View File

@ -636,14 +636,14 @@ private:
template <typename RESULT, typename... PARSER>
inline constexpr auto applyFunction(
ApplicableFunctionPointer<RESULT, PARSER...> f, const PARSER &... parser) {
ApplicableFunctionPointer<RESULT, PARSER...> f, const PARSER &...parser) {
return ApplyFunction<ApplicableFunctionPointer, RESULT, PARSER...>{
f, parser...};
}
template <typename RESULT, typename... PARSER>
inline /* not constexpr */ auto applyLambda(
ApplicableFunctionObject<RESULT, PARSER...> f, const PARSER &... parser) {
ApplicableFunctionObject<RESULT, PARSER...> f, const PARSER &...parser) {
return ApplyFunction<ApplicableFunctionObject, RESULT, PARSER...>{
f, parser...};
}

View File

@ -64,7 +64,7 @@ public:
TokenSequence TokenizePreprocessorDirective();
Provenance GetCurrentProvenance() const { return GetProvenance(at_); }
template <typename... A> Message &Say(A &&... a) {
template <typename... A> Message &Say(A &&...a) {
Message &m{messages_.Say(std::forward<A>(a)...)};
std::optional<ProvenanceRange> range{m.GetProvenanceRange(cooked_)};
CHECK(!range || cooked_.IsValid(*range));

View File

@ -47,7 +47,7 @@ private:
parser::CharBlock rhsSource, bool isPointerAssignment);
void CheckShape(parser::CharBlock, const SomeExpr *);
template <typename... A>
parser::Message *Say(parser::CharBlock at, A &&... args) {
parser::Message *Say(parser::CharBlock at, A &&...args) {
return &context_.Say(at, std::forward<A>(args)...);
}
evaluate::FoldingContext &foldingContext() {

View File

@ -86,7 +86,7 @@ private:
return innermostSymbol_ && IsFunction(*innermostSymbol_);
}
template <typename... A>
void SayWithDeclaration(const Symbol &symbol, A &&... x) {
void SayWithDeclaration(const Symbol &symbol, A &&...x) {
if (parser::Message * msg{messages_.Say(std::forward<A>(x)...)}) {
if (messages_.at().begin() != symbol.name().begin()) {
evaluate::AttachDeclaration(*msg, symbol);
@ -1507,7 +1507,7 @@ bool SubprogramMatchHelper::CheckSameIntent(const Symbol &symbol1,
// Report an error referring to first symbol with declaration of second symbol
template <typename... A>
void SubprogramMatchHelper::Say(const Symbol &symbol1, const Symbol &symbol2,
parser::MessageFixedText &&text, A &&... args) {
parser::MessageFixedText &&text, A &&...args) {
auto &message{context.Say(symbol1.name(), std::move(text), symbol1.name(),
std::forward<A>(args)...)};
evaluate::AttachDeclaration(message, symbol2);

View File

@ -345,7 +345,7 @@ bool PointerAssignmentChecker::LhsOkForUnlimitedPoly() const {
}
template <typename... A>
parser::Message *PointerAssignmentChecker::Say(A &&... x) {
parser::Message *PointerAssignmentChecker::Say(A &&...x) {
auto *msg{context_.messages().Say(std::forward<A>(x)...)};
if (lhs_) {
return evaluate::AttachDeclaration(msg, *lhs_);

View File

@ -118,7 +118,7 @@ public:
Message &Say(const SourceName &, MessageFixedText &&);
// Emit a formatted message associated with a source location.
template <typename... A>
Message &Say(const SourceName &source, MessageFixedText &&msg, A &&... args) {
Message &Say(const SourceName &source, MessageFixedText &&msg, A &&...args) {
return context_->Say(source, std::move(msg), std::forward<A>(args)...);
}
@ -214,12 +214,12 @@ public:
}
}
template <typename... A> Message &Say(A &&... args) {
template <typename... A> Message &Say(A &&...args) {
return messageHandler_.Say(std::forward<A>(args)...);
}
template <typename... A>
Message &Say(
const parser::Name &name, MessageFixedText &&text, const A &... args) {
const parser::Name &name, MessageFixedText &&text, const A &...args) {
return messageHandler_.Say(name.source, std::move(text), args...);
}

View File

@ -69,7 +69,7 @@ struct TestCall {
strings.Save(x.keyword);
return *this;
}
template <typename A, typename... As> TestCall &Push(A &&x, As &&... xs) {
template <typename A, typename... As> TestCall &Push(A &&x, As &&...xs) {
Push(std::move(x));
return Push(std::move(xs)...);
}

View File

@ -137,7 +137,7 @@ void TestSequentialFixedUnformatted() {
// FORM='UNFORMATTED',RECL=8,STATUS='SCRATCH')
auto io{IONAME(BeginOpenNewUnit)(__FILE__, __LINE__)};
IONAME(SetAccess)
(io, "SEQUENTIAL", 10) || (Fail() << "SetAccess(SEQUENTIAL)", 0);
(io, "SEQUENTIAL", 10) || (Fail() << "SetAccess(SEQUENTIAL)", 0);
IONAME(SetAction)
(io, "READWRITE", 9) || (Fail() << "SetAction(READWRITE)", 0);
IONAME(SetForm)