[Cmake-commits] CMake branch, next, updated. v2.8.12.2-7782-g295828d

Ben Boeckel ben.boeckel at kitware.com
Tue Feb 18 13:21:40 EST 2014


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  295828d68d31b7700f15bd75fc0eb736b4c0428d (commit)
       via  b42e016e336c47155068aeae941cc5bf865f5c50 (commit)
      from  4803404d0ff7b27e4502a9ea1aaba722ffc901a6 (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=295828d68d31b7700f15bd75fc0eb736b4c0428d
commit 295828d68d31b7700f15bd75fc0eb736b4c0428d
Merge: 4803404 b42e016
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue Feb 18 13:21:39 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Feb 18 13:21:39 2014 -0500

    Merge topic 'dev/faster-parsers' into next
    
    b42e016e Revert parser improvements


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b42e016e336c47155068aeae941cc5bf865f5c50
commit b42e016e336c47155068aeae941cc5bf865f5c50
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue Feb 18 13:20:49 2014 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Tue Feb 18 13:20:54 2014 -0500

    Revert parser improvements
    
    Causes internal MSBuild errors.

diff --git a/Help/release/dev/faster-parsers.rst b/Help/release/dev/faster-parsers.rst
deleted file mode 100644
index c2a8bfb..0000000
--- a/Help/release/dev/faster-parsers.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-faster-parsers
---------------
-
-* The :manual:`cmake-language(7)` internal implementation of generator
-  expression and list expansion parsers have been optimized and shows
-  non-trivial speedup on large projects.
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index cd30546..2e66d78 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -157,24 +157,17 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
 std::string cmGeneratorExpression::StripEmptyListElements(
                                                     const std::string &input)
 {
-  if (input.find(';') == input.npos)
-    {
-    return input;
-    }
   std::string result;
-  result.reserve(input.size());
 
   const char *c = input.c_str();
-  const char *last = c;
   bool skipSemiColons = true;
   for ( ; *c; ++c)
     {
-    if(*c == ';')
+    if(c[0] == ';')
       {
       if(skipSemiColons)
         {
-        result.append(last, c - last);
-        last = c + 1;
+        continue;
         }
       skipSemiColons = true;
       }
@@ -182,8 +175,8 @@ std::string cmGeneratorExpression::StripEmptyListElements(
       {
       skipSemiColons = false;
       }
+    result += *c;
     }
-  result.append(last);
 
   if (!result.empty() && *(result.end() - 1) == ';')
     {
diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx
index 117a24e..cd71ec0 100644
--- a/Source/cmGeneratorExpressionLexer.cxx
+++ b/Source/cmGeneratorExpressionLexer.cxx
@@ -42,42 +42,42 @@ cmGeneratorExpressionLexer::Tokenize(const char *input)
   const char *upto = c;
 
   for ( ; *c; ++c)
+  {
+  if(c[0] == '$' && c[1] == '<')
     {
-    switch(*c)
-      {
-      case '$':
-        if(c[1] == '<')
-          {
-          InsertText(upto, c, result);
-          result.push_back(cmGeneratorExpressionToken(
-                           cmGeneratorExpressionToken::BeginExpression, c, 2));
-          upto = c + 2;
-          ++c;
-          SawBeginExpression = true;
-          }
-        break;
-      case '>':
-        InsertText(upto, c, result);
-        result.push_back(cmGeneratorExpressionToken(
-                            cmGeneratorExpressionToken::EndExpression, c, 1));
-        upto = c + 1;
-        SawGeneratorExpression = SawBeginExpression;
-        break;
-      case ':':
-        InsertText(upto, c, result);
-        result.push_back(cmGeneratorExpressionToken(
-                            cmGeneratorExpressionToken::ColonSeparator, c, 1));
-        upto = c + 1;
-        break;
-      case ',':
-        InsertText(upto, c, result);
-        result.push_back(cmGeneratorExpressionToken(
-                            cmGeneratorExpressionToken::CommaSeparator, c, 1));
-        upto = c + 1;
-        break;
-      default:
-        break;
-      }
+    InsertText(upto, c, result);
+    upto = c;
+    result.push_back(cmGeneratorExpressionToken(
+                      cmGeneratorExpressionToken::BeginExpression, upto, 2));
+    upto = c + 2;
+    ++c;
+    SawBeginExpression = true;
+    }
+  else if(c[0] == '>')
+    {
+    InsertText(upto, c, result);
+    upto = c;
+    result.push_back(cmGeneratorExpressionToken(
+                        cmGeneratorExpressionToken::EndExpression, upto, 1));
+    upto = c + 1;
+    SawGeneratorExpression = SawBeginExpression;
+    }
+  else if(c[0] == ':')
+    {
+    InsertText(upto, c, result);
+    upto = c;
+    result.push_back(cmGeneratorExpressionToken(
+                        cmGeneratorExpressionToken::ColonSeparator, upto, 1));
+    upto = c + 1;
+    }
+  else if(c[0] == ',')
+    {
+    InsertText(upto, c, result);
+    upto = c;
+    result.push_back(cmGeneratorExpressionToken(
+                        cmGeneratorExpressionToken::CommaSeparator, upto, 1));
+    upto = c + 1;
+    }
   }
   InsertText(upto, c, result);
 
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7c4aa41..41c7509 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1006,7 +1006,7 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
                                        bool emptyArgs)
 {
   // If argument is empty, it is an empty list.
-  if(!emptyArgs && arg.empty())
+  if(arg.length() == 0 && !emptyArgs)
     {
     return;
     }
@@ -1016,11 +1016,10 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
     newargs.push_back(arg);
     return;
     }
-  std::string newArg;
-  const char *last = arg.c_str();
+  std::vector<char> newArgVec;
   // Break the string at non-escaped semicolons not nested in [].
   int squareNesting = 0;
-  for(const char* c = last; *c; ++c)
+  for(const char* c = arg.c_str(); *c; ++c)
     {
     switch(*c)
       {
@@ -1028,21 +1027,34 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
         {
         // We only want to allow escaping of semicolons.  Other
         // escapes should not be processed here.
-        const char* next = c + 1;
-        if(*next == ';')
+        ++c;
+        if(*c == ';')
+          {
+          newArgVec.push_back(*c);
+          }
+        else
           {
-          newArg.append(last, c - last);
-          // Skip over the escape character
-          last = c = next;
+          newArgVec.push_back('\\');
+          if(*c)
+            {
+            newArgVec.push_back(*c);
+            }
+          else
+            {
+            // Terminate the loop properly.
+            --c;
+            }
           }
         } break;
       case '[':
         {
         ++squareNesting;
+        newArgVec.push_back(*c);
         } break;
       case ']':
         {
         --squareNesting;
+        newArgVec.push_back(*c);
         } break;
       case ';':
         {
@@ -1050,28 +1062,31 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
         // brackets.
         if(squareNesting == 0)
           {
-          newArg.append(last, c - last);
-          // Skip over the semicolon
-          last = c + 1;
-          if ( !newArg.empty() || emptyArgs )
+          if ( newArgVec.size() || emptyArgs )
             {
             // Add the last argument if the string is not empty.
-            newargs.push_back(newArg);
-            newArg = "";
+            newArgVec.push_back(0);
+            newargs.push_back(&*newArgVec.begin());
+            newArgVec.clear();
             }
           }
+        else
+          {
+          newArgVec.push_back(*c);
+          }
         } break;
       default:
         {
         // Just append this character.
+        newArgVec.push_back(*c);
         } break;
       }
     }
-  newArg.append(last);
-  if ( !newArg.empty() || emptyArgs )
+  if ( newArgVec.size() || emptyArgs )
     {
     // Add the last argument if the string is not empty.
-    newargs.push_back(newArg);
+    newArgVec.push_back(0);
+    newargs.push_back(&*newArgVec.begin());
     }
 }
 

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

Summary of changes:
 Help/release/dev/faster-parsers.rst   |    6 ---
 Source/cmGeneratorExpression.cxx      |   13 ++----
 Source/cmGeneratorExpressionLexer.cxx |   70 ++++++++++++++++-----------------
 Source/cmSystemTools.cxx              |   51 +++++++++++++++---------
 4 files changed, 71 insertions(+), 69 deletions(-)
 delete mode 100644 Help/release/dev/faster-parsers.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list