Browse Source

Source: Minor optimizations

AJIOB 3 weeks ago
parent
commit
2cae68ecbe
3 changed files with 7 additions and 7 deletions
  1. 1 1
      Source/cmGeneratorTarget.cxx
  2. 4 4
      Source/cmGeneratorTarget_Options.cxx
  3. 2 2
      Source/cmIDEOptions.cxx

+ 1 - 1
Source/cmGeneratorTarget.cxx

@@ -81,7 +81,7 @@ static void CreatePropertyGeneratorExpressions(
   bool evaluateForBuildsystem = false)
   bool evaluateForBuildsystem = false)
 {
 {
   for (auto const& entry : entries) {
   for (auto const& entry : entries) {
-    items.push_back(cmGeneratorTarget::TargetPropertyEntry::Create(
+    items.emplace_back(cmGeneratorTarget::TargetPropertyEntry::Create(
       cmakeInstance, entry, evaluateForBuildsystem));
       cmakeInstance, entry, evaluateForBuildsystem));
   }
   }
 }
 }

+ 4 - 4
Source/cmGeneratorTarget_Options.cxx

@@ -76,15 +76,15 @@ void processOptions(cmGeneratorTarget const* tgt,
           options.emplace_back(opt, entry.Backtrace);
           options.emplace_back(opt, entry.Backtrace);
         }
         }
         if (debugOptions) {
         if (debugOptions) {
-          usedOptions += " * " + opt + "\n";
+          usedOptions += cmStrCat(" * ", opt, '\n');
         }
         }
       }
       }
     }
     }
     if (!usedOptions.empty()) {
     if (!usedOptions.empty()) {
       tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
       tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
         MessageType::LOG,
         MessageType::LOG,
-        std::string("Used ") + logName + std::string(" for target ") +
-          tgt->GetName() + ":\n" + usedOptions,
+        cmStrCat("Used ", logName, " for target ", tgt->GetName(), ":\n",
+                 usedOptions),
         entry.Backtrace);
         entry.Backtrace);
     }
     }
   }
   }
@@ -305,7 +305,7 @@ void cmGeneratorTarget::GetCompileDefinitions(
 {
 {
   std::vector<BT<std::string>> tmp =
   std::vector<BT<std::string>> tmp =
     this->GetCompileDefinitions(config, language);
     this->GetCompileDefinitions(config, language);
-  result.reserve(tmp.size());
+  result.reserve(result.size() + tmp.size());
   for (BT<std::string>& v : tmp) {
   for (BT<std::string>& v : tmp) {
     result.emplace_back(std::move(v.Value));
     result.emplace_back(std::move(v.Value));
   }
   }

+ 2 - 2
Source/cmIDEOptions.cxx

@@ -62,7 +62,7 @@ void cmIDEOptions::HandleFlag(std::string const& flag)
         this->DoingDefine = true;
         this->DoingDefine = true;
       } else {
       } else {
         // Store this definition.
         // Store this definition.
-        this->Defines.push_back(flag.substr(2));
+        this->Defines.emplace_back(flag.substr(2));
       }
       }
       return;
       return;
     }
     }
@@ -73,7 +73,7 @@ void cmIDEOptions::HandleFlag(std::string const& flag)
         this->DoingInclude = true;
         this->DoingInclude = true;
       } else {
       } else {
         // Store this include directory.
         // Store this include directory.
-        this->Includes.push_back(flag.substr(2));
+        this->Includes.emplace_back(flag.substr(2));
       }
       }
       return;
       return;
     }
     }