cmListFileCache: Move cmListFileFunction earlier

This commit is contained in:
Brad King 2022-01-25 08:35:56 -05:00
parent fccdf99c39
commit 3c4fa4c892

View File

@ -70,6 +70,50 @@ struct cmListFileArgument
long Line = 0;
};
class cmListFileFunction
{
public:
cmListFileFunction(std::string name, long line,
std::vector<cmListFileArgument> args)
: Impl{ std::make_shared<Implementation>(std::move(name), line,
std::move(args)) }
{
}
std::string const& OriginalName() const noexcept
{
return this->Impl->Name.Original;
}
std::string const& LowerCaseName() const noexcept
{
return this->Impl->Name.Lower;
}
long Line() const noexcept { return this->Impl->Line; }
std::vector<cmListFileArgument> const& Arguments() const noexcept
{
return this->Impl->Arguments;
}
operator cmCommandContext const&() const noexcept { return *this->Impl; }
private:
struct Implementation : public cmCommandContext
{
Implementation(std::string name, long line,
std::vector<cmListFileArgument> args)
: cmCommandContext{ std::move(name), line }
, Arguments{ std::move(args) }
{
}
std::vector<cmListFileArgument> Arguments;
};
std::shared_ptr<Implementation const> Impl;
};
class cmListFileContext
{
public:
@ -117,50 +161,6 @@ bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs);
bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs);
class cmListFileFunction
{
public:
cmListFileFunction(std::string name, long line,
std::vector<cmListFileArgument> args)
: Impl{ std::make_shared<Implementation>(std::move(name), line,
std::move(args)) }
{
}
std::string const& OriginalName() const noexcept
{
return this->Impl->Name.Original;
}
std::string const& LowerCaseName() const noexcept
{
return this->Impl->Name.Lower;
}
long Line() const noexcept { return this->Impl->Line; }
std::vector<cmListFileArgument> const& Arguments() const noexcept
{
return this->Impl->Arguments;
}
operator cmCommandContext const&() const noexcept { return *this->Impl; }
private:
struct Implementation : public cmCommandContext
{
Implementation(std::string name, long line,
std::vector<cmListFileArgument> args)
: cmCommandContext{ std::move(name), line }
, Arguments{ std::move(args) }
{
}
std::vector<cmListFileArgument> Arguments;
};
std::shared_ptr<Implementation const> Impl;
};
// Represent a backtrace (call stack). Provide value semantics
// but use efficient reference-counting underneath to avoid copies.
class cmListFileBacktrace