Pārlūkot izejas kodu

cmGeneratorExpressionDAGChecker: Construct with initializer list syntax

Brad King 8 mēneši atpakaļ
vecāks
revīzija
82151ea289

+ 4 - 3
Source/cmCommonTargetGenerator.cxx

@@ -500,9 +500,10 @@ std::string cmCommonTargetGenerator::GetLinkerLauncher(
   std::string propName = lang + "_LINKER_LAUNCHER";
   cmValue launcherProp = this->GeneratorTarget->GetProperty(propName);
   if (cmNonempty(launcherProp)) {
-    cmGeneratorExpressionDAGChecker dagChecker(
-      this->GeneratorTarget, propName, nullptr, nullptr,
-      this->LocalCommonGenerator, config);
+    cmGeneratorExpressionDAGChecker dagChecker{
+      this->GeneratorTarget,      propName, nullptr, nullptr,
+      this->LocalCommonGenerator, config,
+    };
     std::string evaluatedLinklauncher = cmGeneratorExpression::Evaluate(
       *launcherProp, this->LocalCommonGenerator, config, this->GeneratorTarget,
       &dagChecker, this->GeneratorTarget, lang);

+ 14 - 12
Source/cmComputeLinkDepends.cxx

@@ -583,18 +583,18 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
         if (cmValue feature = this->Target->GetProperty(key)) {
           if (!feature->empty() && key.length() > lloPrefix.length()) {
             auto item = key.substr(lloPrefix.length());
-            cmGeneratorExpressionDAGChecker dag{
+            cmGeneratorExpressionDAGChecker dagChecker{
               this->Target->GetBacktrace(),
               this->Target,
               "LINK_LIBRARY_OVERRIDE",
               nullptr,
               nullptr,
               this->Target->GetLocalGenerator(),
-              config
+              config,
             };
             auto overrideFeature = cmGeneratorExpression::Evaluate(
               *feature, this->Target->GetLocalGenerator(), config,
-              this->Target, &dag, this->Target, linkLanguage);
+              this->Target, &dagChecker, this->Target, linkLanguage);
             this->LinkLibraryOverride.emplace(item, overrideFeature);
           }
         }
@@ -603,16 +603,18 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
   // global override property
   if (cmValue linkLibraryOverride =
         this->Target->GetProperty("LINK_LIBRARY_OVERRIDE")) {
-    cmGeneratorExpressionDAGChecker dag{ target->GetBacktrace(),
-                                         target,
-                                         "LINK_LIBRARY_OVERRIDE",
-                                         nullptr,
-                                         nullptr,
-                                         target->GetLocalGenerator(),
-                                         config };
+    cmGeneratorExpressionDAGChecker dagChecker{
+      target->GetBacktrace(),
+      target,
+      "LINK_LIBRARY_OVERRIDE",
+      nullptr,
+      nullptr,
+      target->GetLocalGenerator(),
+      config,
+    };
     auto overrideValue = cmGeneratorExpression::Evaluate(
-      *linkLibraryOverride, target->GetLocalGenerator(), config, target, &dag,
-      target, linkLanguage);
+      *linkLibraryOverride, target->GetLocalGenerator(), config, target,
+      &dagChecker, target, linkLanguage);
 
     auto overrideList = cmTokenize(overrideValue, ","_s);
     if (overrideList.size() >= 2) {

+ 8 - 3
Source/cmExportTryCompileFileGenerator.cxx

@@ -79,9 +79,14 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
       tgt, "LINK_OPTIONS", nullptr, nullptr, tgt->GetLocalGenerator(),
       this->Config);
   }
-  cmGeneratorExpressionDAGChecker dagChecker(
-    tgt, propName, nullptr, parentDagChecker.get(), tgt->GetLocalGenerator(),
-    this->Config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    tgt,
+    propName,
+    nullptr,
+    parentDagChecker.get(),
+    tgt->GetLocalGenerator(),
+    this->Config,
+  };
 
   std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop);
 

+ 7 - 3
Source/cmGeneratorExpression.cxx

@@ -422,10 +422,14 @@ const std::string& cmGeneratorExpressionInterpreter::Evaluate(
     this->GeneratorExpression.Parse(std::move(expression));
 
   // Specify COMPILE_OPTIONS to DAGchecker, same semantic as COMPILE_FLAGS
-  cmGeneratorExpressionDAGChecker dagChecker(
+  cmGeneratorExpressionDAGChecker dagChecker{
     this->HeadTarget,
-    property == "COMPILE_FLAGS" ? "COMPILE_OPTIONS" : property, nullptr,
-    nullptr, this->LocalGenerator, this->Config);
+    property == "COMPILE_FLAGS" ? "COMPILE_OPTIONS" : property,
+    nullptr,
+    nullptr,
+    this->LocalGenerator,
+    this->Config,
+  };
 
   return this->CompiledGeneratorExpression->Evaluate(
     this->LocalGenerator, this->Config, this->HeadTarget, &dagChecker, nullptr,

+ 13 - 7
Source/cmGeneratorExpressionNode.cxx

@@ -485,10 +485,15 @@ protected:
     cmGeneratorExpressionDAGChecker* dagCheckerParent) const
   {
     if (context->HeadTarget) {
-      cmGeneratorExpressionDAGChecker dagChecker(
-        context->Backtrace, context->HeadTarget,
-        genexOperator + ":" + expression, content, dagCheckerParent,
-        context->LG, context->Config);
+      cmGeneratorExpressionDAGChecker dagChecker{
+        context->Backtrace,
+        context->HeadTarget,
+        genexOperator + ":" + expression,
+        content,
+        dagCheckerParent,
+        context->LG,
+        context->Config,
+      };
       switch (dagChecker.Check()) {
         case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
         case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: {
@@ -2987,9 +2992,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
                                           dagCheckerParent, usage));
     }
 
-    cmGeneratorExpressionDAGChecker dagChecker(
-      context->Backtrace, target, propertyName, content, dagCheckerParent,
-      context->LG, context->Config);
+    cmGeneratorExpressionDAGChecker dagChecker{
+      context->Backtrace, target,      propertyName,    content,
+      dagCheckerParent,   context->LG, context->Config,
+    };
 
     switch (dagChecker.Check()) {
       case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:

+ 10 - 7
Source/cmGeneratorTarget.cxx

@@ -711,8 +711,9 @@ std::string cmGeneratorTarget::GetLinkerTypeProperty(
   std::string propName{ "LINKER_TYPE" };
   auto linkerType = this->GetProperty(propName);
   if (!linkerType.IsEmpty()) {
-    cmGeneratorExpressionDAGChecker dagChecker(
-      this, propName, nullptr, nullptr, this->LocalGenerator, config);
+    cmGeneratorExpressionDAGChecker dagChecker{
+      this, propName, nullptr, nullptr, this->LocalGenerator, config,
+    };
     auto ltype =
       cmGeneratorExpression::Evaluate(*linkerType, this->GetLocalGenerator(),
                                       config, this, &dagChecker, this, lang);
@@ -1176,9 +1177,10 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
   auto iter = this->SystemIncludesCache.find(key);
 
   if (iter == this->SystemIncludesCache.end()) {
-    cmGeneratorExpressionDAGChecker dagChecker(
-      this, "SYSTEM_INCLUDE_DIRECTORIES", nullptr, nullptr,
-      this->LocalGenerator, config);
+    cmGeneratorExpressionDAGChecker dagChecker{
+      this,    "SYSTEM_INCLUDE_DIRECTORIES", nullptr,
+      nullptr, this->LocalGenerator,         config,
+    };
 
     bool excludeImported = this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED");
 
@@ -1938,8 +1940,9 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
     return;
   }
 
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "AUTOUIC_OPTIONS", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "AUTOUIC_OPTIONS", nullptr, nullptr, this->LocalGenerator, config,
+  };
   cmExpandList(cmGeneratorExpression::Evaluate(prop, this->LocalGenerator,
                                                config, this, &dagChecker),
                result);

+ 14 - 13
Source/cmGeneratorTarget_IncludeDirectories.cxx

@@ -47,13 +47,13 @@ std::string AddLangSpecificInterfaceIncludeDirectories(
   const std::string& propertyName, IncludeDirectoryFallBack mode,
   cmGeneratorExpressionDAGChecker* context)
 {
-  cmGeneratorExpressionDAGChecker dag{
+  cmGeneratorExpressionDAGChecker dagChecker{
     target->GetBacktrace(),      target, propertyName, nullptr, context,
-    target->GetLocalGenerator(), config
+    target->GetLocalGenerator(), config,
   };
-  switch (dag.Check()) {
+  switch (dagChecker.Check()) {
     case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
-      dag.ReportError(
+      dagChecker.ReportError(
         nullptr, "$<TARGET_PROPERTY:" + target->GetName() + ",propertyName");
       CM_FALLTHROUGH;
     case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
@@ -100,9 +100,9 @@ void AddLangSpecificImplicitIncludeDirectories(
 {
   if (const auto* libraries =
         target->GetLinkImplementationLibraries(config, UseTo::Compile)) {
-    cmGeneratorExpressionDAGChecker dag{
+    cmGeneratorExpressionDAGChecker dagChecker{
       target->GetBacktrace(),      target, propertyName, nullptr, nullptr,
-      target->GetLocalGenerator(), config
+      target->GetLocalGenerator(), config,
     };
 
     for (const cmLinkImplItem& library : libraries->Libraries) {
@@ -128,10 +128,10 @@ void AddLangSpecificImplicitIncludeDirectories(
             }
           }
 
-          cmExpandList(
-            AddLangSpecificInterfaceIncludeDirectories(
-              target, dependency, lang, config, propertyName, mode, &dag),
-            entry.Values);
+          cmExpandList(AddLangSpecificInterfaceIncludeDirectories(
+                         target, dependency, lang, config, propertyName, mode,
+                         &dagChecker),
+                       entry.Values);
           entries.Entries.emplace_back(std::move(entry));
         }
       }
@@ -257,9 +257,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
   std::vector<BT<std::string>> includes;
   std::unordered_set<std::string> uniqueIncludes;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this, "INCLUDE_DIRECTORIES",
-                                             nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this,    "INCLUDE_DIRECTORIES", nullptr,
+    nullptr, this->LocalGenerator,  config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };

+ 6 - 4
Source/cmGeneratorTarget_Link.cxx

@@ -564,8 +564,9 @@ void cmGeneratorTarget::ExpandLinkItems(std::string const& prop,
     return;
   }
   // Keep this logic in sync with ComputeLinkImplementationLibraries.
-  cmGeneratorExpressionDAGChecker dagChecker(this, prop, nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, prop, nullptr, nullptr, this->LocalGenerator, config,
+  };
   // The $<LINK_ONLY> expression may be in a link interface to specify
   // private link dependencies that are otherwise excluded from usage
   // requirements.
@@ -1320,8 +1321,9 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
   // Collect libraries directly linked in this configuration.
   for (auto const& entry : entryRange) {
     // Keep this logic in sync with ExpandLinkItems.
-    cmGeneratorExpressionDAGChecker dagChecker(
-      this, "LINK_LIBRARIES", nullptr, nullptr, this->LocalGenerator, config);
+    cmGeneratorExpressionDAGChecker dagChecker{
+      this, "LINK_LIBRARIES", nullptr, nullptr, this->LocalGenerator, config,
+    };
     // The $<LINK_ONLY> expression may be used to specify link dependencies
     // that are otherwise excluded from usage requirements.
     if (usage == UseTo::Compile) {

+ 3 - 2
Source/cmGeneratorTarget_LinkDirectories.cxx

@@ -125,8 +125,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueDirectories;
 
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "LINK_DIRECTORIES", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "LINK_DIRECTORIES", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };

+ 23 - 17
Source/cmGeneratorTarget_Options.cxx

@@ -217,8 +217,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "COMPILE_OPTIONS", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "COMPILE_OPTIONS", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -258,8 +259,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueFeatures;
 
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "COMPILE_FEATURES", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "COMPILE_FEATURES", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -308,9 +310,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
   std::vector<BT<std::string>> list;
   std::unordered_set<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this, "COMPILE_DEFINITIONS",
-                                             nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this,    "COMPILE_DEFINITIONS", nullptr,
+    nullptr, this->LocalGenerator,  config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -373,9 +376,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
   }
   std::unordered_set<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this, "PRECOMPILE_HEADERS",
-                                             nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "PRECOMPILE_HEADERS", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -432,8 +435,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "LINK_OPTIONS", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "LINK_OPTIONS", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -601,9 +605,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this, "STATIC_LIBRARY_OPTIONS",
-                                             nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this,    "STATIC_LIBRARY_OPTIONS", nullptr,
+    nullptr, this->LocalGenerator,     config,
+  };
 
   EvaluatedTargetPropertyEntries entries;
   if (cmValue linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
@@ -634,8 +639,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
 {
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueOptions;
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "LINK_DEPENDS", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "LINK_DEPENDS", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   EvaluatedTargetPropertyEntries entries;
   if (cmValue linkDepends = this->GetProperty("LINK_DEPENDS")) {

+ 3 - 2
Source/cmGeneratorTarget_Sources.cxx

@@ -264,8 +264,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
     this->DebugSourcesDone = true;
   }
 
-  cmGeneratorExpressionDAGChecker dagChecker(this, "SOURCES", nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "SOURCES", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
     this, config, std::string(), &dagChecker, this->SourceEntries);

+ 9 - 3
Source/cmGeneratorTarget_TransitiveProperty.cxx

@@ -109,9 +109,15 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
   // Evaluate $<TARGET_PROPERTY:this,prop> as if it were compiled.  This is
   // a subset of TargetPropertyNode::Evaluate without stringify/parse steps
   // but sufficient for transitive interface properties.
-  cmGeneratorExpressionDAGChecker dagChecker(
-    context->Backtrace, this, prop, nullptr, dagCheckerParent,
-    this->LocalGenerator, context->Config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    context->Backtrace,
+    this,
+    prop,
+    nullptr,
+    dagCheckerParent,
+    this->LocalGenerator,
+    context->Config,
+  };
   switch (dagChecker.Check()) {
     case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
       dagChecker.ReportError(

+ 8 - 6
Source/cmQtAutoGenInitializer.cxx

@@ -1923,9 +1923,10 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
     if (this->MultiConfig) {
       for (auto const& cfg : this->ConfigsList) {
         if (!cfg.empty()) {
-          cmGeneratorExpressionDAGChecker dagChecker(
-            this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr, nullptr,
-            this->LocalGen, cfg);
+          cmGeneratorExpressionDAGChecker dagChecker{
+            this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr,
+            nullptr,         this->LocalGen,        cfg,
+          };
           AddInterfaceEntries(this->GenTarget, cfg,
                               "INTERFACE_AUTOMOC_MACRO_NAMES", "CXX",
                               &dagChecker, InterfaceAutoMocMacroNamesEntries,
@@ -1933,9 +1934,10 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
         }
       }
     } else {
-      cmGeneratorExpressionDAGChecker dagChecker(
-        this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr, nullptr,
-        this->LocalGen, this->ConfigDefault);
+      cmGeneratorExpressionDAGChecker dagChecker{
+        this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr,
+        nullptr,         this->LocalGen,        this->ConfigDefault,
+      };
       AddInterfaceEntries(this->GenTarget, this->ConfigDefault,
                           "INTERFACE_AUTOMOC_MACRO_NAMES", "CXX", &dagChecker,
                           InterfaceAutoMocMacroNamesEntries,