diff options
author | Brad King <brad.king@kitware.com> | 2008-01-29 22:30:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-01-29 22:30:34 (GMT) |
commit | 6066e92ba2a9470e302e29cf0e63fd096245e4f3 (patch) | |
tree | f4bdf227f5aee5401fa17fbdd4be0fdb0155b0cf /Source/cmTarget.cxx | |
parent | b90d3114c5a48eae2c9615a66b4e0f9afc37ff58 (diff) | |
download | CMake-6066e92ba2a9470e302e29cf0e63fd096245e4f3.zip CMake-6066e92ba2a9470e302e29cf0e63fd096245e4f3.tar.gz CMake-6066e92ba2a9470e302e29cf0e63fd096245e4f3.tar.bz2 |
BUG: cmTarget instances should not be copied. Removed pass-by-value arguments from cmLocalVisualStudio7Generator::WriteGroup and cmLocalVisualStudio6Generator::WriteGroup. Updated cmTarget to make this easier to find.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3691c47..706a45f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -25,6 +25,7 @@ #include <set> #include <queue> #include <stdlib.h> // required for atof +#include <assert.h> const char* cmTarget::TargetTypeNames[] = { "EXECUTABLE", "STATIC_LIBRARY", "SHARED_LIBRARY", "MODULE_LIBRARY", "UTILITY", "GLOBAL_TARGET", @@ -42,17 +43,6 @@ cmTarget::cmTarget() } //---------------------------------------------------------------------------- -cmTarget::~cmTarget() -{ - for(std::map<cmStdString, cmComputeLinkInformation*>::iterator - i = this->LinkInformation.begin(); - i != this->LinkInformation.end(); ++i) - { - delete i->second; - } -} - -//---------------------------------------------------------------------------- void cmTarget::DefineProperties(cmake *cm) { cm->DefineProperty @@ -3075,3 +3065,26 @@ cmTarget::GetLinkInformation(const char* config) } return i->second; } + +//---------------------------------------------------------------------------- +cmTargetLinkInformationMap +::cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r): derived() +{ + // Ideally cmTarget instances should never be copied. However until + // we can make a sweep to remove that, this copy constructor avoids + // allowing the resources (LinkInformation) from getting copied. In + // the worst case this will lead to extra cmComputeLinkInformation + // instances. We also enforce in debug mode that the map be emptied + // when copied. + static_cast<void>(r); + assert(r.empty()); +} + +//---------------------------------------------------------------------------- +cmTargetLinkInformationMap::~cmTargetLinkInformationMap() +{ + for(derived::iterator i = this->begin(); i != this->end(); ++i) + { + delete i->second; + } +} |