diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-03-11 19:35:50 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-03-12 10:02:22 (GMT) |
commit | ae416a6b5c58f1e897692fcddf3154483782e0bd (patch) | |
tree | 7f6e3bd368123d916908877b8e1cae610cd7593f /Source/cmLocalUnixMakefileGenerator3.cxx | |
parent | 60a407b01c40921bed2fd30336fc09b9ad48e154 (diff) | |
download | CMake-ae416a6b5c58f1e897692fcddf3154483782e0bd.zip CMake-ae416a6b5c58f1e897692fcddf3154483782e0bd.tar.gz CMake-ae416a6b5c58f1e897692fcddf3154483782e0bd.tar.bz2 |
cmLocalUnixMakefileGenerator3: Use std::unique_ptr instead of new/delete
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 508507c..d1093be 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1415,26 +1415,25 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies( this->WriteDisclaimer(internalRuleFileStream); // for each language we need to scan, scan it - std::string const& langStr = - mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES"); std::vector<std::string> langs; - cmSystemTools::ExpandListArgument(langStr, langs); + cmSystemTools::ExpandListArgument( + mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES"), langs); for (std::string const& lang : langs) { // construct the checker // Create the scanner for this language - cmDepends* scanner = nullptr; + std::unique_ptr<cmDepends> scanner; if (lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM" || lang == "CUDA") { // TODO: Handle RC (resource files) dependencies correctly. - scanner = new cmDependsC(this, targetDir, lang, &validDeps); + scanner = cm::make_unique<cmDependsC>(this, targetDir, lang, &validDeps); } #ifdef CMAKE_BUILD_WITH_CMAKE else if (lang == "Fortran") { ruleFileStream << "# Note that incremental build could trigger " << "a call to cmake_copy_f90_mod on each re-build\n"; - scanner = new cmDependsFortran(this); + scanner = cm::make_unique<cmDependsFortran>(this); } else if (lang == "Java") { - scanner = new cmDependsJava(); + scanner = cm::make_unique<cmDependsJava>(); } #endif @@ -1445,9 +1444,6 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies( scanner->SetLanguage(lang); scanner->SetTargetDirectory(targetDir); scanner->Write(ruleFileStream, internalRuleFileStream); - - // free the scanner for this language - delete scanner; } } |