diff options
author | Brad King <brad.king@kitware.com> | 2018-10-17 14:44:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-10-18 12:07:46 (GMT) |
commit | a093b1a4f3c8c40c55c50ad8e701ceb599961140 (patch) | |
tree | 4cd25b87073e83558763b122d2816627e5b55e15 /Source/cmComputeTargetDepends.cxx | |
parent | e022e2d8734ffbc0378b75d85b32a2524302dd50 (diff) | |
download | CMake-a093b1a4f3c8c40c55c50ad8e701ceb599961140.zip CMake-a093b1a4f3c8c40c55c50ad8e701ceb599961140.tar.gz CMake-a093b1a4f3c8c40c55c50ad8e701ceb599961140.tar.bz2 |
cmLinkItem: Add backtrace
Carry a backtrace on every link item, not just link implementation
items. For now the non-impl items will still have empty backtraces at
runtime, but this will allow us to introduce values over time.
Diffstat (limited to 'Source/cmComputeTargetDepends.cxx')
-rw-r--r-- | Source/cmComputeTargetDepends.cxx | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 268e749..28e1251 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -6,6 +6,7 @@ #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmLinkItem.h" +#include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmPolicies.h" @@ -22,8 +23,6 @@ #include <stdio.h> #include <utility> -class cmListFileBacktrace; - /* This class is meant to analyze inter-target dependencies globally @@ -208,7 +207,8 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) for (cmSourceFile const* o : objectFiles) { std::string const& objLib = o->GetObjectLibrary(); if (!objLib.empty()) { - cmLinkItem const& objItem = depender->ResolveLinkItem(objLib); + cmLinkItem const& objItem = + depender->ResolveLinkItem(objLib, cmListFileBacktrace()); if (emitted.insert(objItem).second) { if (depender->GetType() != cmStateEnums::EXECUTABLE && depender->GetType() != cmStateEnums::STATIC_LIBRARY && @@ -230,7 +230,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) cmLinkImplementation const* impl = depender->GetLinkImplementation(it); // A target should not depend on itself. - emitted.insert(cmLinkItem(depender)); + emitted.insert(cmLinkItem(depender, cmListFileBacktrace())); for (cmLinkImplItem const& lib : impl->Libraries) { // Don't emit the same library twice for this target. if (emitted.insert(lib).second) { @@ -246,7 +246,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) std::set<cmLinkItem> const& tutils = depender->GetUtilityItems(); std::set<cmLinkItem> emitted; // A target should not depend on itself. - emitted.insert(cmLinkItem(depender)); + emitted.insert(cmLinkItem(depender, cmListFileBacktrace())); for (cmLinkItem const& litem : tutils) { // Don't emit the same utility twice for this target. if (emitted.insert(litem).second) { @@ -289,7 +289,7 @@ void cmComputeTargetDepends::AddInterfaceDepends( if (dependee) { // A target should not depend on itself. - emitted.insert(cmLinkItem(depender)); + emitted.insert(cmLinkItem(depender, cmListFileBacktrace())); this->AddInterfaceDepends(depender_index, dependee, config, emitted); } } @@ -327,13 +327,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, e << "The dependency target \"" << dependee_name << "\" of target \"" << depender->GetName() << "\" does not exist."; - cmListFileBacktrace const* backtrace = - depender->GetUtilityBacktrace(dependee_name.AsStr()); - if (backtrace) { - cm->IssueMessage(messageType, e.str(), *backtrace); - } else { - cm->IssueMessage(messageType, e.str()); - } + cm->IssueMessage(messageType, e.str(), dependee_name.Backtrace); } } |