[Cmake-commits] CMake branch, master, updated. v3.12.1-412-g505a713

Kitware Robot kwrobot at kitware.com
Mon Aug 13 17:15:04 EDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  505a713a04b3fc927692d61a1b8e3ea563dc56df (commit)
       via  0eb4b0bb7b2f7a82b3645907a5c02e57653afa8e (commit)
       via  ada121e573fb1a4c2d4ea5ee2ee51daca80d4de8 (commit)
       via  c530e2f74ff466b43651372d56bae543eec1a9f1 (commit)
      from  cd8b094d1dacbff2fa5e520ca167d6f1880310f9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=505a713a04b3fc927692d61a1b8e3ea563dc56df
commit 505a713a04b3fc927692d61a1b8e3ea563dc56df
Merge: 0eb4b0b c530e2f
Author:     Craig Scott <craig.scott at crascit.com>
AuthorDate: Mon Aug 13 21:14:19 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Aug 13 17:14:27 2018 -0400

    Merge topic 'evaluate-stdstring'
    
    c530e2f74f cmCompiledGeneratorExpression::Evaluate(): return const std::string&
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2279


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0eb4b0bb7b2f7a82b3645907a5c02e57653afa8e
commit 0eb4b0bb7b2f7a82b3645907a5c02e57653afa8e
Merge: cd8b094 ada121e
Author:     Craig Scott <craig.scott at crascit.com>
AuthorDate: Mon Aug 13 21:12:28 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Aug 13 17:12:37 2018 -0400

    Merge topic 'state-directory-stdstring'
    
    ada121e573 cmStateDirectory: use const std::string& for return values
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2277


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ada121e573fb1a4c2d4ea5ee2ee51daca80d4de8
commit ada121e573fb1a4c2d4ea5ee2ee51daca80d4de8
Author:     Vitaly Stakhovsky <vvs31415 at gitlab.org>
AuthorDate: Thu Aug 9 11:58:45 2018 -0400
Commit:     Craig Scott <craig.scott at crascit.com>
CommitDate: Sun Aug 12 18:59:21 2018 +1000

    cmStateDirectory: use const std::string& for return values

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d265cab..5e6ce1a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2524,12 +2524,12 @@ std::string const& cmLocalGenerator::GetBinaryDirectory() const
 
 const char* cmLocalGenerator::GetCurrentBinaryDirectory() const
 {
-  return this->StateSnapshot.GetDirectory().GetCurrentBinary();
+  return this->StateSnapshot.GetDirectory().GetCurrentBinary().c_str();
 }
 
 const char* cmLocalGenerator::GetCurrentSourceDirectory() const
 {
-  return this->StateSnapshot.GetDirectory().GetCurrentSource();
+  return this->StateSnapshot.GetDirectory().GetCurrentSource().c_str();
 }
 
 std::string cmLocalGenerator::GetTargetDirectory(
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index c868159..9e14917 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1637,12 +1637,12 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
 
 const char* cmMakefile::GetCurrentSourceDirectory() const
 {
-  return this->StateSnapshot.GetDirectory().GetCurrentSource();
+  return this->StateSnapshot.GetDirectory().GetCurrentSource().c_str();
 }
 
 const char* cmMakefile::GetCurrentBinaryDirectory() const
 {
-  return this->StateSnapshot.GetDirectory().GetCurrentBinary();
+  return this->StateSnapshot.GetDirectory().GetCurrentBinary().c_str();
 }
 
 std::vector<cmTarget*> cmMakefile::GetImportedTargets() const
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index fd42c53..dbe6fa1 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -83,9 +83,9 @@ bool cmOutputConverter::ContainedInDirectory(std::string const& local_path,
                                              std::string const& remote_path,
                                              cmStateDirectory const& directory)
 {
-  const std::string relativePathTopBinary =
+  const std::string& relativePathTopBinary =
     directory.GetRelativePathTopBinary();
-  const std::string relativePathTopSource =
+  const std::string& relativePathTopSource =
     directory.GetRelativePathTopSource();
 
   const bool bothInBinary =
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 6eac8e2..925b161 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -84,9 +84,9 @@ void cmStateDirectory::ComputeRelativePathTopBinary()
   }
 }
 
-const char* cmStateDirectory::GetCurrentSource() const
+std::string const& cmStateDirectory::GetCurrentSource() const
 {
-  return this->DirectoryState->Location.c_str();
+  return this->DirectoryState->Location;
 }
 
 void cmStateDirectory::SetCurrentSource(std::string const& dir)
@@ -101,9 +101,9 @@ void cmStateDirectory::SetCurrentSource(std::string const& dir)
   this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc);
 }
 
-const char* cmStateDirectory::GetCurrentBinary() const
+std::string const& cmStateDirectory::GetCurrentBinary() const
 {
-  return this->DirectoryState->OutputLocation.c_str();
+  return this->DirectoryState->OutputLocation;
 }
 
 void cmStateDirectory::SetCurrentBinary(std::string const& dir)
@@ -118,14 +118,14 @@ void cmStateDirectory::SetCurrentBinary(std::string const& dir)
   this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc);
 }
 
-const char* cmStateDirectory::GetRelativePathTopSource() const
+std::string const& cmStateDirectory::GetRelativePathTopSource() const
 {
-  return this->DirectoryState->RelativePathTopSource.c_str();
+  return this->DirectoryState->RelativePathTopSource;
 }
 
-const char* cmStateDirectory::GetRelativePathTopBinary() const
+std::string const& cmStateDirectory::GetRelativePathTopBinary() const
 {
-  return this->DirectoryState->RelativePathTopBinary.c_str();
+  return this->DirectoryState->RelativePathTopBinary;
 }
 
 void cmStateDirectory::SetRelativePathTopSource(const char* dir)
@@ -474,7 +474,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop,
   if (prop == "PARENT_DIRECTORY") {
     cmStateSnapshot parent = this->Snapshot_.GetBuildsystemDirectoryParent();
     if (parent.IsValid()) {
-      return parent.GetDirectory().GetCurrentSource();
+      return parent.GetDirectory().GetCurrentSource().c_str();
     }
     return "";
   }
diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h
index bc96cc9..412664f 100644
--- a/Source/cmStateDirectory.h
+++ b/Source/cmStateDirectory.h
@@ -22,13 +22,13 @@ class cmStateDirectory
     cmStateSnapshot const& snapshot);
 
 public:
-  const char* GetCurrentSource() const;
+  std::string const& GetCurrentSource() const;
   void SetCurrentSource(std::string const& dir);
-  const char* GetCurrentBinary() const;
+  std::string const& GetCurrentBinary() const;
   void SetCurrentBinary(std::string const& dir);
 
-  const char* GetRelativePathTopSource() const;
-  const char* GetRelativePathTopBinary() const;
+  std::string const& GetRelativePathTopSource() const;
+  std::string const& GetRelativePathTopBinary() const;
   void SetRelativePathTopSource(const char* dir);
   void SetRelativePathTopBinary(const char* dir);
 
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 380ac88..cc5a176 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1415,13 +1415,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const
       return this->GetMakefile()
         ->GetStateSnapshot()
         .GetDirectory()
-        .GetCurrentBinary();
+        .GetCurrentBinary()
+        .c_str();
     }
     if (prop == propSOURCE_DIR) {
       return this->GetMakefile()
         ->GetStateSnapshot()
         .GetDirectory()
-        .GetCurrentSource();
+        .GetCurrentSource()
+        .c_str();
     }
   }
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c530e2f74ff466b43651372d56bae543eec1a9f1
commit c530e2f74ff466b43651372d56bae543eec1a9f1
Author:     Vitaly Stakhovsky <vvs31415 at gitlab.org>
AuthorDate: Thu Aug 9 14:50:17 2018 -0400
Commit:     Vitaly Stakhovsky <vvs31415 at gitlab.org>
CommitDate: Thu Aug 9 14:50:17 2018 -0400

    cmCompiledGeneratorExpression::Evaluate(): return const std::string&

diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 64ec30d..f26c717 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -38,7 +38,7 @@ cmGeneratorExpression::~cmGeneratorExpression()
 {
 }
 
-const char* cmCompiledGeneratorExpression::Evaluate(
+const std::string& cmCompiledGeneratorExpression::Evaluate(
   cmLocalGenerator* lg, const std::string& config, bool quiet,
   const cmGeneratorTarget* headTarget,
   cmGeneratorExpressionDAGChecker* dagChecker,
@@ -48,7 +48,7 @@ const char* cmCompiledGeneratorExpression::Evaluate(
                         language);
 }
 
-const char* cmCompiledGeneratorExpression::Evaluate(
+const std::string& cmCompiledGeneratorExpression::Evaluate(
   cmLocalGenerator* lg, const std::string& config, bool quiet,
   const cmGeneratorTarget* headTarget, const cmGeneratorTarget* currentTarget,
   cmGeneratorExpressionDAGChecker* dagChecker,
@@ -61,12 +61,12 @@ const char* cmCompiledGeneratorExpression::Evaluate(
   return this->EvaluateWithContext(context, dagChecker);
 }
 
-const char* cmCompiledGeneratorExpression::EvaluateWithContext(
+const std::string& cmCompiledGeneratorExpression::EvaluateWithContext(
   cmGeneratorExpressionContext& context,
   cmGeneratorExpressionDAGChecker* dagChecker) const
 {
   if (!this->NeedsEvaluation) {
-    return this->Input.c_str();
+    return this->Input;
   }
 
   this->Output.clear();
@@ -97,8 +97,7 @@ const char* cmCompiledGeneratorExpression::EvaluateWithContext(
 
   this->DependTargets = context.DependTargets;
   this->AllTargetsSeen = context.AllTargets;
-  // TODO: Return a std::string from here instead?
-  return this->Output.c_str();
+  return this->Output;
 }
 
 cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 9fd53c6..2899317 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -72,16 +72,17 @@ class cmCompiledGeneratorExpression
   CM_DISABLE_COPY(cmCompiledGeneratorExpression)
 
 public:
-  const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
-                       bool quiet = false,
-                       cmGeneratorTarget const* headTarget = nullptr,
-                       cmGeneratorTarget const* currentTarget = nullptr,
-                       cmGeneratorExpressionDAGChecker* dagChecker = nullptr,
-                       std::string const& language = std::string()) const;
-  const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
-                       bool quiet, cmGeneratorTarget const* headTarget,
-                       cmGeneratorExpressionDAGChecker* dagChecker,
-                       std::string const& language = std::string()) const;
+  const std::string& Evaluate(
+    cmLocalGenerator* lg, const std::string& config, bool quiet = false,
+    cmGeneratorTarget const* headTarget = nullptr,
+    cmGeneratorTarget const* currentTarget = nullptr,
+    cmGeneratorExpressionDAGChecker* dagChecker = nullptr,
+    std::string const& language = std::string()) const;
+  const std::string& Evaluate(
+    cmLocalGenerator* lg, const std::string& config, bool quiet,
+    cmGeneratorTarget const* headTarget,
+    cmGeneratorExpressionDAGChecker* dagChecker,
+    std::string const& language = std::string()) const;
 
   /** Get set of targets found during evaluations.  */
   std::set<cmGeneratorTarget*> const& GetTargets() const
@@ -126,7 +127,7 @@ public:
                               std::map<std::string, std::string>& mapping);
 
 private:
-  const char* EvaluateWithContext(
+  const std::string& EvaluateWithContext(
     cmGeneratorExpressionContext& context,
     cmGeneratorExpressionDAGChecker* dagChecker) const;
 
@@ -219,13 +220,16 @@ protected:
       this->GeneratorExpression.Parse(expression);
 
     if (dagChecker == nullptr) {
-      return this->CompiledGeneratorExpression->Evaluate(
-        this->LocalGenerator, this->Config, false, this->GeneratorTarget);
+      return this->CompiledGeneratorExpression
+        ->Evaluate(this->LocalGenerator, this->Config, false,
+                   this->GeneratorTarget)
+        .c_str();
     }
 
-    return this->CompiledGeneratorExpression->Evaluate(
-      this->LocalGenerator, this->Config, false, this->GeneratorTarget,
-      dagChecker, this->Language);
+    return this->CompiledGeneratorExpression
+      ->Evaluate(this->LocalGenerator, this->Config, false,
+                 this->GeneratorTarget, dagChecker, this->Language)
+      .c_str();
   }
 
 private:
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index a094fa5..e7a55e0 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -55,7 +55,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(
 
   std::string outputFileName = this->OutputFileExpr->Evaluate(
     lg, config, false, nullptr, nullptr, nullptr, lang);
-  const std::string outputContent = inputExpression->Evaluate(
+  const std::string& outputContent = inputExpression->Evaluate(
     lg, config, false, nullptr, nullptr, nullptr, lang);
 
   if (cmSystemTools::FileIsFullPath(outputFileName)) {
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index c20fd13..1548374 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -5519,7 +5519,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
       this->GetName(), "LINK_LIBRARIES", nullptr, nullptr);
     cmGeneratorExpression ge(*btIt);
     std::unique_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
-    std::string const evaluated =
+    std::string const& evaluated =
       cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker);
     cmSystemTools::ExpandListArgument(evaluated, llibs);
     if (cge->GetHadHeadSensitiveCondition()) {
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 21121f2..28cbdc7 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -679,7 +679,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
           std::unique_ptr<cmCompiledGeneratorExpression> cge =
             ge.Parse(propertyValue);
           if (cmSystemTools::IsOn(
-                cge->Evaluate(target->GetLocalGenerator(), i))) {
+                cge->Evaluate(target->GetLocalGenerator(), i).c_str())) {
             activeConfigs.insert(i);
           }
         }
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index c267160..f0a5e26 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -797,9 +797,8 @@ static Json::Value DumpCTestInfo(cmLocalGenerator* lg, cmTest* testInfo,
 
   // Remove any config specific variables from the output.
   cmGeneratorExpression ge;
-  auto cge = ge.Parse(command.c_str());
-  const char* processed = cge->Evaluate(lg, config);
-
+  auto cge = ge.Parse(command);
+  const std::string& processed = cge->Evaluate(lg, config);
   result[kCTEST_COMMAND] = processed;
 
   // Build up the list of properties that may have been specified
@@ -810,7 +809,7 @@ static Json::Value DumpCTestInfo(cmLocalGenerator* lg, cmTest* testInfo,
 
     // Remove config variables from the value too.
     auto cge_value = ge.Parse(prop.second.GetValue());
-    const char* processed_value = cge_value->Evaluate(lg, config);
+    const std::string& processed_value = cge_value->Evaluate(lg, config);
     entry[kVALUE_KEY] = processed_value;
     properties.append(entry);
   }
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index c532efb..796d2df 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -103,7 +103,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
     }
   } else {
     // Use the command name given.
-    exe = ge.Parse(exe.c_str())->Evaluate(this->LG, config);
+    exe = ge.Parse(exe)->Evaluate(this->LG, config);
     cmSystemTools::ConvertToUnixSlashes(exe);
   }
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 41567a3..553c78e 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1742,10 +1742,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
         e2.Element("Link", deployLocation + "\\%(FileName)%(Extension)");
       }
       for (size_t i = 0; i != this->Configurations.size(); ++i) {
-        if (0 ==
-            strcmp(
-              cge->Evaluate(this->LocalGenerator, this->Configurations[i]),
-              "1")) {
+        if (cge->Evaluate(this->LocalGenerator, this->Configurations[i]) ==
+            "1") {
           e2.WritePlatformConfigTag("DeploymentContent",
                                     "'$(Configuration)|$(Platform)'=='" +
                                       this->Configurations[i] + "|" +
@@ -1793,14 +1791,14 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
         ge.Parse(shaderEnableDebug);
 
       for (size_t i = 0; i != this->Configurations.size(); ++i) {
-        const char* enableDebug =
+        const std::string& enableDebug =
           cge->Evaluate(this->LocalGenerator, this->Configurations[i]);
-        if (strlen(enableDebug) > 0) {
+        if (!enableDebug.empty()) {
           e2.WritePlatformConfigTag(
             "EnableDebuggingInformation",
             "'$(Configuration)|$(Platform)'=='" + this->Configurations[i] +
               "|" + this->Platform + "'",
-            cmSystemTools::IsOn(enableDebug) ? "true" : "false");
+            cmSystemTools::IsOn(enableDebug.c_str()) ? "true" : "false");
         }
       }
     }
@@ -1810,14 +1808,15 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
         ge.Parse(shaderDisableOptimizations);
 
       for (size_t i = 0; i != this->Configurations.size(); ++i) {
-        const char* disableOptimizations =
+        const std::string& disableOptimizations =
           cge->Evaluate(this->LocalGenerator, this->Configurations[i]);
-        if (strlen(disableOptimizations) > 0) {
+        if (!disableOptimizations.empty()) {
           e2.WritePlatformConfigTag(
             "DisableOptimizations",
             "'$(Configuration)|$(Platform)'=='" + this->Configurations[i] +
               "|" + this->Platform + "'",
-            (cmSystemTools::IsOn(disableOptimizations) ? "true" : "false"));
+            (cmSystemTools::IsOn(disableOptimizations.c_str()) ? "true"
+                                                               : "false"));
         }
       }
     }

-----------------------------------------------------------------------

Summary of changes:
 Source/cmGeneratorExpression.cxx               | 11 ++++----
 Source/cmGeneratorExpression.h                 | 36 ++++++++++++++------------
 Source/cmGeneratorExpressionEvaluationFile.cxx |  2 +-
 Source/cmGeneratorTarget.cxx                   |  2 +-
 Source/cmGlobalVisualStudio7Generator.cxx      |  2 +-
 Source/cmLocalGenerator.cxx                    |  4 +--
 Source/cmMakefile.cxx                          |  4 +--
 Source/cmOutputConverter.cxx                   |  4 +--
 Source/cmServerProtocol.cxx                    |  7 +++--
 Source/cmStateDirectory.cxx                    | 18 ++++++-------
 Source/cmStateDirectory.h                      |  8 +++---
 Source/cmTarget.cxx                            |  6 +++--
 Source/cmTestGenerator.cxx                     |  2 +-
 Source/cmVisualStudio10TargetGenerator.cxx     | 19 +++++++-------
 14 files changed, 64 insertions(+), 61 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list