Browse Source

cmLocalGenerator: Remove unused IncludePathStyle infrastructure

It is unused since commit c564a3e3ff (Ninja: Always compile sources
using absolute paths, 2021-05-19, v3.21.0-rc1~129^2), which left
behind a FIXME comment to eventually remove it.
Brad King 3 years ago
parent
commit
94a58e502b

+ 1 - 2
Source/cmExtraSublimeTextGenerator.cxx

@@ -435,8 +435,7 @@ std::string cmExtraSublimeTextGenerator::ComputeIncludes(
   lg->GetIncludeDirectories(includes, target, language, config);
 
   std::string includesString =
-    lg->GetIncludeFlags(includes, target, language, config, false,
-                        cmLocalGenerator::IncludePathStyle::Absolute);
+    lg->GetIncludeFlags(includes, target, language, config, false);
 
   return includesString;
 }

+ 3 - 6
Source/cmLocalGenerator.cxx

@@ -835,16 +835,14 @@ cmValue cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
 }
 
 std::string cmLocalGenerator::ConvertToIncludeReference(
-  std::string const& path, IncludePathStyle pathStyle, OutputFormat format)
+  std::string const& path, OutputFormat format)
 {
-  static_cast<void>(pathStyle);
   return this->ConvertToOutputForExisting(path, format);
 }
 
 std::string cmLocalGenerator::GetIncludeFlags(
   std::vector<std::string> const& includeDirs, cmGeneratorTarget* target,
-  std::string const& lang, std::string const& config, bool forResponseFile,
-  IncludePathStyle pathStyle)
+  std::string const& lang, std::string const& config, bool forResponseFile)
 {
   if (lang.empty()) {
     return "";
@@ -923,8 +921,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
       }
       flagUsed = true;
     }
-    std::string includePath =
-      this->ConvertToIncludeReference(i, pathStyle, shellFormat);
+    std::string includePath = this->ConvertToIncludeReference(i, shellFormat);
     if (quotePaths && !includePath.empty() && includePath.front() != '\"') {
       includeFlags << "\"";
     }

+ 9 - 16
Source/cmLocalGenerator.h

@@ -179,18 +179,12 @@ public:
   bool AppendLWYUFlags(std::string& flags, const cmGeneratorTarget* target,
                        const std::string& lang);
 
-  enum class IncludePathStyle
-  {
-    Default,
-    Absolute,
-  };
-
   //! Get the include flags for the current makefile and language
-  std::string GetIncludeFlags(
-    std::vector<std::string> const& includes, cmGeneratorTarget* target,
-    std::string const& lang, std::string const& config,
-    bool forResponseFile = false,
-    IncludePathStyle pathStyle = IncludePathStyle::Default);
+  std::string GetIncludeFlags(std::vector<std::string> const& includes,
+                              cmGeneratorTarget* target,
+                              std::string const& lang,
+                              std::string const& config,
+                              bool forResponseFile = false);
 
   using GeneratorTargetVector =
     std::vector<std::unique_ptr<cmGeneratorTarget>>;
@@ -526,12 +520,11 @@ public:
   cmValue GetRuleLauncher(cmGeneratorTarget* target, const std::string& prop);
 
 protected:
-  // The default implementation ignores the IncludePathStyle and always
-  // uses absolute paths.  A generator may override this to use relative
-  // paths in some cases.
+  // The default implementation converts to a Windows shortpath to
+  // help older toolchains handle spaces and such.  A generator may
+  // override this to avoid that conversion.
   virtual std::string ConvertToIncludeReference(
-    std::string const& path, IncludePathStyle pathStyle,
-    cmOutputConverter::OutputFormat format);
+    std::string const& path, cmOutputConverter::OutputFormat format);
 
   //! put all the libraries for a target on into the given stream
   void OutputLinkLibraries(cmComputeLinkInformation* pcli,

+ 1 - 4
Source/cmLocalNinjaGenerator.cxx

@@ -205,11 +205,8 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
 // Virtual protected methods.
 
 std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
-  std::string const& path, IncludePathStyle pathStyle,
-  cmOutputConverter::OutputFormat format)
+  std::string const& path, cmOutputConverter::OutputFormat format)
 {
-  // FIXME: Remove IncludePathStyle infrastructure.  It is no longer used.
-  static_cast<void>(pathStyle);
   return this->ConvertToOutputFormat(path, format);
 }
 

+ 1 - 3
Source/cmLocalNinjaGenerator.h

@@ -12,7 +12,6 @@
 
 #include "cmListFileCache.h"
 #include "cmLocalCommonGenerator.h"
-#include "cmLocalGenerator.h"
 #include "cmNinjaTypes.h"
 #include "cmOutputConverter.h"
 
@@ -93,8 +92,7 @@ public:
 
 protected:
   std::string ConvertToIncludeReference(
-    std::string const& path, IncludePathStyle pathStyle,
-    cmOutputConverter::OutputFormat format) override;
+    std::string const& path, cmOutputConverter::OutputFormat format) override;
 
 private:
   cmGeneratedFileStream& GetImplFileStream(const std::string& config) const;

+ 3 - 8
Source/cmNinjaTargetGenerator.cxx

@@ -263,10 +263,7 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
                                               language, config);
   // Add include directory flags.
   std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
-    includes, this->GeneratorTarget, language, config, false,
-    // full include paths for RC needed by cmcldeps
-    language == "RC" ? cmLocalGenerator::IncludePathStyle::Absolute
-                     : cmLocalGenerator::IncludePathStyle::Default);
+    includes, this->GeneratorTarget, language, config, false);
   if (this->GetGlobalGenerator()->IsGCCOnWindows()) {
     std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/');
   }
@@ -325,8 +322,7 @@ std::string cmNinjaTargetGenerator::ComputeIncludes(
   }
 
   std::string includesString = this->LocalGenerator->GetIncludeFlags(
-    includes, this->GeneratorTarget, language, config, false,
-    cmLocalGenerator::IncludePathStyle::Absolute);
+    includes, this->GeneratorTarget, language, config, false);
   this->LocalGenerator->AppendFlags(includesString,
                                     this->GetIncludes(language, config));
 
@@ -1413,8 +1409,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
         cmSystemTools::GetParentDirectory(source->GetFullPath()));
 
       std::string sourceDirectoryFlag = this->LocalGenerator->GetIncludeFlags(
-        sourceDirectory, this->GeneratorTarget, language, config, false,
-        cmLocalGenerator::IncludePathStyle::Default);
+        sourceDirectory, this->GeneratorTarget, language, config, false);
 
       vars["INCLUDES"] = cmStrCat(sourceDirectoryFlag, ' ', vars["INCLUDES"]);
     }