summaryrefslogtreecommitdiffstats
path: root/Source/cmListFileCache.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-12-07 21:26:58 (GMT)
committerBrad King <brad.king@kitware.com>2021-12-08 15:03:48 (GMT)
commit7b677dbb9279a575ec6b5f79daa78acfec241b6a (patch)
treeab5fd2b922892ea90e153e6f3d082b0447ce4588 /Source/cmListFileCache.cxx
parent56dc22d48829860b50a441dcc26de14150ad724c (diff)
downloadCMake-7b677dbb9279a575ec6b5f79daa78acfec241b6a.zip
CMake-7b677dbb9279a575ec6b5f79daa78acfec241b6a.tar.gz
CMake-7b677dbb9279a575ec6b5f79daa78acfec241b6a.tar.bz2
cmListFileBacktrace: Remove unused "bottom" entry
All uses of `GetBottom` by clients have been removed, so drop the method and its supporting infrastructure.
Diffstat (limited to 'Source/cmListFileCache.cxx')
-rw-r--r--Source/cmListFileCache.cxx50
1 files changed, 4 insertions, 46 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 4c434a3..c167db5 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -443,45 +443,19 @@ cm::optional<cmListFileContext> cmListFileParser::CheckNesting() const
return cm::nullopt;
}
-// We hold either the bottom scope of a directory or a call/file context.
-// Discriminate these cases via the parent pointer.
+// We hold a call/file context.
struct cmListFileBacktrace::Entry
{
- Entry(cmStateSnapshot bottom)
- : Bottom(bottom)
- {
- }
-
Entry(std::shared_ptr<Entry const> parent, cmListFileContext lfc)
: Context(std::move(lfc))
, Parent(std::move(parent))
{
}
- ~Entry()
- {
- if (this->Parent) {
- this->Context.~cmListFileContext();
- } else {
- this->Bottom.~cmStateSnapshot();
- }
- }
-
- bool IsBottom() const { return !this->Parent; }
-
- union
- {
- cmStateSnapshot Bottom;
- cmListFileContext Context;
- };
+ cmListFileContext Context;
std::shared_ptr<Entry const> Parent;
};
-cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot const& snapshot)
- : TopEntry(std::make_shared<Entry const>(snapshot.GetCallStackBottom()))
-{
-}
-
/* NOLINTNEXTLINE(performance-unnecessary-value-param) */
cmListFileBacktrace::cmListFileBacktrace(std::shared_ptr<Entry const> parent,
cmListFileContext const& lfc)
@@ -494,18 +468,6 @@ cmListFileBacktrace::cmListFileBacktrace(std::shared_ptr<Entry const> top)
{
}
-cmStateSnapshot cmListFileBacktrace::GetBottom() const
-{
- cmStateSnapshot bottom;
- if (Entry const* cur = this->TopEntry.get()) {
- while (Entry const* parent = cur->Parent.get()) {
- cur = parent;
- }
- bottom = cur->Bottom;
- }
- return bottom;
-}
-
cmListFileBacktrace cmListFileBacktrace::Push(std::string const& file) const
{
// We are entering a file-level scope but have not yet reached
@@ -520,22 +482,18 @@ cmListFileBacktrace cmListFileBacktrace::Push(std::string const& file) const
cmListFileBacktrace cmListFileBacktrace::Push(
cmListFileContext const& lfc) const
{
- assert(this->TopEntry);
- assert(!this->TopEntry->IsBottom() || this->TopEntry->Bottom.IsValid());
return cmListFileBacktrace(this->TopEntry, lfc);
}
cmListFileBacktrace cmListFileBacktrace::Pop() const
{
assert(this->TopEntry);
- assert(!this->TopEntry->IsBottom());
return cmListFileBacktrace(this->TopEntry->Parent);
}
cmListFileContext const& cmListFileBacktrace::Top() const
{
assert(this->TopEntry);
- assert(!this->TopEntry->IsBottom());
return this->TopEntry->Context;
}
@@ -543,7 +501,7 @@ size_t cmListFileBacktrace::Depth() const
{
size_t depth = 0;
if (Entry const* cur = this->TopEntry.get()) {
- for (; !cur->IsBottom(); cur = cur->Parent.get()) {
+ for (; cur; cur = cur->Parent.get()) {
++depth;
}
}
@@ -552,7 +510,7 @@ size_t cmListFileBacktrace::Depth() const
bool cmListFileBacktrace::Empty() const
{
- return !this->TopEntry || this->TopEntry->IsBottom();
+ return !this->TopEntry;
}
std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)