[Cmake-commits] CMake branch, next, updated. v2.8.9-517-gde14627

Stephen Kelly steveire at gmail.com
Thu Sep 13 12:35:52 EDT 2012


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, next has been updated
       via  de14627fe38d3ed1e8085c9cc24972ae40dfd80f (commit)
       via  808f5529ae005716fdbddbc58d8fe23247dcbb25 (commit)
       via  1b9e16862128adb1bd210d93a897225dbab1103a (commit)
      from  3e6830fb153571300ccd9e025d08ecfd25d7b5d7 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de14627fe38d3ed1e8085c9cc24972ae40dfd80f
commit de14627fe38d3ed1e8085c9cc24972ae40dfd80f
Merge: 3e6830f 808f552
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Sep 13 12:35:49 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Sep 13 12:35:49 2012 -0400

    Merge topic 'generator-expression-refactor' into next
    
    808f552 Fix width of long line.
    1b9e168 Avoid use of cmGeneratorExpressionEvaluator after deletion.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=808f5529ae005716fdbddbc58d8fe23247dcbb25
commit 808f5529ae005716fdbddbc58d8fe23247dcbb25
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Sep 13 18:31:35 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Sep 13 18:31:35 2012 +0200

    Fix width of long line.

diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 7add406..194749c 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -464,12 +464,12 @@ std::string GeneratorExpressionContent::Evaluate(
 }
 
 //----------------------------------------------------------------------------
-static void deleteAll(const std::vector<cmGeneratorExpressionEvaluator*> &container)
+static void deleteAll(const std::vector<cmGeneratorExpressionEvaluator*> &c)
 {
   std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
-                                                  = container.begin();
+                                                  = c.begin();
   const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
-                                                  = container.end();
+                                                  = c.end();
   for ( ; it != end; ++it)
     {
     delete *it;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b9e16862128adb1bd210d93a897225dbab1103a
commit 1b9e16862128adb1bd210d93a897225dbab1103a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Sep 13 18:23:15 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Sep 13 18:30:48 2012 +0200

    Avoid use of cmGeneratorExpressionEvaluator after deletion.
    
    Disallow copying of the objects so that they can only be deleted one
    time, at destruction of the cmGeneratorExpression.
    
    Hopefully this fixes the Windows builds.

diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 731938d..4a58590 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -23,19 +23,19 @@
 //----------------------------------------------------------------------------
 cmGeneratorExpression::cmGeneratorExpression(
   cmListFileBacktrace const& backtrace):
-  Backtrace(backtrace)
+  Backtrace(backtrace), CompiledExpression(0)
 {
 }
 
 //----------------------------------------------------------------------------
-const cmCompiledGeneratorExpression
+const cmCompiledGeneratorExpression &
 cmGeneratorExpression::Parse(std::string const& input)
 {
   return this->Parse(input.c_str());
 }
 
 //----------------------------------------------------------------------------
-const cmCompiledGeneratorExpression
+const cmCompiledGeneratorExpression &
 cmGeneratorExpression::Parse(const char* input)
 {
   cmGeneratorExpressionLexer l;
@@ -49,8 +49,18 @@ cmGeneratorExpression::Parse(const char* input)
     p.Parse(evaluators);
     }
 
-  return cmCompiledGeneratorExpression(this->Backtrace, evaluators, input,
-                                       needsParsing);
+  delete this->CompiledExpression;
+  this->CompiledExpression = new cmCompiledGeneratorExpression(
+                                      this->Backtrace,
+                                      evaluators,
+                                      input,
+                                      needsParsing);
+  return *this->CompiledExpression;
+}
+
+cmGeneratorExpression::~cmGeneratorExpression()
+{
+  delete this->CompiledExpression;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index f29c9d3..713b9ce 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -37,12 +37,18 @@ class cmGeneratorExpression
 public:
   /** Construct. */
   cmGeneratorExpression(cmListFileBacktrace const& backtrace);
+  ~cmGeneratorExpression();
 
-  const cmCompiledGeneratorExpression Parse(std::string const& input);
-  const cmCompiledGeneratorExpression Parse(const char* input);
+  const cmCompiledGeneratorExpression& Parse(std::string const& input);
+  const cmCompiledGeneratorExpression& Parse(const char* input);
 
 private:
   cmListFileBacktrace const& Backtrace;
+private:
+  cmGeneratorExpression(const cmGeneratorExpression &);
+  void operator=(const cmGeneratorExpression &);
+
+  cmCompiledGeneratorExpression *CompiledExpression;
 };
 
 class cmCompiledGeneratorExpression
@@ -73,4 +79,7 @@ private:
   const bool NeedsParsing;
 
   mutable std::string Output;
+private:
+  cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &);
+  void operator=(const cmCompiledGeneratorExpression &);
 };
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index af4e8c5..5163ca0 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -30,6 +30,7 @@ struct cmGeneratorExpressionContext
 //----------------------------------------------------------------------------
 struct cmGeneratorExpressionEvaluator
 {
+  cmGeneratorExpressionEvaluator() {}
   virtual ~cmGeneratorExpressionEvaluator() {}
 
   enum Type
@@ -42,6 +43,10 @@ struct cmGeneratorExpressionEvaluator
 
   virtual std::string Evaluate(cmGeneratorExpressionContext *context
                               ) const = 0;
+
+private:
+  cmGeneratorExpressionEvaluator(const cmGeneratorExpressionEvaluator &);
+  void operator=(const cmGeneratorExpressionEvaluator &);
 };
 
 struct TextContent : public cmGeneratorExpressionEvaluator
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 9f62586..a7c9c3a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1649,7 +1649,7 @@ cmTargetTraceDependencies
     for(cmCustomCommandLine::const_iterator cli = cit->begin();
         cli != cit->end(); ++cli)
       {
-      cmCompiledGeneratorExpression cge = ge.Parse(*cli);
+      const cmCompiledGeneratorExpression &cge = ge.Parse(*cli);
       cge.Evaluate(this->Makefile, 0, true);
       std::set<cmTarget*> geTargets = cge.GetTargets();
       targets.insert(geTargets.begin(), geTargets.end());

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

Summary of changes:
 Source/cmGeneratorExpression.cxx          |   20 +++++++++++++++-----
 Source/cmGeneratorExpression.h            |   13 +++++++++++--
 Source/cmGeneratorExpressionEvaluator.cxx |    6 +++---
 Source/cmGeneratorExpressionEvaluator.h   |    5 +++++
 Source/cmTarget.cxx                       |    2 +-
 5 files changed, 35 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list