attachmentIsContext_ = true;
}
Message &Attach(Message *);
- template<typename... A> Message &Attach(A &&... args) {
- return Attach(new Message{std::forward<A>(args)...}); // reference-counted
+ template<typename... A, NO_LVALUE_REFERENCE(A)>
+ Message &Attach(A &&... args) {
+ return Attach(new Message{std::move(args)...}); // reference-counted
}
bool SortBefore(const Message &that) const;
bool empty() const { return messages_.empty(); }
- template<typename... A> Message &Say(A... args) {
- last_ = messages_.emplace_after(last_, std::forward<A>(args)...);
+ template<typename... A, NO_LVALUE_REFERENCE(A)> Message &Say(A... args) {
+ last_ = messages_.emplace_after(last_, std::move(args)...);
return *last_;
}
return common::ScopedSet(at_, std::move(at));
}
- template<typename... A> Message *Say(CharBlock at, A &&... args) {
+ template<typename... A, NO_LVALUE_REFERENCE(A)>
+ Message *Say(CharBlock at, A &&... args) {
if (messages_ != nullptr) {
- return &messages_->Say(at, std::forward<A>(args)...);
+ return &messages_->Say(at, std::move(args)...);
} else {
return nullptr;
}
}
- template<typename... A> Message *Say(A &&... args) {
- return Say(at_, std::forward<A>(args)...);
+ template<typename... A, NO_LVALUE_REFERENCE(A)> Message *Say(A &&... args) {
+ return Say(at_, std::move(args)...);
}
private:
context_ = context_->attachment();
}
- template<typename... A> void Say(CharBlock range, A &&... args) {
+ template<typename... A, NO_LVALUE_REFERENCE(A)>
+ void Say(CharBlock range, A &&... args) {
if (deferMessages_) {
anyDeferredMessages_ = true;
} else {
- messages_.Say(range, std::forward<A>(args)...).SetContext(context_.get());
+ messages_.Say(range, std::move(args)...).SetContext(context_.get());
}
}
- template<typename... A> void Say(const MessageFixedText &text, A &&... args) {
- Say(p_, text, std::forward<A>(args)...);
+ template<typename... A, NO_LVALUE_REFERENCE(A)>
+ void Say(const MessageFixedText &text, A &&... args) {
+ Say(p_, text, std::move(args)...);
}
- template<typename... A>
+ template<typename... A, NO_LVALUE_REFERENCE(A)>
void Say(const MessageExpectedText &text, A &&... args) {
- Say(p_, text, std::forward<A>(args)...);
+ Say(p_, text, std::move(args)...);
}
void Nonstandard(LanguageFeature lf, const MessageFixedText &msg) {
TokenSequence TokenizePreprocessorDirective();
Provenance GetCurrentProvenance() const { return GetProvenance(at_); }
- template<typename... A> Message &Say(A &&... a) {
- Message &m{messages_.Say(std::forward<A>(a)...)};
+ template<typename... A, NO_LVALUE_REFERENCE(A)> Message &Say(A &&... a) {
+ Message &m{messages_.Say(std::move(a)...)};
std::optional<ProvenanceRange> range{m.GetProvenanceRange(cooked_)};
CHECK(!range.has_value() || cooked_.IsValid(*range));
return m;
MaskExpr GetMask(const parser::LogicalExpr &, bool defaultValue = true) const;
- template<typename... A> parser::Message *Say(A &&... args) {
- return messages_.Say(std::forward<A>(args)...);
+ template<typename... A, NO_LVALUE_REFERENCE(A)>
+ parser::Message *Say(A &&... args) {
+ return messages_.Say(std::move(args)...);
}
SemanticsContext &context_;
return GetFoldingContext().messages();
}
- template<typename... A> parser::Message *Say(A &&... args) {
- return GetContextualMessages().Say(std::forward<A>(args)...);
+ template<typename... A, NO_LVALUE_REFERENCE(A)>
+ parser::Message *Say(A &&... args) {
+ return GetContextualMessages().Say(std::move(args)...);
}
- template<typename T, typename... A>
+ template<typename T, typename... A, NO_LVALUE_REFERENCE(A)>
parser::Message *SayAt(const T &parsed, A &&... args) {
- return Say(parser::FindSourceLocation(parsed), std::forward<A>(args)...);
+ return Say(parser::FindSourceLocation(parsed), std::move(args)...);
}
int GetDefaultKind(common::TypeCategory);
}
}
- template<typename... A> Message &Say(const parser::Name &name, A &&... args) {
- return messageHandler_.Say(name.source, std::forward<A>(args)...);
+ template<typename... A, NO_LVALUE_REFERENCE(A)>
+ Message &Say(const parser::Name &name, A &&... args) {
+ return messageHandler_.Say(name.source, std::move(args)...);
}
- template<typename... A> Message &Say(A &&... args) {
- return messageHandler_.Say(std::forward<A>(args)...);
+ template<typename... A, NO_LVALUE_REFERENCE(A)> Message &Say(A &&... args) {
+ return messageHandler_.Say(std::move(args)...);
}
private:
bool AnyFatalError() const;
- template<typename... A>
+ template<typename... A, NO_LVALUE_REFERENCE(A)>
parser::Message &Say(const parser::CharBlock &at, A &&... args) {
- return messages_.Say(at, std::forward<A>(args)...);
+ return messages_.Say(at, std::move(args)...);
}
- template<typename... A> parser::Message &Say(A &&... args) {
+ template<typename... A, NO_LVALUE_REFERENCE(A)>
+ parser::Message &Say(A &&... args) {
CHECK(location_);
- return messages_.Say(*location_, std::forward<A>(args)...);
+ return messages_.Say(*location_, std::move(args)...);
}
parser::Message &Say(parser::Message &&msg) {
return messages_.Say(std::move(msg));