cmake/Source/cmListFileCache.cxx

493 lines
14 KiB
C++
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmListFileCache.h"
#include "cmListFileLexer.h"
2019-11-11 23:01:05 +01:00
#include "cmMessageType.h"
2016-10-30 18:24:19 +01:00
#include "cmMessenger.h"
2017-04-14 19:02:05 +02:00
#include "cmState.h"
2019-11-11 23:01:05 +01:00
#include "cmStateDirectory.h"
#include "cmSystemTools.h"
2016-10-30 18:24:19 +01:00
#include <assert.h>
2018-10-28 12:09:07 +01:00
#include <memory>
2016-10-30 18:24:19 +01:00
#include <sstream>
2019-11-11 23:01:05 +01:00
#include <utility>
2018-08-09 18:06:22 +02:00
cmCommandContext::cmCommandName& cmCommandContext::cmCommandName::operator=(
std::string const& name)
{
this->Original = name;
this->Lower = cmSystemTools::LowerCase(name);
return *this;
}
2013-11-03 12:27:13 +02:00
struct cmListFileParser
{
2019-11-11 23:01:05 +01:00
cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
2016-10-30 18:24:19 +01:00
cmMessenger* messenger, const char* filename);
2013-11-03 12:27:13 +02:00
~cmListFileParser();
2019-11-11 23:01:05 +01:00
cmListFileParser(const cmListFileParser&) = delete;
cmListFileParser& operator=(const cmListFileParser&) = delete;
2016-10-30 18:24:19 +01:00
void IssueFileOpenError(std::string const& text) const;
void IssueError(std::string const& text) const;
2013-11-03 12:27:13 +02:00
bool ParseFile();
bool ParseFunction(const char* name, long line);
2014-08-03 19:52:23 +02:00
bool AddArgument(cmListFileLexer_Token* token,
2013-11-03 12:27:13 +02:00
cmListFileArgument::Delimiter delim);
cmListFile* ListFile;
2016-10-30 18:24:19 +01:00
cmListFileBacktrace Backtrace;
cmMessenger* Messenger;
2013-11-03 12:27:13 +02:00
const char* FileName;
cmListFileLexer* Lexer;
cmListFileFunction Function;
2016-07-09 11:21:54 +02:00
enum
{
SeparationOkay,
SeparationWarning,
SeparationError
} Separation;
2013-11-03 12:27:13 +02:00
};
2019-11-11 23:01:05 +01:00
cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
2016-10-30 18:24:19 +01:00
cmMessenger* messenger,
2016-07-09 11:21:54 +02:00
const char* filename)
: ListFile(lf)
2019-11-11 23:01:05 +01:00
, Backtrace(std::move(lfbt))
2016-10-30 18:24:19 +01:00
, Messenger(messenger)
2016-07-09 11:21:54 +02:00
, FileName(filename)
, Lexer(cmListFileLexer_New())
{
2013-11-03 12:27:13 +02:00
}
2013-11-03 12:27:13 +02:00
cmListFileParser::~cmListFileParser()
{
cmListFileLexer_Delete(this->Lexer);
}
2016-10-30 18:24:19 +01:00
void cmListFileParser::IssueFileOpenError(const std::string& text) const
{
2019-11-11 23:01:05 +01:00
this->Messenger->IssueMessage(MessageType::FATAL_ERROR, text,
this->Backtrace);
2016-10-30 18:24:19 +01:00
}
void cmListFileParser::IssueError(const std::string& text) const
{
cmListFileContext lfc;
lfc.FilePath = this->FileName;
lfc.Line = cmListFileLexer_GetCurrentLine(this->Lexer);
cmListFileBacktrace lfbt = this->Backtrace;
lfbt = lfbt.Push(lfc);
2019-11-11 23:01:05 +01:00
this->Messenger->IssueMessage(MessageType::FATAL_ERROR, text, lfbt);
2016-10-30 18:24:19 +01:00
cmSystemTools::SetFatalErrorOccured();
}
2013-11-03 12:27:13 +02:00
bool cmListFileParser::ParseFile()
{
// Open the file.
2014-08-03 19:52:23 +02:00
cmListFileLexer_BOM bom;
2016-07-09 11:21:54 +02:00
if (!cmListFileLexer_SetFileName(this->Lexer, this->FileName, &bom)) {
2016-10-30 18:24:19 +01:00
this->IssueFileOpenError("cmListFileCache: error can not open file.");
return false;
2016-07-09 11:21:54 +02:00
}
2017-07-20 19:35:53 +02:00
if (bom == cmListFileLexer_BOM_Broken) {
2018-01-26 17:06:56 +01:00
cmListFileLexer_SetFileName(this->Lexer, nullptr, nullptr);
2017-07-20 19:35:53 +02:00
this->IssueFileOpenError("Error while reading Byte-Order-Mark. "
"File not seekable?");
return false;
}
2014-08-03 19:52:23 +02:00
// Verify the Byte-Order-Mark, if any.
2016-07-09 11:21:54 +02:00
if (bom != cmListFileLexer_BOM_None && bom != cmListFileLexer_BOM_UTF8) {
2018-01-26 17:06:56 +01:00
cmListFileLexer_SetFileName(this->Lexer, nullptr, nullptr);
2016-10-30 18:24:19 +01:00
this->IssueFileOpenError(
"File starts with a Byte-Order-Mark that is not UTF-8.");
2014-08-03 19:52:23 +02:00
return false;
2016-07-09 11:21:54 +02:00
}
2014-08-03 19:52:23 +02:00
// Use a simple recursive-descent parser to process the token
// stream.
bool haveNewline = true;
2016-07-09 11:21:54 +02:00
while (cmListFileLexer_Token* token = cmListFileLexer_Scan(this->Lexer)) {
if (token->type == cmListFileLexer_Token_Space) {
} else if (token->type == cmListFileLexer_Token_Newline) {
haveNewline = true;
2016-07-09 11:21:54 +02:00
} else if (token->type == cmListFileLexer_Token_CommentBracket) {
2014-08-03 19:52:23 +02:00
haveNewline = false;
2016-07-09 11:21:54 +02:00
} else if (token->type == cmListFileLexer_Token_Identifier) {
if (haveNewline) {
haveNewline = false;
2016-07-09 11:21:54 +02:00
if (this->ParseFunction(token->text, token->line)) {
2013-11-03 12:27:13 +02:00
this->ListFile->Functions.push_back(this->Function);
2016-07-09 11:21:54 +02:00
} else {
2013-11-03 12:27:13 +02:00
return false;
}
2016-07-09 11:21:54 +02:00
} else {
2015-04-27 22:25:09 +02:00
std::ostringstream error;
2016-10-30 18:24:19 +01:00
error << "Parse error. Expected a newline, got "
2013-11-03 12:27:13 +02:00
<< cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
<< " with text \"" << token->text << "\".";
2016-10-30 18:24:19 +01:00
this->IssueError(error.str());
2013-11-03 12:27:13 +02:00
return false;
}
2016-07-09 11:21:54 +02:00
} else {
2015-04-27 22:25:09 +02:00
std::ostringstream error;
2016-10-30 18:24:19 +01:00
error << "Parse error. Expected a command name, got "
2013-11-03 12:27:13 +02:00
<< cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
2016-07-09 11:21:54 +02:00
<< " with text \"" << token->text << "\".";
2016-10-30 18:24:19 +01:00
this->IssueError(error.str());
2013-11-03 12:27:13 +02:00
return false;
}
2016-07-09 11:21:54 +02:00
}
2013-11-03 12:27:13 +02:00
return true;
}
2016-10-30 18:24:19 +01:00
bool cmListFile::ParseFile(const char* filename, cmMessenger* messenger,
cmListFileBacktrace const& lfbt)
2013-11-03 12:27:13 +02:00
{
2016-07-09 11:21:54 +02:00
if (!cmSystemTools::FileExists(filename) ||
cmSystemTools::FileIsDirectory(filename)) {
2013-11-03 12:27:13 +02:00
return false;
2016-07-09 11:21:54 +02:00
}
2013-11-03 12:27:13 +02:00
bool parseError = false;
{
2016-10-30 18:24:19 +01:00
cmListFileParser parser(this, lfbt, messenger, filename);
2016-07-09 11:21:54 +02:00
parseError = !parser.ParseFile();
2013-11-03 12:27:13 +02:00
}
2016-10-30 18:24:19 +01:00
return !parseError;
}
2013-11-03 12:27:13 +02:00
bool cmListFileParser::ParseFunction(const char* name, long line)
{
2016-07-09 11:21:54 +02:00
// Ininitialize a new function call.
2013-11-03 12:27:13 +02:00
this->Function = cmListFileFunction();
this->Function.Name = name;
this->Function.Line = line;
// Command name has already been parsed. Read the left paren.
cmListFileLexer_Token* token;
2016-07-09 11:21:54 +02:00
while ((token = cmListFileLexer_Scan(this->Lexer)) &&
token->type == cmListFileLexer_Token_Space) {
}
if (!token) {
2015-04-27 22:25:09 +02:00
std::ostringstream error;
2016-07-09 11:21:54 +02:00
/* clang-format off */
2016-10-30 18:24:19 +01:00
error << "Unexpected end of file.\n"
<< "Parse error. Function missing opening \"(\".";
2016-07-09 11:21:54 +02:00
/* clang-format on */
2016-10-30 18:24:19 +01:00
this->IssueError(error.str());
return false;
2016-07-09 11:21:54 +02:00
}
if (token->type != cmListFileLexer_Token_ParenLeft) {
2015-04-27 22:25:09 +02:00
std::ostringstream error;
2016-10-30 18:24:19 +01:00
error << "Parse error. Expected \"(\", got "
2013-11-03 12:27:13 +02:00
<< cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
<< " with text \"" << token->text << "\".";
2016-10-30 18:24:19 +01:00
this->IssueError(error.str());
return false;
2016-07-09 11:21:54 +02:00
}
// Arguments.
unsigned long parenDepth = 0;
2013-11-03 12:27:13 +02:00
this->Separation = SeparationOkay;
2019-11-11 23:01:05 +01:00
while ((token = cmListFileLexer_Scan(this->Lexer))) {
2016-07-09 11:21:54 +02:00
if (token->type == cmListFileLexer_Token_Space ||
token->type == cmListFileLexer_Token_Newline) {
2013-11-03 12:27:13 +02:00
this->Separation = SeparationOkay;
continue;
2016-07-09 11:21:54 +02:00
}
if (token->type == cmListFileLexer_Token_ParenLeft) {
parenDepth++;
2013-11-03 12:27:13 +02:00
this->Separation = SeparationOkay;
2016-07-09 11:21:54 +02:00
if (!this->AddArgument(token, cmListFileArgument::Unquoted)) {
2014-08-03 19:52:23 +02:00
return false;
}
2016-07-09 11:21:54 +02:00
} else if (token->type == cmListFileLexer_Token_ParenRight) {
if (parenDepth == 0) {
return true;
2016-07-09 11:21:54 +02:00
}
parenDepth--;
2013-11-03 12:27:13 +02:00
this->Separation = SeparationOkay;
2016-07-09 11:21:54 +02:00
if (!this->AddArgument(token, cmListFileArgument::Unquoted)) {
2014-08-03 19:52:23 +02:00
return false;
}
2013-11-03 12:27:13 +02:00
this->Separation = SeparationWarning;
2016-07-09 11:21:54 +02:00
} else if (token->type == cmListFileLexer_Token_Identifier ||
token->type == cmListFileLexer_Token_ArgumentUnquoted) {
if (!this->AddArgument(token, cmListFileArgument::Unquoted)) {
2014-08-03 19:52:23 +02:00
return false;
2016-07-09 11:21:54 +02:00
}
2013-11-03 12:27:13 +02:00
this->Separation = SeparationWarning;
2016-07-09 11:21:54 +02:00
} else if (token->type == cmListFileLexer_Token_ArgumentQuoted) {
if (!this->AddArgument(token, cmListFileArgument::Quoted)) {
return false;
}
2016-07-09 11:21:54 +02:00
this->Separation = SeparationWarning;
} else if (token->type == cmListFileLexer_Token_ArgumentBracket) {
if (!this->AddArgument(token, cmListFileArgument::Bracket)) {
2014-08-03 19:52:23 +02:00
return false;
}
this->Separation = SeparationError;
2016-07-09 11:21:54 +02:00
} else if (token->type == cmListFileLexer_Token_CommentBracket) {
this->Separation = SeparationError;
} else {
// Error.
2015-04-27 22:25:09 +02:00
std::ostringstream error;
2016-10-30 18:24:19 +01:00
error << "Parse error. Function missing ending \")\". "
<< "Instead found "
2013-11-03 12:27:13 +02:00
<< cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
<< " with text \"" << token->text << "\".";
2016-10-30 18:24:19 +01:00
this->IssueError(error.str());
return false;
}
2016-07-09 11:21:54 +02:00
}
2015-04-27 22:25:09 +02:00
std::ostringstream error;
2016-10-30 18:24:19 +01:00
cmListFileContext lfc;
lfc.FilePath = this->FileName;
2019-11-11 23:01:05 +01:00
lfc.Line = line;
2016-10-30 18:24:19 +01:00
cmListFileBacktrace lfbt = this->Backtrace;
lfbt = lfbt.Push(lfc);
error << "Parse error. Function missing ending \")\". "
<< "End of file reached.";
2019-11-11 23:01:05 +01:00
this->Messenger->IssueMessage(MessageType::FATAL_ERROR, error.str(), lfbt);
return false;
}
2014-08-03 19:52:23 +02:00
bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
2013-11-03 12:27:13 +02:00
cmListFileArgument::Delimiter delim)
{
2018-04-23 21:13:27 +02:00
this->Function.Arguments.emplace_back(token->text, delim, token->line);
2016-07-09 11:21:54 +02:00
if (this->Separation == SeparationOkay) {
2014-08-03 19:52:23 +02:00
return true;
2016-07-09 11:21:54 +02:00
}
2014-08-03 19:52:23 +02:00
bool isError = (this->Separation == SeparationError ||
delim == cmListFileArgument::Bracket);
2015-04-27 22:25:09 +02:00
std::ostringstream m;
2016-10-30 18:24:19 +01:00
cmListFileContext lfc;
lfc.FilePath = this->FileName;
lfc.Line = token->line;
cmListFileBacktrace lfbt = this->Backtrace;
lfbt = lfbt.Push(lfc);
m << "Syntax " << (isError ? "Error" : "Warning") << " in cmake code at "
<< "column " << token->column << "\n"
2013-11-03 12:27:13 +02:00
<< "Argument not separated from preceding token by whitespace.";
2016-07-09 11:21:54 +02:00
/* clang-format on */
if (isError) {
2019-11-11 23:01:05 +01:00
this->Messenger->IssueMessage(MessageType::FATAL_ERROR, m.str(), lfbt);
2014-08-03 19:52:23 +02:00
return false;
2016-07-09 11:21:54 +02:00
}
2019-11-11 23:01:05 +01:00
this->Messenger->IssueMessage(MessageType::AUTHOR_WARNING, m.str(), lfbt);
2016-10-30 18:24:19 +01:00
return true;
2013-11-03 12:27:13 +02:00
}
2018-10-28 12:09:07 +01:00
// We hold either the bottom scope of a directory or a call/file context.
// Discriminate these cases via the parent pointer.
struct cmListFileBacktrace::Entry
2015-12-03 18:43:53 +01:00
{
2018-10-28 12:09:07 +01:00
Entry(cmStateSnapshot bottom)
: Bottom(bottom)
2016-07-09 11:21:54 +02:00
{
}
2018-10-28 12:09:07 +01:00
Entry(std::shared_ptr<Entry const> parent, cmListFileContext lfc)
: Context(std::move(lfc))
, Parent(std::move(parent))
2016-07-09 11:21:54 +02:00
{
}
2018-10-28 12:09:07 +01:00
~Entry()
2016-07-09 11:21:54 +02:00
{
2018-10-28 12:09:07 +01:00
if (this->Parent) {
this->Context.~cmListFileContext();
} else {
this->Bottom.~cmStateSnapshot();
2016-07-09 11:21:54 +02:00
}
}
2018-10-28 12:09:07 +01:00
bool IsBottom() const { return !this->Parent; }
2016-07-09 11:21:54 +02:00
2018-10-28 12:09:07 +01:00
union
{
cmStateSnapshot Bottom;
cmListFileContext Context;
};
std::shared_ptr<Entry const> Parent;
};
2016-07-09 11:21:54 +02:00
2017-07-20 19:35:53 +02:00
cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot const& snapshot)
2018-10-28 12:09:07 +01:00
: TopEntry(std::make_shared<Entry const>(snapshot.GetCallStackBottom()))
2016-07-09 11:21:54 +02:00
{
}
2018-10-28 12:09:07 +01:00
cmListFileBacktrace::cmListFileBacktrace(std::shared_ptr<Entry const> parent,
cmListFileContext const& lfc)
: TopEntry(std::make_shared<Entry const>(std::move(parent), lfc))
2016-07-09 11:21:54 +02:00
{
}
2018-10-28 12:09:07 +01:00
cmListFileBacktrace::cmListFileBacktrace(std::shared_ptr<Entry const> top)
: TopEntry(std::move(top))
2016-07-09 11:21:54 +02:00
{
2015-12-03 18:43:53 +01:00
}
2018-10-28 12:09:07 +01:00
cmStateSnapshot cmListFileBacktrace::GetBottom() const
2015-12-03 18:43:53 +01:00
{
2018-10-28 12:09:07 +01:00
cmStateSnapshot bottom;
if (Entry const* cur = this->TopEntry.get()) {
while (Entry const* parent = cur->Parent.get()) {
cur = parent;
}
bottom = cur->Bottom;
2016-07-09 11:21:54 +02:00
}
2018-10-28 12:09:07 +01:00
return bottom;
2016-07-09 11:21:54 +02:00
}
cmListFileBacktrace cmListFileBacktrace::Push(std::string const& file) const
{
// We are entering a file-level scope but have not yet reached
// any specific line or command invocation within it. This context
// is useful to print when it is at the top but otherwise can be
// skipped during call stack printing.
cmListFileContext lfc;
lfc.FilePath = file;
2018-10-28 12:09:07 +01:00
return this->Push(lfc);
2016-07-09 11:21:54 +02:00
}
cmListFileBacktrace cmListFileBacktrace::Push(
cmListFileContext const& lfc) const
{
2018-10-28 12:09:07 +01:00
assert(this->TopEntry);
assert(!this->TopEntry->IsBottom() || this->TopEntry->Bottom.IsValid());
return cmListFileBacktrace(this->TopEntry, lfc);
2016-07-09 11:21:54 +02:00
}
cmListFileBacktrace cmListFileBacktrace::Pop() const
{
2018-10-28 12:09:07 +01:00
assert(this->TopEntry);
assert(!this->TopEntry->IsBottom());
return cmListFileBacktrace(this->TopEntry->Parent);
2016-07-09 11:21:54 +02:00
}
cmListFileContext const& cmListFileBacktrace::Top() const
{
2018-10-28 12:09:07 +01:00
assert(this->TopEntry);
assert(!this->TopEntry->IsBottom());
return this->TopEntry->Context;
2015-12-03 18:43:53 +01:00
}
2015-11-17 17:22:37 +01:00
void cmListFileBacktrace::PrintTitle(std::ostream& out) const
2015-08-17 11:37:30 +02:00
{
2018-10-28 12:09:07 +01:00
// The title exists only if we have a call on top of the bottom.
if (!this->TopEntry || this->TopEntry->IsBottom()) {
2015-04-27 22:25:09 +02:00
return;
2016-07-09 11:21:54 +02:00
}
2018-10-28 12:09:07 +01:00
cmListFileContext lfc = this->TopEntry->Context;
cmStateSnapshot bottom = this->GetBottom();
if (!bottom.GetState()->GetIsInTryCompile()) {
2019-11-11 23:01:05 +01:00
lfc.FilePath = bottom.GetDirectory().ConvertToRelPathIfNotContained(
2018-10-28 12:09:07 +01:00
bottom.GetState()->GetSourceDirectory(), lfc.FilePath);
2016-07-09 11:21:54 +02:00
}
2015-11-17 17:22:37 +01:00
out << (lfc.Line ? " at " : " in ") << lfc;
2015-04-27 22:25:09 +02:00
}
2015-11-17 17:22:37 +01:00
void cmListFileBacktrace::PrintCallStack(std::ostream& out) const
2015-08-17 11:37:30 +02:00
{
2018-10-28 12:09:07 +01:00
// The call stack exists only if we have at least two calls on top
// of the bottom.
if (!this->TopEntry || this->TopEntry->IsBottom() ||
this->TopEntry->Parent->IsBottom()) {
2015-08-17 11:37:30 +02:00
return;
2016-07-09 11:21:54 +02:00
}
bool first = true;
2018-10-28 12:09:07 +01:00
cmStateSnapshot bottom = this->GetBottom();
for (Entry const* cur = this->TopEntry->Parent.get(); !cur->IsBottom();
cur = cur->Parent.get()) {
if (cur->Context.Name.empty()) {
2016-07-09 11:21:54 +02:00
// Skip this whole-file scope. When we get here we already will
// have printed a more-specific context within the file.
continue;
2015-08-17 11:37:30 +02:00
}
2016-07-09 11:21:54 +02:00
if (first) {
first = false;
out << "Call Stack (most recent call first):\n";
2015-08-17 11:37:30 +02:00
}
2018-10-28 12:09:07 +01:00
cmListFileContext lfc = cur->Context;
if (!bottom.GetState()->GetIsInTryCompile()) {
2019-11-11 23:01:05 +01:00
lfc.FilePath = bottom.GetDirectory().ConvertToRelPathIfNotContained(
2018-10-28 12:09:07 +01:00
bottom.GetState()->GetSourceDirectory(), lfc.FilePath);
2015-08-17 11:37:30 +02:00
}
2016-07-09 11:21:54 +02:00
out << " " << lfc << "\n";
}
2015-08-17 11:37:30 +02:00
}
2015-04-27 22:25:09 +02:00
2018-04-23 21:13:27 +02:00
size_t cmListFileBacktrace::Depth() const
{
size_t depth = 0;
2018-10-28 12:09:07 +01:00
if (Entry const* cur = this->TopEntry.get()) {
for (; !cur->IsBottom(); cur = cur->Parent.get()) {
++depth;
}
2018-04-23 21:13:27 +02:00
}
return depth;
}
2018-10-28 12:09:07 +01:00
bool cmListFileBacktrace::Empty() const
{
return !this->TopEntry || this->TopEntry->IsBottom();
}
std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)
{
os << lfc.FilePath;
2016-07-09 11:21:54 +02:00
if (lfc.Line) {
os << ":" << lfc.Line;
2016-07-09 11:21:54 +02:00
if (!lfc.Name.empty()) {
os << " (" << lfc.Name << ")";
}
2016-07-09 11:21:54 +02:00
}
return os;
}
2015-08-17 11:37:30 +02:00
bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs)
{
2016-07-09 11:21:54 +02:00
if (lhs.Line != rhs.Line) {
2015-08-17 11:37:30 +02:00
return lhs.Line < rhs.Line;
2016-07-09 11:21:54 +02:00
}
2015-08-17 11:37:30 +02:00
return lhs.FilePath < rhs.FilePath;
}
bool operator==(const cmListFileContext& lhs, const cmListFileContext& rhs)
{
return lhs.Line == rhs.Line && lhs.FilePath == rhs.FilePath;
}
bool operator!=(const cmListFileContext& lhs, const cmListFileContext& rhs)
{
return !(lhs == rhs);
}
2019-11-11 23:01:05 +01:00
std::ostream& operator<<(std::ostream& os, BT<std::string> const& s)
{
return os << s.Value;
}
std::vector<BT<std::string>> ExpandListWithBacktrace(
std::string const& list, cmListFileBacktrace const& bt)
{
std::vector<BT<std::string>> result;
std::vector<std::string> tmp;
cmSystemTools::ExpandListArgument(list, tmp);
result.reserve(tmp.size());
for (std::string& i : tmp) {
result.emplace_back(std::move(i), bt);
}
return result;
}