[Cmake-commits] CMake branch, next, updated. v3.0.0-rc4-2749-g3adf6d1

Ben Boeckel ben.boeckel at kitware.com
Fri May 2 17:48:06 EDT 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  3adf6d196024e9bad3e4240a71be6c5b0532cc53 (commit)
       via  77b3796581e0b82f0b977418ed52e8c25b96bbd7 (commit)
       via  7b8a990424228716cc3161027dcf2c18ef9793b6 (commit)
       via  10baf00f3d14124ee97ca12510595501d66ed70e (commit)
       via  14e7a8ae1c8be09a58156d71b185e2b98d378a07 (commit)
       via  b4cb543e0c0648bbd3dbede91f864f89275417c4 (commit)
       via  e8e1f3a19fd07ba64381094b98c66f7d07c1746e (commit)
       via  5554910ec2573282a85e61736e96f48e5f550066 (commit)
      from  5c4ee10ca3ce2b76b1006bf4c6cef49f4238c883 (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=3adf6d196024e9bad3e4240a71be6c5b0532cc53
commit 3adf6d196024e9bad3e4240a71be6c5b0532cc53
Merge: 5c4ee10 77b3796
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri May 2 17:48:05 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri May 2 17:48:05 2014 -0400

    Merge topic 'dev/source-file-performance' into next
    
    77b37965 cmSourceFile: Take a string
    7b8a9904 perf: Cache the language property string
    10baf00f cmSourceFile: Cache the isUiFile check
    14e7a8ae cmSourceFileLocation: Return a string reference
    b4cb543e cmSourceFileLocation: Save some string copies
    e8e1f3a1 cmSourceFileLocation: Simplify logic in Matches
    5554910e cmSourceFileLocation: Avoid string allocation in extension checking


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77b3796581e0b82f0b977418ed52e8c25b96bbd7
commit 77b3796581e0b82f0b977418ed52e8c25b96bbd7
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri Mar 21 22:28:14 2014 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Apr 28 21:43:40 2014 -0400

    cmSourceFile: Take a string

diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index bdcdbfd..f898260 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -86,7 +86,7 @@ public:
    * Return the vector that holds the list of dependencies
    */
   const std::vector<std::string> &GetDepends() const {return this->Depends;}
-  void AddDepend(const char* d) { this->Depends.push_back(d); }
+  void AddDepend(const std::string& d) { this->Depends.push_back(d); }
 
   // Get the properties
   cmPropertyMap &GetProperties() { return this->Properties; }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b8a990424228716cc3161027dcf2c18ef9793b6
commit 7b8a990424228716cc3161027dcf2c18ef9793b6
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Tue Mar 11 00:22:02 2014 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Apr 28 21:43:39 2014 -0400

    perf: Cache the language property string

diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 3b130ec..b833d3f 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -40,6 +40,8 @@ std::string const& cmSourceFile::GetExtension() const
   return this->Extension;
 }
 
+const std::string cmSourceFile::propLANGUAGE = "LANGUAGE";
+
 //----------------------------------------------------------------------------
 void cmSourceFile::SetObjectLibrary(std::string const& objlib)
 {
@@ -56,7 +58,7 @@ std::string cmSourceFile::GetObjectLibrary() const
 std::string cmSourceFile::GetLanguage()
 {
   // If the language was set explicitly by the user then use it.
-  if(const char* lang = this->GetProperty("LANGUAGE"))
+  if(const char* lang = this->GetProperty(propLANGUAGE))
     {
     return lang;
     }
@@ -93,7 +95,7 @@ std::string cmSourceFile::GetLanguage()
 std::string cmSourceFile::GetLanguage() const
 {
   // If the language was set explicitly by the user then use it.
-  if(const char* lang = this->GetProperty("LANGUAGE"))
+  if(const char* lang = this->GetProperty(propLANGUAGE))
     {
     return lang;
     }
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 42d6f8a..bdcdbfd 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -117,6 +117,8 @@ private:
   void CheckLanguage(std::string const& ext);
 
   std::vector<std::string> Depends;
+
+  static const std::string propLANGUAGE;
 };
 
 // TODO: Factor out into platform information modules.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=10baf00f3d14124ee97ca12510595501d66ed70e
commit 10baf00f3d14124ee97ca12510595501d66ed70e
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Sat Feb 8 21:35:52 2014 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Apr 28 21:43:39 2014 -0400

    cmSourceFile: Cache the isUiFile check
    
    The filename extension call is expensive, so cache the .ui check.

diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 0ab30a2..3b130ec 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -24,6 +24,8 @@ cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name):
   this->CustomCommand = 0;
   this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
   this->FindFullPathFailed = false;
+  this->IsUiFile = ("ui" ==
+          cmSystemTools::GetFilenameLastExtension(this->Location.GetName()));
 }
 
 //----------------------------------------------------------------------------
@@ -297,9 +299,7 @@ void cmSourceFile::SetProperty(const std::string& prop, const char* value)
 {
   this->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE);
 
-  std::string ext =
-          cmSystemTools::GetFilenameLastExtension(this->Location.GetName());
-  if (ext == ".ui")
+  if (this->IsUiFile)
     {
     cmMakefile const* mf = this->Location.GetMakefile();
     if (prop == "AUTOUIC_OPTIONS")
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index a1d9de1..42d6f8a 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -109,6 +109,7 @@ private:
   std::string FullPath;
   bool FindFullPathFailed;
   std::string ObjectLibrary;
+  bool IsUiFile;
 
   bool FindFullPath(std::string* error);
   bool TryFullPath(const std::string& path, const std::string& ext);

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=14e7a8ae1c8be09a58156d71b185e2b98d378a07
commit 14e7a8ae1c8be09a58156d71b185e2b98d378a07
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Mar 12 17:04:48 2014 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Apr 28 21:43:27 2014 -0400

    cmSourceFileLocation: Return a string reference

diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h
index c37fb1d..af3651a 100644
--- a/Source/cmSourceFileLocation.h
+++ b/Source/cmSourceFileLocation.h
@@ -71,7 +71,7 @@ public:
    * Otherwise it will be a relative path (possibly empty) that is
    * either with respect to the source or build tree.
    */
-  const char* GetDirectory() const { return this->Directory.c_str(); }
+  const std::string& GetDirectory() const { return this->Directory; }
 
   /**
    * Get the file name as best is currently known.  If

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b4cb543e0c0648bbd3dbede91f864f89275417c4
commit b4cb543e0c0648bbd3dbede91f864f89275417c4
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Tue Mar 11 01:49:11 2014 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Apr 28 21:43:27 2014 -0400

    cmSourceFileLocation: Save some string copies

diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 7837738..1c2454e 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -192,7 +192,7 @@ cmSourceFileLocation
 
   // Only a fixed set of extensions will be tried to match a file on
   // disk.  One of these must match if loc refers to this source file.
-  std::string ext = this->Name.substr(loc.Name.size()+1);
+  std::string const& ext = this->Name.substr(loc.Name.size()+1);
   cmMakefile const* mf = this->Makefile;
   const std::vector<std::string>& srcExts = mf->GetSourceExtensions();
   if(std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end())
@@ -216,7 +216,7 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
     // Both extensions are similarly ambiguous.  Since only the old fixed set
     // of extensions will be tried, the names must match at this point to be
     // the same file.
-    if(this->Name != loc.Name)
+    if(this->Name.size() != loc.Name.size() || this->Name != loc.Name)
       {
       return false;
       }
@@ -278,10 +278,10 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
   else if(this->AmbiguousDirectory)
     {
     // Compare possible directory combinations.
-    std::string srcDir =
+    std::string const& srcDir =
       cmSystemTools::CollapseFullPath(
         this->Directory.c_str(), this->Makefile->GetCurrentDirectory());
-    std::string binDir =
+    std::string const& binDir =
       cmSystemTools::CollapseFullPath(
         this->Directory.c_str(), this->Makefile->GetCurrentOutputDirectory());
     if(srcDir != loc.Directory &&
@@ -293,10 +293,10 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
   else if(loc.AmbiguousDirectory)
     {
     // Compare possible directory combinations.
-    std::string srcDir =
+    std::string const& srcDir =
       cmSystemTools::CollapseFullPath(
         loc.Directory.c_str(), loc.Makefile->GetCurrentDirectory());
-    std::string binDir =
+    std::string const& binDir =
       cmSystemTools::CollapseFullPath(
         loc.Directory.c_str(), loc.Makefile->GetCurrentOutputDirectory());
     if(srcDir != this->Directory &&

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e8e1f3a19fd07ba64381094b98c66f7d07c1746e
commit e8e1f3a19fd07ba64381094b98c66f7d07c1746e
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Feb 3 16:06:54 2014 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Apr 28 21:43:26 2014 -0400

    cmSourceFileLocation: Simplify logic in Matches

diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 9c0b2c5..7837738 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -211,36 +211,33 @@ cmSourceFileLocation
 bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
 {
   assert(this->Makefile);
-  if(this->AmbiguousExtension && loc.AmbiguousExtension)
+  if(this->AmbiguousExtension == loc.AmbiguousExtension)
     {
-    // Both extensions are ambiguous.  Since only the old fixed set of
-    // extensions will be tried, the names must match at this point to
-    // be the same file.
+    // Both extensions are similarly ambiguous.  Since only the old fixed set
+    // of extensions will be tried, the names must match at this point to be
+    // the same file.
     if(this->Name != loc.Name)
       {
       return false;
       }
     }
-  else if(this->AmbiguousExtension)
+  else
     {
-    // Only "this" extension is ambiguous.
-    if(!loc.MatchesAmbiguousExtension(*this))
+    const cmSourceFileLocation* loc1;
+    const cmSourceFileLocation* loc2;
+    if(this->AmbiguousExtension)
       {
-      return false;
+      // Only "this" extension is ambiguous.
+      loc1 = &loc;
+      loc2 = this;
       }
-    }
-  else if(loc.AmbiguousExtension)
-    {
-    // Only "loc" extension is ambiguous.
-    if(!this->MatchesAmbiguousExtension(loc))
+    else
       {
-      return false;
+      // Only "loc" extension is ambiguous.
+      loc1 = this;
+      loc2 = &loc;
       }
-    }
-  else
-    {
-    // Neither extension is ambiguous.
-    if(this->Name != loc.Name)
+    if(!loc1->MatchesAmbiguousExtension(*loc2))
       {
       return false;
       }
@@ -254,28 +251,30 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
       return false;
       }
     }
-  else if(this->AmbiguousDirectory && loc.AmbiguousDirectory &&
-          this->Makefile == loc.Makefile)
+  else if(this->AmbiguousDirectory && loc.AmbiguousDirectory)
     {
-    // Both sides have directories relative to the same location.
-    if(this->Directory != loc.Directory)
+    if (this->Makefile == loc.Makefile)
+      {
+      // Both sides have directories relative to the same location.
+      if(this->Directory != loc.Directory)
+        {
+        return false;
+        }
+      }
+    else
       {
+      // Each side has a directory relative to a different location.
+      // This can occur when referencing a source file from a different
+      // directory.  This is not yet allowed.
+      this->Makefile->IssueMessage(
+        cmake::INTERNAL_ERROR,
+        "Matches error: Each side has a directory relative to a different "
+        "location. This can occur when referencing a source file from a "
+        "different directory.  This is not yet allowed."
+        );
       return false;
       }
     }
-  else if(this->AmbiguousDirectory && loc.AmbiguousDirectory)
-    {
-    // Each side has a directory relative to a different location.
-    // This can occur when referencing a source file from a different
-    // directory.  This is not yet allowed.
-    this->Makefile->IssueMessage(
-      cmake::INTERNAL_ERROR,
-      "Matches error: Each side has a directory relative to a different "
-      "location. This can occur when referencing a source file from a "
-      "different directory.  This is not yet allowed."
-      );
-    return false;
-    }
   else if(this->AmbiguousDirectory)
     {
     // Compare possible directory combinations.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5554910ec2573282a85e61736e96f48e5f550066
commit 5554910ec2573282a85e61736e96f48e5f550066
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Feb 10 01:39:33 2014 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Apr 28 21:43:09 2014 -0400

    cmSourceFileLocation: Avoid string allocation in extension checking
    
    The substr call was causing excess allocations. Swap the cheaper
    character check to be before the longer string comparison, now using the
    prefix checking function.

diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index c050202..9c0b2c5 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -183,8 +183,9 @@ cmSourceFileLocation
   // Check if loc's name could possibly be extended to our name by
   // adding an extension.
   if(!(this->Name.size() > loc.Name.size() &&
-       this->Name.substr(0, loc.Name.size()) == loc.Name &&
-       this->Name[loc.Name.size()] == '.'))
+       this->Name[loc.Name.size()] == '.' &&
+       cmHasLiteralPrefixImpl(this->Name.c_str(),
+                              loc.Name.c_str(), loc.Name.size())))
     {
     return false;
     }

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

Summary of changes:
 Source/cmSourceFile.cxx         |   12 +++---
 Source/cmSourceFile.h           |    5 ++-
 Source/cmSourceFileLocation.cxx |   88 +++++++++++++++++++--------------------
 Source/cmSourceFileLocation.h   |    2 +-
 4 files changed, 56 insertions(+), 51 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list