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  1672d3d5a5a0c5c73a857f5e4592fe998da3ae78 (commit)
       via  403b6b3bc387fbe5c9c058d591f478f94b40a9fd (commit)
       via  b61fcdc8bc0d4b7b5104195abcfe03154e35bf52 (commit)
       via  e337e60a50f3de8bb04b91b1233ff60377a9c944 (commit)
       via  d89c0ecf79a791c0b5ffff9fbb59e8720ee88950 (commit)
       via  4af094c8dfa8dd5bfb943a84e5f4c00f7bf2ee8f (commit)
       via  833d9eae4e49ef7b9055c709fd8a6959588952c3 (commit)
       via  c9c397a14ac59b25e43ce43264a420b2f9537547 (commit)
      from  09fe6e6e9408dde14193f9a358550ac738581cac (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=1672d3d5a5a0c5c73a857f5e4592fe998da3ae78
commit 1672d3d5a5a0c5c73a857f5e4592fe998da3ae78
Merge: 403b6b3 4af094c
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Jul 31 15:47:44 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed Jul 31 11:54:28 2019 -0400

    Merge topic 'clang-tidy-8'
    
    4af094c8df clang-tidy: Blacklist violations for version 8
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3627


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=403b6b3bc387fbe5c9c058d591f478f94b40a9fd
commit 403b6b3bc387fbe5c9c058d591f478f94b40a9fd
Merge: 09fe6e6 b61fcdc
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Jul 31 15:46:49 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed Jul 31 11:52:21 2019 -0400

    Merge topic 'fileapi-optimize'
    
    b61fcdc8bc fileapi: Compute codemodel compile groups without target-wide 
settings
    e337e60a50 fileapi: Compute codemodel compile groups before converting to 
Json
    d89c0ecf79 fileapi: Generate codemodel Json backtraces earlier
    833d9eae4e fileapi: Refactor codemodel defines de-duplication
    c9c397a14a fileapi: Avoid unnecessary CompileData move
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3621


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b61fcdc8bc0d4b7b5104195abcfe03154e35bf52
commit b61fcdc8bc0d4b7b5104195abcfe03154e35bf52
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Mon Jul 29 10:58:47 2019 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Jul 30 10:03:35 2019 -0400

    fileapi: Compute codemodel compile groups without target-wide settings
    
    Previously we computed the entire description of each source file
    including all target-wide settings, and then computed compile groups
    using those complete descriptions.  This is inefficient when target-wide
    settings are large because they are included in comparisons even though
    they are the same for every source.  Instead compute source groups using
    only the source-specific settings, and then merge the target-wide
    settings into place only once per unique compile group.
    
    This is a slight behavior change in the case that a source-specific
    compile definition duplicates a target-wide definition.  Previously that
    source would still be grouped with other sources which do not have the
    definition because they would all get it from the target.  Now that
    source will be in its own compile group even though it ultimately
    compiles with the same settings as another group.  This is acceptable
    because the source is specified by the project with source-specific
    settings already.
    
    Fixes: #19520

diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 2a15fd7..e9ee7f5 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -359,6 +359,7 @@ class Target
 
   Json::ArrayIndex AddSourceGroup(cmSourceGroup* sg, Json::ArrayIndex si);
   CompileData BuildCompileData(cmSourceFile* sf);
+  CompileData MergeCompileData(CompileData const& fd);
   Json::ArrayIndex AddSourceCompileGroup(cmSourceFile* sf,
                                          Json::ArrayIndex si);
   void AddBacktrace(Json::Value& object, cmListFileBacktrace const& bt);
@@ -839,15 +840,11 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
   if (fd.Language.empty()) {
     return fd;
   }
-  CompileData const& cd = this->CompileDataMap.at(fd.Language);
-
-  fd.Sysroot = cd.Sysroot;
 
   cmLocalGenerator* lg = this->GT->GetLocalGenerator();
   cmGeneratorExpressionInterpreter genexInterpreter(lg, this->Config, this->GT,
                                                     fd.Language);
 
-  fd.Flags = cd.Flags;
   const std::string COMPILE_FLAGS("COMPILE_FLAGS");
   if (const char* cflags = sf->GetProperty(COMPILE_FLAGS)) {
     std::string flags = genexInterpreter.Evaluate(cflags, COMPILE_FLAGS);
@@ -877,8 +874,6 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
       }
     }
   }
-  fd.Includes.insert(fd.Includes.end(), cd.Includes.begin(),
-                     cd.Includes.end());
 
   const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS");
   std::set<std::string> fileDefines;
@@ -895,20 +890,51 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
       genexInterpreter.Evaluate(config_defs, COMPILE_DEFINITIONS));
   }
 
-  fd.Defines.reserve(cd.Defines.size() + fileDefines.size());
-  fd.Defines = cd.Defines;
+  fd.Defines.reserve(fileDefines.size());
   for (std::string const& d : fileDefines) {
     fd.Defines.emplace_back(d, JBTIndex());
   }
 
+  return fd;
+}
+
+CompileData Target::MergeCompileData(CompileData const& fd)
+{
+  CompileData cd;
+  cd.Language = fd.Language;
+  if (cd.Language.empty()) {
+    return cd;
+  }
+  CompileData const& td = this->CompileDataMap.at(cd.Language);
+
+  // All compile groups share the sysroot of the target.
+  cd.Sysroot = td.Sysroot;
+
+  // Use target-wide flags followed by source-specific flags.
+  cd.Flags.reserve(td.Flags.size() + fd.Flags.size());
+  cd.Flags.insert(cd.Flags.end(), td.Flags.begin(), td.Flags.end());
+  cd.Flags.insert(cd.Flags.end(), fd.Flags.begin(), fd.Flags.end());
+
+  // Use source-specific includes followed by target-wide includes.
+  cd.Includes.reserve(fd.Includes.size() + td.Includes.size());
+  cd.Includes.insert(cd.Includes.end(), fd.Includes.begin(),
+                     fd.Includes.end());
+  cd.Includes.insert(cd.Includes.end(), td.Includes.begin(),
+                     td.Includes.end());
+
+  // Use target-wide defines followed by source-specific defines.
+  cd.Defines.reserve(td.Defines.size() + fd.Defines.size());
+  cd.Defines.insert(cd.Defines.end(), td.Defines.begin(), td.Defines.end());
+  cd.Defines.insert(cd.Defines.end(), fd.Defines.begin(), fd.Defines.end());
+
   // De-duplicate defines.
-  std::stable_sort(fd.Defines.begin(), fd.Defines.end(),
+  std::stable_sort(cd.Defines.begin(), cd.Defines.end(),
                    JBT<std::string>::ValueLess);
-  auto end = std::unique(fd.Defines.begin(), fd.Defines.end(),
+  auto end = std::unique(cd.Defines.begin(), cd.Defines.end(),
                          JBT<std::string>::ValueEq);
-  fd.Defines.erase(end, fd.Defines.end());
+  cd.Defines.erase(end, cd.Defines.end());
 
-  return fd;
+  return cd;
 }
 
 Json::ArrayIndex Target::AddSourceCompileGroup(cmSourceFile* sf,
@@ -1084,7 +1110,8 @@ Json::Value Target::DumpCompileGroups()
 
 Json::Value Target::DumpCompileGroup(CompileGroup& cg)
 {
-  Json::Value group = this->DumpCompileData(cg.Entry->first);
+  Json::Value group =
+    this->DumpCompileData(this->MergeCompileData(cg.Entry->first));
   group["sourceIndexes"] = std::move(cg.SourceIndexes);
   return group;
 }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e337e60a50f3de8bb04b91b1233ff60377a9c944
commit e337e60a50f3de8bb04b91b1233ff60377a9c944
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Mon Jul 29 10:25:27 2019 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Jul 30 10:01:49 2019 -0400

    fileapi: Compute codemodel compile groups before converting to Json
    
    Previously we converted the description of each source file into its
    compile group Json object and then used the Json object itself as a
    unique identifier for the group.  When source files have large
    descriptions their Json objects make inefficient map keys requiring deep
    comparison operations.  Instead use our internal `CompileData` structure
    as a map key.  This enables use of a hash map.
    
    Issue: #19520

diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 88ddf7e..2a15fd7 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -30,6 +30,9 @@
 
 #include <algorithm>
 #include <cassert>
+#include <cstddef>
+#include <functional>
+#include <limits>
 #include <map>
 #include <memory>
 #include <set>
@@ -155,6 +158,10 @@ public:
   }
   T Value;
   JBTIndex Backtrace;
+  friend bool operator==(JBT<T> const& l, JBT<T> const& r)
+  {
+    return l.Value == r.Value && l.Backtrace.Index == r.Backtrace.Index;
+  }
   static bool ValueEq(JBT<T> const& l, JBT<T> const& r)
   {
     return l.Value == r.Value;
@@ -259,6 +266,10 @@ struct CompileData
       , IsSystem(isSystem)
     {
     }
+    friend bool operator==(IncludeEntry const& l, IncludeEntry const& r)
+    {
+      return l.Path == r.Path && l.IsSystem == r.IsSystem;
+    }
   };
 
   std::string Language;
@@ -266,8 +277,47 @@ struct CompileData
   std::vector<JBT<std::string>> Flags;
   std::vector<JBT<std::string>> Defines;
   std::vector<IncludeEntry> Includes;
+
+  friend bool operator==(CompileData const& l, CompileData const& r)
+  {
+    return (l.Language == r.Language && l.Sysroot == r.Sysroot &&
+            l.Flags == r.Flags && l.Defines == r.Defines &&
+            l.Includes == r.Includes);
+  }
 };
+}
 
+namespace std {
+
+template <>
+struct hash<CompileData>
+{
+  std::size_t operator()(CompileData const& in) const
+  {
+    using std::hash;
+    size_t result =
+      hash<std::string>()(in.Language) ^ hash<std::string>()(in.Sysroot);
+    for (auto const& i : in.Includes) {
+      result = result ^
+        (hash<std::string>()(i.Path.Value) ^
+         hash<Json::ArrayIndex>()(i.Path.Backtrace.Index) ^
+         (i.IsSystem ? std::numeric_limits<size_t>::max() : 0));
+    }
+    for (auto const& i : in.Flags) {
+      result = result ^ hash<std::string>()(i.Value) ^
+        hash<Json::ArrayIndex>()(i.Backtrace.Index);
+    }
+    for (auto const& i : in.Defines) {
+      result = result ^ hash<std::string>()(i.Value) ^
+        hash<Json::ArrayIndex>()(i.Backtrace.Index);
+    }
+    return result;
+  }
+};
+
+} // namespace std
+
+namespace {
 class Target
 {
   cmGeneratorTarget* GT;
@@ -292,10 +342,10 @@ class Target
 
   struct CompileGroup
   {
-    std::map<Json::Value, Json::ArrayIndex>::iterator Entry;
+    std::unordered_map<CompileData, Json::ArrayIndex>::iterator Entry;
     Json::Value SourceIndexes = Json::arrayValue;
   };
-  std::map<Json::Value, Json::ArrayIndex> CompileGroupMap;
+  std::unordered_map<CompileData, Json::ArrayIndex> CompileGroupMap;
   std::vector<CompileGroup> CompileGroups;
 
   template <typename T>
@@ -864,15 +914,12 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
 Json::ArrayIndex Target::AddSourceCompileGroup(cmSourceFile* sf,
                                                Json::ArrayIndex si)
 {
-  Json::Value compileDataJson =
-    this->DumpCompileData(this->BuildCompileData(sf));
-  std::map<Json::Value, Json::ArrayIndex>::iterator i =
-    this->CompileGroupMap.find(compileDataJson);
+  CompileData compileData = this->BuildCompileData(sf);
+  auto i = this->CompileGroupMap.find(compileData);
   if (i == this->CompileGroupMap.end()) {
     Json::ArrayIndex cgIndex =
       static_cast<Json::ArrayIndex>(this->CompileGroups.size());
-    i =
-      this->CompileGroupMap.emplace(std::move(compileDataJson), cgIndex).first;
+    i = this->CompileGroupMap.emplace(std::move(compileData), cgIndex).first;
     CompileGroup g;
     g.Entry = i;
     this->CompileGroups.push_back(std::move(g));
@@ -1037,7 +1084,7 @@ Json::Value Target::DumpCompileGroups()
 
 Json::Value Target::DumpCompileGroup(CompileGroup& cg)
 {
-  Json::Value group = cg.Entry->first;
+  Json::Value group = this->DumpCompileData(cg.Entry->first);
   group["sourceIndexes"] = std::move(cg.SourceIndexes);
   return group;
 }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d89c0ecf79a791c0b5ffff9fbb59e8720ee88950
commit d89c0ecf79a791c0b5ffff9fbb59e8720ee88950
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Mon Jul 29 10:10:16 2019 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Jul 30 10:01:36 2019 -0400

    fileapi: Generate codemodel Json backtraces earlier
    
    Convert from `cmListFileBacktrace` to Json `backtraceGraph` entries
    before storing in `CompileData`.  This will allow backtraces to be
    uniquely identified, hashed, and compared as a single integer.

diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 9ff8ffa..88ddf7e 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -135,6 +135,36 @@ std::string TargetId(cmGeneratorTarget const* gt, 
std::string const& topBuild)
   return gt->GetName() + CMAKE_DIRECTORY_ID_SEP + hash;
 }
 
+class JBTIndex
+{
+public:
+  JBTIndex() = default;
+  explicit operator bool() const { return Index != None; }
+  Json::ArrayIndex Index = None;
+  static Json::ArrayIndex const None = static_cast<Json::ArrayIndex>(-1);
+};
+
+template <typename T>
+class JBT
+{
+public:
+  JBT(T v = T(), JBTIndex bt = JBTIndex())
+    : Value(std::move(v))
+    , Backtrace(bt)
+  {
+  }
+  T Value;
+  JBTIndex Backtrace;
+  static bool ValueEq(JBT<T> const& l, JBT<T> const& r)
+  {
+    return l.Value == r.Value;
+  }
+  static bool ValueLess(JBT<T> const& l, JBT<T> const& r)
+  {
+    return l.Value < r.Value;
+  }
+};
+
 class BacktraceData
 {
   std::string TopSource;
@@ -169,7 +199,7 @@ class BacktraceData
 
 public:
   BacktraceData(std::string topSource);
-  bool Add(cmListFileBacktrace const& bt, Json::ArrayIndex& index);
+  JBTIndex Add(cmListFileBacktrace const& bt);
   Json::Value Dump();
 };
 
@@ -178,16 +208,17 @@ BacktraceData::BacktraceData(std::string topSource)
 {
 }
 
-bool BacktraceData::Add(cmListFileBacktrace const& bt, Json::ArrayIndex& index)
+JBTIndex BacktraceData::Add(cmListFileBacktrace const& bt)
 {
+  JBTIndex index;
   if (bt.Empty()) {
-    return false;
+    return index;
   }
   cmListFileContext const* top = &bt.Top();
   auto found = this->NodeMap.find(top);
   if (found != this->NodeMap.end()) {
-    index = found->second;
-    return true;
+    index.Index = found->second;
+    return index;
   }
   Json::Value entry = Json::objectValue;
   entry["file"] = this->AddFile(top->FilePath);
@@ -197,13 +228,12 @@ bool BacktraceData::Add(cmListFileBacktrace const& bt, 
Json::ArrayIndex& index)
   if (!top->Name.empty()) {
     entry["command"] = this->AddCommand(top->Name);
   }
-  Json::ArrayIndex parent;
-  if (this->Add(bt.Pop(), parent)) {
-    entry["parent"] = parent;
+  if (JBTIndex parent = this->Add(bt.Pop())) {
+    entry["parent"] = parent.Index;
   }
-  index = this->NodeMap[top] = this->Nodes.size();
+  index.Index = this->NodeMap[top] = this->Nodes.size();
   this->Nodes.append(std::move(entry)); // NOLINT(*)
-  return true;
+  return index;
 }
 
 Json::Value BacktraceData::Dump()
@@ -222,9 +252,9 @@ struct CompileData
 {
   struct IncludeEntry
   {
-    BT<std::string> Path;
+    JBT<std::string> Path;
     bool IsSystem = false;
-    IncludeEntry(BT<std::string> path, bool isSystem)
+    IncludeEntry(JBT<std::string> path, bool isSystem)
       : Path(std::move(path))
       , IsSystem(isSystem)
     {
@@ -233,8 +263,8 @@ struct CompileData
 
   std::string Language;
   std::string Sysroot;
-  std::vector<BT<std::string>> Flags;
-  std::vector<BT<std::string>> Defines;
+  std::vector<JBT<std::string>> Flags;
+  std::vector<JBT<std::string>> Defines;
   std::vector<IncludeEntry> Includes;
 };
 
@@ -268,6 +298,12 @@ class Target
   std::map<Json::Value, Json::ArrayIndex> CompileGroupMap;
   std::vector<CompileGroup> CompileGroups;
 
+  template <typename T>
+  JBT<T> ToJBT(BT<T> const& bt)
+  {
+    return JBT<T>(bt.Value, this->Backtraces.Add(bt.Backtrace));
+  }
+
   void ProcessLanguages();
   void ProcessLanguage(std::string const& lang);
 
@@ -276,10 +312,11 @@ class Target
   Json::ArrayIndex AddSourceCompileGroup(cmSourceFile* sf,
                                          Json::ArrayIndex si);
   void AddBacktrace(Json::Value& object, cmListFileBacktrace const& bt);
+  void AddBacktrace(Json::Value& object, JBTIndex bt);
   Json::Value DumpPaths();
   Json::Value DumpCompileData(CompileData const& cd);
   Json::Value DumpInclude(CompileData::IncludeEntry const& inc);
-  Json::Value DumpDefine(BT<std::string> const& def);
+  Json::Value DumpDefine(JBT<std::string> const& def);
   Json::Value DumpSources();
   Json::Value DumpSource(cmGeneratorTarget::SourceAndKind const& sk,
                          Json::ArrayIndex si);
@@ -296,8 +333,8 @@ class Target
   Json::Value DumpLink();
   Json::Value DumpArchive();
   Json::Value DumpLinkCommandFragments();
-  Json::Value DumpCommandFragments(std::vector<BT<std::string>> const& frags);
-  Json::Value DumpCommandFragment(BT<std::string> const& frag,
+  Json::Value DumpCommandFragments(std::vector<JBT<std::string>> const& frags);
+  Json::Value DumpCommandFragment(JBT<std::string> const& frag,
                                   std::string const& role = std::string());
   Json::Value DumpDependencies();
   Json::Value DumpDependency(cmTargetDepend const& td);
@@ -712,19 +749,20 @@ void Target::ProcessLanguage(std::string const& lang)
     // which may need to be factored out.
     std::string flags;
     lg->GetTargetCompileFlags(this->GT, this->Config, lang, flags);
-    cd.Flags.emplace_back(std::move(flags), cmListFileBacktrace());
+    cd.Flags.emplace_back(std::move(flags), JBTIndex());
   }
   std::set<BT<std::string>> defines =
     lg->GetTargetDefines(this->GT, this->Config, lang);
   cd.Defines.reserve(defines.size());
   for (BT<std::string> const& d : defines) {
-    cd.Defines.emplace_back(d);
+    cd.Defines.emplace_back(this->ToJBT(d));
   }
   std::vector<BT<std::string>> includePathList =
     lg->GetIncludeDirectories(this->GT, lang, this->Config);
   for (BT<std::string> const& i : includePathList) {
     cd.Includes.emplace_back(
-      i, this->GT->IsSystemIncludeDirectory(i.Value, this->Config, lang));
+      this->ToJBT(i),
+      this->GT->IsSystemIncludeDirectory(i.Value, this->Config, lang));
   }
 }
 
@@ -763,14 +801,14 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
   const std::string COMPILE_FLAGS("COMPILE_FLAGS");
   if (const char* cflags = sf->GetProperty(COMPILE_FLAGS)) {
     std::string flags = genexInterpreter.Evaluate(cflags, COMPILE_FLAGS);
-    fd.Flags.emplace_back(std::move(flags), cmListFileBacktrace());
+    fd.Flags.emplace_back(std::move(flags), JBTIndex());
   }
   const std::string COMPILE_OPTIONS("COMPILE_OPTIONS");
   if (const char* coptions = sf->GetProperty(COMPILE_OPTIONS)) {
     std::string flags;
     lg->AppendCompileOptions(
       flags, genexInterpreter.Evaluate(coptions, COMPILE_OPTIONS));
-    fd.Flags.emplace_back(std::move(flags), cmListFileBacktrace());
+    fd.Flags.emplace_back(std::move(flags), JBTIndex());
   }
 
   // Add include directories from source file properties.
@@ -810,12 +848,14 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
   fd.Defines.reserve(cd.Defines.size() + fileDefines.size());
   fd.Defines = cd.Defines;
   for (std::string const& d : fileDefines) {
-    fd.Defines.emplace_back(d, cmListFileBacktrace());
+    fd.Defines.emplace_back(d, JBTIndex());
   }
 
   // De-duplicate defines.
-  std::stable_sort(fd.Defines.begin(), fd.Defines.end());
-  auto end = std::unique(fd.Defines.begin(), fd.Defines.end());
+  std::stable_sort(fd.Defines.begin(), fd.Defines.end(),
+                   JBT<std::string>::ValueLess);
+  auto end = std::unique(fd.Defines.begin(), fd.Defines.end(),
+                         JBT<std::string>::ValueEq);
   fd.Defines.erase(end, fd.Defines.end());
 
   return fd;
@@ -843,9 +883,15 @@ Json::ArrayIndex 
Target::AddSourceCompileGroup(cmSourceFile* sf,
 
 void Target::AddBacktrace(Json::Value& object, cmListFileBacktrace const& bt)
 {
-  Json::ArrayIndex backtrace;
-  if (this->Backtraces.Add(bt, backtrace)) {
-    object["backtrace"] = backtrace;
+  if (JBTIndex backtrace = this->Backtraces.Add(bt)) {
+    object["backtrace"] = backtrace.Index;
+  }
+}
+
+void Target::AddBacktrace(Json::Value& object, JBTIndex bt)
+{
+  if (bt) {
+    object["backtrace"] = bt.Index;
   }
 }
 
@@ -935,7 +981,7 @@ Json::Value Target::DumpCompileData(CompileData const& cd)
   }
   if (!cd.Defines.empty()) {
     Json::Value defines = Json::arrayValue;
-    for (BT<std::string> const& d : cd.Defines) {
+    for (JBT<std::string> const& d : cd.Defines) {
       defines.append(this->DumpDefine(d));
     }
     result["defines"] = std::move(defines);
@@ -955,7 +1001,7 @@ Json::Value Target::DumpInclude(CompileData::IncludeEntry 
const& inc)
   return include;
 }
 
-Json::Value Target::DumpDefine(BT<std::string> const& def)
+Json::Value Target::DumpDefine(JBT<std::string> const& def)
 {
   Json::Value define = Json::objectValue;
   define["define"] = def.Value;
@@ -1188,16 +1234,16 @@ Json::Value Target::DumpLinkCommandFragments()
 }
 
 Json::Value Target::DumpCommandFragments(
-  std::vector<BT<std::string>> const& frags)
+  std::vector<JBT<std::string>> const& frags)
 {
   Json::Value commandFragments = Json::arrayValue;
-  for (BT<std::string> const& f : frags) {
+  for (JBT<std::string> const& f : frags) {
     commandFragments.append(this->DumpCommandFragment(f));
   }
   return commandFragments;
 }
 
-Json::Value Target::DumpCommandFragment(BT<std::string> const& frag,
+Json::Value Target::DumpCommandFragment(JBT<std::string> const& frag,
                                         std::string const& role)
 {
   Json::Value fragment = Json::objectValue;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4af094c8dfa8dd5bfb943a84e5f4c00f7bf2ee8f
commit 4af094c8dfa8dd5bfb943a84e5f4c00f7bf2ee8f
Author:     Regina Pfeifer <reg...@mailbox.org>
AuthorDate: Tue Jul 30 12:38:24 2019 +0200
Commit:     Regina Pfeifer <reg...@mailbox.org>
CommitDate: Tue Jul 30 12:38:30 2019 +0200

    clang-tidy: Blacklist violations for version 8
    
    Check the codebase with clang-tidy version 8, fix the low hanging
    fruits, blacklist the rest.

diff --git a/.clang-tidy b/.clang-tidy
index bfcb67c..57e571a 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -3,16 +3,21 @@ Checks: "-*,\
 bugprone-*,\
 -bugprone-macro-parentheses,\
 -bugprone-misplaced-widening-cast,\
+-bugprone-narrowing-conversions,\
+-bugprone-too-small-loop-variable,\
 google-readability-casting,\
 misc-*,\
 -misc-incorrect-roundings,\
 -misc-macro-parentheses,\
 -misc-misplaced-widening-cast,\
+-misc-non-private-member-variables-in-classes,\
 -misc-static-assert,\
 modernize-*,\
+-modernize-avoid-c-arrays,\
 -modernize-deprecated-headers,\
 -modernize-return-braced-init-list,\
 -modernize-use-auto,\
+-modernize-use-nodiscard,\
 -modernize-use-noexcept,\
 -modernize-use-transparent-functors,\
 -modernize-use-using,\
@@ -24,8 +29,11 @@ readability-*,\
 -readability-implicit-bool-cast,\
 -readability-implicit-bool-conversion,\
 -readability-inconsistent-declaration-parameter-name,\
+-readability-isolate-declaration,\
+-readability-magic-numbers,\
 -readability-named-parameter,\
 -readability-redundant-declaration,\
+-readability-uppercase-literal-suffix,\
 "
 HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$'
 CheckOptions:
diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx 
b/Source/CTest/cmParseBlanketJSCoverage.cxx
index 63d6a15..b74decb 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.cxx
+++ b/Source/CTest/cmParseBlanketJSCoverage.cxx
@@ -110,7 +110,8 @@ cmParseBlanketJSCoverage::cmParseBlanketJSCoverage(
 {
 }
 
-bool cmParseBlanketJSCoverage::LoadCoverageData(std::vector<std::string> files)
+bool cmParseBlanketJSCoverage::LoadCoverageData(
+  std::vector<std::string> const& files)
 {
   cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
                      "Found " << files.size() << " Files" << std::endl,
diff --git a/Source/CTest/cmParseBlanketJSCoverage.h 
b/Source/CTest/cmParseBlanketJSCoverage.h
index 696121f..cd1b225 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.h
+++ b/Source/CTest/cmParseBlanketJSCoverage.h
@@ -29,7 +29,7 @@ class cmParseBlanketJSCoverage
 public:
   cmParseBlanketJSCoverage(cmCTestCoverageHandlerContainer& cont,
                            cmCTest* ctest);
-  bool LoadCoverageData(std::vector<std::string> files);
+  bool LoadCoverageData(std::vector<std::string> const& files);
   //  Read the JSON output
   bool ReadJSONFile(std::string const& file);
 
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index ba42669..fa318bc 100644
--- a/Source/cmFileAPI.cxx
+++ b/Source/cmFileAPI.cxx
@@ -684,7 +684,6 @@ void cmFileAPI::BuildClientRequestCodeModel(
 
 Json::Value cmFileAPI::BuildCodeModel(Object const& object)
 {
-  using namespace std::placeholders;
   Json::Value codemodel = cmFileAPICodemodelDump(*this, object.Version);
   codemodel["kind"] = this->ObjectKindName(object.Kind);
 
@@ -719,7 +718,6 @@ void cmFileAPI::BuildClientRequestCache(
 
 Json::Value cmFileAPI::BuildCache(Object const& object)
 {
-  using namespace std::placeholders;
   Json::Value cache = cmFileAPICacheDump(*this, object.Version);
   cache["kind"] = this->ObjectKindName(object.Kind);
 
@@ -754,7 +752,6 @@ void cmFileAPI::BuildClientRequestCMakeFiles(
 
 Json::Value cmFileAPI::BuildCMakeFiles(Object const& object)
 {
-  using namespace std::placeholders;
   Json::Value cmakeFiles = cmFileAPICMakeFilesDump(*this, object.Version);
   cmakeFiles["kind"] = this->ObjectKindName(object.Kind);
 
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 7b916cd..0c4f5c4 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -287,7 +287,7 @@ class Target
                                          Json::ArrayIndex si);
   void AddBacktrace(Json::Value& object, cmListFileBacktrace const& bt);
   Json::Value DumpPaths();
-  Json::Value DumpCompileData(CompileData cd);
+  Json::Value DumpCompileData(CompileData const& cd);
   Json::Value DumpInclude(CompileData::IncludeEntry const& inc);
   Json::Value DumpDefine(BT<std::string> const& def);
   Json::Value DumpSources();
@@ -915,7 +915,7 @@ Json::Value 
Target::DumpSource(cmGeneratorTarget::SourceAndKind const& sk,
   return source;
 }
 
-Json::Value Target::DumpCompileData(CompileData cd)
+Json::Value Target::DumpCompileData(CompileData const& cd)
 {
   Json::Value result = Json::objectValue;
 
diff --git a/Source/cmNewLineStyle.cxx b/Source/cmNewLineStyle.cxx
index 3f6523e..1ff741e 100644
--- a/Source/cmNewLineStyle.cxx
+++ b/Source/cmNewLineStyle.cxx
@@ -41,7 +41,7 @@ bool cmNewLineStyle::ReadFromArguments(const 
std::vector<std::string>& args,
   return true;
 }
 
-const std::string cmNewLineStyle::GetCharacters() const
+std::string cmNewLineStyle::GetCharacters() const
 {
   switch (NewLineStyle) {
     case Invalid:
diff --git a/Source/cmNewLineStyle.h b/Source/cmNewLineStyle.h
index f1a7bc6..ab9002e 100644
--- a/Source/cmNewLineStyle.h
+++ b/Source/cmNewLineStyle.h
@@ -30,7 +30,7 @@ public:
   bool ReadFromArguments(const std::vector<std::string>& args,
                          std::string& errorString);
 
-  const std::string GetCharacters() const;
+  std::string GetCharacters() const;
 
 private:
   Style NewLineStyle = Invalid;
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index c5de742..8fcb710 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -378,8 +378,7 @@ void cmServerProtocol1::HandleCMakeFileChanges(const 
std::string& path,
   SendSignal(kFILE_CHANGE_SIGNAL, obj);
 }
 
-const cmServerResponse cmServerProtocol1::Process(
-  const cmServerRequest& request)
+cmServerResponse cmServerProtocol1::Process(const cmServerRequest& request)
 {
   assert(this->m_State >= STATE_ACTIVE);
 
diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h
index 2f55a20..5da4344 100644
--- a/Source/cmServerProtocol.h
+++ b/Source/cmServerProtocol.h
@@ -80,7 +80,7 @@ public:
 
   virtual std::pair<int, int> ProtocolVersion() const = 0;
   virtual bool IsExperimental() const = 0;
-  virtual const cmServerResponse Process(const cmServerRequest& request) = 0;
+  virtual cmServerResponse Process(const cmServerRequest& request) = 0;
 
   bool Activate(cmServer* server, const cmServerRequest& request,
                 std::string* errorMessage);
@@ -106,7 +106,7 @@ class cmServerProtocol1 : public cmServerProtocol
 public:
   std::pair<int, int> ProtocolVersion() const override;
   bool IsExperimental() const override;
-  const cmServerResponse Process(const cmServerRequest& request) override;
+  cmServerResponse Process(const cmServerRequest& request) override;
 
 private:
   bool DoActivate(const cmServerRequest& request,
diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h
index 5ea0085..4ca78fa 100644
--- a/Source/cmTargetDepend.h
+++ b/Source/cmTargetDepend.h
@@ -31,7 +31,7 @@ public:
   operator cmGeneratorTarget const*() const { return this->Target; }
   cmGeneratorTarget const* operator->() const { return this->Target; }
   cmGeneratorTarget const& operator*() const { return *this->Target; }
-  friend bool operator<(cmTargetDepend l, cmTargetDepend r)
+  friend bool operator<(cmTargetDepend const& l, cmTargetDepend const& r)
   {
     return l.Target < r.Target;
   }
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 7250e51..eb57947 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -619,7 +619,7 @@ void cmake::LoadEnvironmentPresets()
     this->EnvironmentGenerator = envGenVar;
   }
 
-  auto readGeneratorVar = [&](std::string name, std::string& key) {
+  auto readGeneratorVar = [&](std::string const& name, std::string& key) {
     std::string varValue;
     if (cmSystemTools::GetEnv(name, varValue)) {
       if (hasEnvironmentGenerator) {

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=833d9eae4e49ef7b9055c709fd8a6959588952c3
commit 833d9eae4e49ef7b9055c709fd8a6959588952c3
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Mon Jul 29 10:06:18 2019 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Mon Jul 29 10:21:27 2019 -0400

    fileapi: Refactor codemodel defines de-duplication

diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 0c4f5c4..9ff8ffa 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -231,8 +231,6 @@ struct CompileData
     }
   };
 
-  void SetDefines(std::set<BT<std::string>> const& defines);
-
   std::string Language;
   std::string Sysroot;
   std::vector<BT<std::string>> Flags;
@@ -240,14 +238,6 @@ struct CompileData
   std::vector<IncludeEntry> Includes;
 };
 
-void CompileData::SetDefines(std::set<BT<std::string>> const& defines)
-{
-  this->Defines.reserve(defines.size());
-  for (BT<std::string> const& d : defines) {
-    this->Defines.push_back(d);
-  }
-}
-
 class Target
 {
   cmGeneratorTarget* GT;
@@ -726,7 +716,10 @@ void Target::ProcessLanguage(std::string const& lang)
   }
   std::set<BT<std::string>> defines =
     lg->GetTargetDefines(this->GT, this->Config, lang);
-  cd.SetDefines(defines);
+  cd.Defines.reserve(defines.size());
+  for (BT<std::string> const& d : defines) {
+    cd.Defines.emplace_back(d);
+  }
   std::vector<BT<std::string>> includePathList =
     lg->GetIncludeDirectories(this->GT, lang, this->Config);
   for (BT<std::string> const& i : includePathList) {
@@ -814,11 +807,16 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
       genexInterpreter.Evaluate(config_defs, COMPILE_DEFINITIONS));
   }
 
-  std::set<BT<std::string>> defines;
-  defines.insert(fileDefines.begin(), fileDefines.end());
-  defines.insert(cd.Defines.begin(), cd.Defines.end());
+  fd.Defines.reserve(cd.Defines.size() + fileDefines.size());
+  fd.Defines = cd.Defines;
+  for (std::string const& d : fileDefines) {
+    fd.Defines.emplace_back(d, cmListFileBacktrace());
+  }
 
-  fd.SetDefines(defines);
+  // De-duplicate defines.
+  std::stable_sort(fd.Defines.begin(), fd.Defines.end());
+  auto end = std::unique(fd.Defines.begin(), fd.Defines.end());
+  fd.Defines.erase(end, fd.Defines.end());
 
   return fd;
 }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c9c397a14ac59b25e43ce43264a420b2f9537547
commit c9c397a14ac59b25e43ce43264a420b2f9537547
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Mon Jul 29 10:19:32 2019 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Mon Jul 29 10:21:27 2019 -0400

    fileapi: Avoid unnecessary CompileData move

diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 7b916cd..0c4f5c4 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -287,7 +287,7 @@ class Target
                                          Json::ArrayIndex si);
   void AddBacktrace(Json::Value& object, cmListFileBacktrace const& bt);
   Json::Value DumpPaths();
-  Json::Value DumpCompileData(CompileData cd);
+  Json::Value DumpCompileData(CompileData const& cd);
   Json::Value DumpInclude(CompileData::IncludeEntry const& inc);
   Json::Value DumpDefine(BT<std::string> const& def);
   Json::Value DumpSources();
@@ -915,7 +915,7 @@ Json::Value 
Target::DumpSource(cmGeneratorTarget::SourceAndKind const& sk,
   return source;
 }
 
-Json::Value Target::DumpCompileData(CompileData cd)
+Json::Value Target::DumpCompileData(CompileData const& cd)
 {
   Json::Value result = Json::objectValue;
 

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

Summary of changes:
 .clang-tidy                               |   8 +
 Source/CTest/cmParseBlanketJSCoverage.cxx |   3 +-
 Source/CTest/cmParseBlanketJSCoverage.h   |   2 +-
 Source/cmFileAPI.cxx                      |   3 -
 Source/cmFileAPICodemodel.cxx             | 236 ++++++++++++++++++++++--------
 Source/cmNewLineStyle.cxx                 |   2 +-
 Source/cmNewLineStyle.h                   |   2 +-
 Source/cmServerProtocol.cxx               |   3 +-
 Source/cmServerProtocol.h                 |   4 +-
 Source/cmTargetDepend.h                   |   2 +-
 Source/cmake.cxx                          |   2 +-
 11 files changed, 195 insertions(+), 72 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
https://cmake.org/mailman/listinfo/cmake-commits

Reply via email to