diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2022-02-06 15:46:33 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2022-02-25 10:08:17 (GMT) |
commit | 01ff75b2ff90cc5cd3db509e24d5691a2a7815e7 (patch) | |
tree | 2d0a39eb6488aa6c3eb4f3e75f4632719bd486b8 | |
parent | c515ac41ee5a7249b9816d2cceb36cebf828a7f7 (diff) | |
download | CMake-01ff75b2ff90cc5cd3db509e24d5691a2a7815e7.zip CMake-01ff75b2ff90cc5cd3db509e24d5691a2a7815e7.tar.gz CMake-01ff75b2ff90cc5cd3db509e24d5691a2a7815e7.tar.bz2 |
cmComputeDepends::LinkEntry: introduce enum to specify item type
-rw-r--r-- | Source/cmComputeLinkDepends.cxx | 16 | ||||
-rw-r--r-- | Source/cmComputeLinkDepends.h | 12 | ||||
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 6 |
3 files changed, 22 insertions, 12 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index d22a4f2..7c8de9e 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -395,9 +395,11 @@ std::pair<int, bool> cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item) LinkEntry& entry = this->EntryList[index]; entry.Item = BT<std::string>(item.AsStr(), item.Backtrace); entry.Target = item.Target; - entry.IsFlag = (!entry.Target && entry.Item.Value[0] == '-' && - entry.Item.Value[1] != 'l' && - entry.Item.Value.substr(0, 10) != "-framework"); + if (!entry.Target && entry.Item.Value[0] == '-' && + entry.Item.Value[1] != 'l' && + entry.Item.Value.substr(0, 10) != "-framework") { + entry.Kind = LinkEntry::Flag; + } // If the item has dependencies queue it to follow them. if (entry.Target) { @@ -411,7 +413,7 @@ std::pair<int, bool> cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item) // The item dependencies are known. Follow them. BFSEntry qe = { index, val->c_str() }; this->BFSQueue.push(qe); - } else if (!entry.IsFlag) { + } else if (entry.Kind != LinkEntry::Flag) { // The item dependencies are not known. We need to infer them. this->InferredDependSets[index].Initialized = true; } @@ -434,7 +436,7 @@ void cmComputeLinkDepends::AddLinkObject(cmLinkItem const& item) int index = lei.first->second; LinkEntry& entry = this->EntryList[index]; entry.Item = BT<std::string>(item.AsStr(), item.Backtrace); - entry.IsObject = true; + entry.Kind = LinkEntry::Object; // Record explicitly linked object files separately. this->ObjectEntries.emplace_back(index); @@ -521,7 +523,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) // This item was added specifically because it is a dependent // shared library. It may get special treatment // in cmComputeLinkInformation. - entry.IsSharedDep = true; + entry.Kind = LinkEntry::SharedDep; } // Get the link entry for this target. @@ -734,7 +736,7 @@ void cmComputeLinkDepends::AddLinkEntries(int depender_index, // items are outside libraries that should not be depending on // targets. if (!this->EntryList[dependee_index].Target && - !this->EntryList[dependee_index].IsFlag && + this->EntryList[dependee_index].Kind != LinkEntry::Flag && dependee_index != dependSet.first) { dependSet.second.insert(dependee_index); } diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 64603e0..3c83f5a 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -49,11 +49,17 @@ public: static const std::string DEFAULT; + enum EntryKind + { + Library, + Object, + SharedDep, + Flag + }; + BT<std::string> Item; cmGeneratorTarget const* Target = nullptr; - bool IsSharedDep = false; - bool IsFlag = false; - bool IsObject = false; + EntryKind Kind = Library; // The following member is for the management of items specified // through genex $<LINK_LIBRARY:...> std::string Feature = std::string(DEFAULT); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 9df2044..fe4491d 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -571,7 +571,7 @@ bool cmComputeLinkInformation::Compute() } } - if (linkEntry.IsSharedDep) { + if (linkEntry.Kind == cmComputeLinkDepends::LinkEntry::SharedDep) { this->AddSharedDepItem(linkEntry); } else { this->AddItem(linkEntry); @@ -1521,7 +1521,9 @@ void cmComputeLinkInformation::AddFullItem(LinkEntry const& entry) item, ItemIsPath::Yes, nullptr, this->FindLibraryFeature( entry.Feature == DEFAULT - ? (entry.IsObject ? "__CMAKE_LINK_OBJECT" : "__CMAKE_LINK_LIBRARY") + ? (entry.Kind == cmComputeLinkDepends::LinkEntry::Object + ? "__CMAKE_LINK_OBJECT" + : "__CMAKE_LINK_LIBRARY") : entry.Feature)); } |