diff options
author | Brad King <brad.king@kitware.com> | 2020-02-10 18:34:33 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-02-10 21:11:38 (GMT) |
commit | e75632843480aefc303303b85350ecddcc57cc5e (patch) | |
tree | e7927962f08b2817b93a6bb945a8238acd0bdfef /Source/cmComputeLinkDepends.cxx | |
parent | 44b8937b7614560d9e88d25456c8394b4b209d51 (diff) | |
download | CMake-e75632843480aefc303303b85350ecddcc57cc5e.zip CMake-e75632843480aefc303303b85350ecddcc57cc5e.tar.gz CMake-e75632843480aefc303303b85350ecddcc57cc5e.tar.bz2 |
Propagate backtraces from LINK_LIBRARIES through to link line items
Since commit d4d0dd0f6a (cmLinkLineComputer: Add ComputeLinkLibs
overload with backtraces, 2019-09-13, v3.16.0-rc1~87^2~4), backtraces
have been collected by `ComputeLinkLibs` by looking back through the
link implementation libraries for one matching the text of the link line
item. This is slow in projects with long link lines.
Instead, teach `cmComputeLinkDepends` and `cmComputeLinkInformation` to
carry backtrace information explicitly along with the text of each item.
Fixes: #20322
Diffstat (limited to 'Source/cmComputeLinkDepends.cxx')
-rw-r--r-- | Source/cmComputeLinkDepends.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 7a9e2b7..ccef9c8 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -301,11 +301,11 @@ int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item) // Initialize the item entry. int index = lei->second; LinkEntry& entry = this->EntryList[index]; - entry.Item = item.AsStr(); + entry.Item = BT<std::string>(item.AsStr(), item.Backtrace); entry.Target = item.Target; - entry.IsFlag = - (!entry.Target && entry.Item[0] == '-' && entry.Item[1] != 'l' && - entry.Item.substr(0, 10) != "-framework"); + entry.IsFlag = (!entry.Target && entry.Item.Value[0] == '-' && + entry.Item.Value[1] != 'l' && + entry.Item.Value.substr(0, 10) != "-framework"); // If the item has dependencies queue it to follow them. if (entry.Target) { @@ -314,7 +314,7 @@ int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item) this->BFSQueue.push(qe); } else { // Look for an old-style <item>_LIB_DEPENDS variable. - std::string var = cmStrCat(entry.Item, "_LIB_DEPENDS"); + std::string var = cmStrCat(entry.Item.Value, "_LIB_DEPENDS"); if (const char* val = this->Makefile->GetDefinition(var)) { // The item dependencies are known. Follow them. BFSEntry qe = { index, val }; @@ -396,7 +396,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) // Initialize the item entry. LinkEntry& entry = this->EntryList[lei->second]; - entry.Item = dep.Item.AsStr(); + entry.Item = BT<std::string>(dep.Item.AsStr(), dep.Item.Backtrace); entry.Target = dep.Item.Target; // This item was added specifically because it is a dependent @@ -671,7 +671,8 @@ void cmComputeLinkDepends::DisplayComponents() fprintf(stderr, "Component (%u):\n", c); NodeList const& nl = components[c]; for (int i : nl) { - fprintf(stderr, " item %d [%s]\n", i, this->EntryList[i].Item.c_str()); + fprintf(stderr, " item %d [%s]\n", i, + this->EntryList[i].Item.Value.c_str()); } EdgeList const& ol = this->CCG->GetComponentGraphEdges(c); for (cmGraphEdge const& oi : ol) { @@ -819,7 +820,7 @@ void cmComputeLinkDepends::DisplayFinalEntries() if (lei.Target) { fprintf(stderr, " target [%s]\n", lei.Target->GetName().c_str()); } else { - fprintf(stderr, " item [%s]\n", lei.Item.c_str()); + fprintf(stderr, " item [%s]\n", lei.Item.Value.c_str()); } } fprintf(stderr, "\n"); |