Skip to content

Commit

Permalink
[flang][NFC] Reformat files with current clang-format
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D85489
  • Loading branch information
klausler committed Aug 7, 2020
1 parent 7764b52 commit 0e9e06a
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 40 deletions.
4 changes: 2 additions & 2 deletions flang/include/flang/Common/indirection.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ template <typename A, bool COPY = false> class Indirection {
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)...)};
}

Expand Down Expand Up @@ -112,7 +112,7 @@ template <typename A> class Indirection<A, true> {
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)...)};
}

Expand Down
8 changes: 4 additions & 4 deletions flang/include/flang/Common/template.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)...));
Expand Down Expand Up @@ -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)...));
}

Expand All @@ -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)...);
}

Expand Down
4 changes: 2 additions & 2 deletions flang/include/flang/Evaluate/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ class Operation {

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); }
Expand Down
2 changes: 1 addition & 1 deletion flang/include/flang/Evaluate/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion flang/include/flang/Evaluate/traverse.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ template <typename Visitor, typename Result> class Traverse {
}

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 {
Expand Down
12 changes: 6 additions & 6 deletions flang/include/flang/Parser/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))...);
}
Expand Down Expand Up @@ -166,7 +166,7 @@ class Message : public common::ReferenceCounted<Message> {
: 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)...}} {}

Expand All @@ -179,7 +179,7 @@ class Message : public common::ReferenceCounted<Message> {
}
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
}

Expand Down Expand Up @@ -234,7 +234,7 @@ class Messages {
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_;
}
Expand Down Expand Up @@ -298,15 +298,15 @@ class ContextualMessages {
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 {
return nullptr;
}
}

template <typename... A> Message *Say(A &&... args) {
template <typename... A> Message *Say(A &&...args) {
return Say(at_, std::forward<A>(args)...);
}

Expand Down
7 changes: 3 additions & 4 deletions flang/include/flang/Parser/parse-state.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,18 @@ class ParseState {
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)...);
}

Expand Down
2 changes: 1 addition & 1 deletion flang/include/flang/Parser/parse-tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions flang/include/flang/Semantics/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ class ExpressionAnalyzer {
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)...);
}

Expand Down
6 changes: 3 additions & 3 deletions flang/include/flang/Semantics/semantics.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,20 @@ class SemanticsContext {
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) {
return messages_.Say(std::move(msg));
}
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);
}
Expand Down
4 changes: 2 additions & 2 deletions flang/lib/Evaluate/intrinsics-library-templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)};
Expand Down
4 changes: 2 additions & 2 deletions flang/lib/Parser/basic-parsers.h
Original file line number Diff line number Diff line change
Expand Up @@ -636,14 +636,14 @@ class ApplyFunction {

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...};
}
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Parser/prescan.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Prescanner {
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));
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Semantics/assignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AssignmentContext {
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() {
Expand Down
4 changes: 2 additions & 2 deletions flang/lib/Semantics/check-declarations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class CheckHelper {
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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Semantics/pointer-assignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand Down
6 changes: 3 additions & 3 deletions flang/lib/Semantics/resolve-names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class MessageHandler {
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)...);
}

Expand Down Expand Up @@ -214,12 +214,12 @@ class BaseVisitor {
}
}

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...);
}

Expand Down
2 changes: 1 addition & 1 deletion flang/unittests/Evaluate/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)...);
}
Expand Down
2 changes: 1 addition & 1 deletion flang/unittests/Runtime/external-io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0e9e06a

Please sign in to comment.