@@ -259,9 +259,7 @@ static bool getSystemRegistryString(const char *keyPath, const char *valueName,
259259#endif // _WIN32
260260}
261261
262- namespace llvm {
263-
264- const char *archToWindowsSDKArch (Triple::ArchType Arch) {
262+ const char *llvm::archToWindowsSDKArch (Triple::ArchType Arch) {
265263 switch (Arch) {
266264 case Triple::ArchType::x86:
267265 return " x86" ;
@@ -277,7 +275,7 @@ const char *archToWindowsSDKArch(Triple::ArchType Arch) {
277275 }
278276}
279277
280- const char *archToLegacyVCArch (Triple::ArchType Arch) {
278+ const char *llvm:: archToLegacyVCArch (Triple::ArchType Arch) {
281279 switch (Arch) {
282280 case Triple::ArchType::x86:
283281 // x86 is default in legacy VC toolchains.
@@ -295,7 +293,7 @@ const char *archToLegacyVCArch(Triple::ArchType Arch) {
295293 }
296294}
297295
298- const char *archToDevDivInternalArch (Triple::ArchType Arch) {
296+ const char *llvm:: archToDevDivInternalArch (Triple::ArchType Arch) {
299297 switch (Arch) {
300298 case Triple::ArchType::x86:
301299 return " i386" ;
@@ -311,8 +309,9 @@ const char *archToDevDivInternalArch(Triple::ArchType Arch) {
311309 }
312310}
313311
314- bool appendArchToWindowsSDKLibPath (int SDKMajor, SmallString<128 > LibPath,
315- Triple::ArchType Arch, std::string &path) {
312+ bool llvm::appendArchToWindowsSDKLibPath (int SDKMajor, SmallString<128 > LibPath,
313+ Triple::ArchType Arch,
314+ std::string &path) {
316315 if (SDKMajor >= 8 ) {
317316 sys::path::append (LibPath, archToWindowsSDKArch (Arch));
318317 } else {
@@ -336,10 +335,11 @@ bool appendArchToWindowsSDKLibPath(int SDKMajor, SmallString<128> LibPath,
336335 return true ;
337336}
338337
339- std::string getSubDirectoryPath (SubDirectoryType Type, ToolsetLayout VSLayout,
340- const std::string &VCToolChainPath,
341- Triple::ArchType TargetArch,
342- StringRef SubdirParent) {
338+ std::string llvm::getSubDirectoryPath (SubDirectoryType Type,
339+ ToolsetLayout VSLayout,
340+ const std::string &VCToolChainPath,
341+ Triple::ArchType TargetArch,
342+ StringRef SubdirParent) {
343343 const char *SubdirName;
344344 const char *IncludeName;
345345 switch (VSLayout) {
@@ -390,19 +390,22 @@ std::string getSubDirectoryPath(SubDirectoryType Type, ToolsetLayout VSLayout,
390390 return std::string (Path);
391391}
392392
393- bool useUniversalCRT (ToolsetLayout VSLayout, const std::string &VCToolChainPath,
394- Triple::ArchType TargetArch, vfs::FileSystem &VFS) {
393+ bool llvm::useUniversalCRT (ToolsetLayout VSLayout,
394+ const std::string &VCToolChainPath,
395+ Triple::ArchType TargetArch, vfs::FileSystem &VFS) {
395396 SmallString<128 > TestPath (getSubDirectoryPath (
396397 SubDirectoryType::Include, VSLayout, VCToolChainPath, TargetArch));
397398 sys::path::append (TestPath, " stdlib.h" );
398399 return !VFS.exists (TestPath);
399400}
400401
401- bool getWindowsSDKDir (vfs::FileSystem &VFS, std::optional<StringRef> WinSdkDir,
402- std::optional<StringRef> WinSdkVersion,
403- std::optional<StringRef> WinSysRoot, std::string &Path,
404- int &Major, std::string &WindowsSDKIncludeVersion,
405- std::string &WindowsSDKLibVersion) {
402+ bool llvm::getWindowsSDKDir (vfs::FileSystem &VFS,
403+ std::optional<StringRef> WinSdkDir,
404+ std::optional<StringRef> WinSdkVersion,
405+ std::optional<StringRef> WinSysRoot,
406+ std::string &Path, int &Major,
407+ std::string &WindowsSDKIncludeVersion,
408+ std::string &WindowsSDKLibVersion) {
406409 // Trust /winsdkdir and /winsdkversion if present.
407410 if (getWindowsSDKDirViaCommandLine (VFS, WinSdkDir, WinSdkVersion, WinSysRoot,
408411 Path, Major, WindowsSDKIncludeVersion)) {
@@ -460,11 +463,11 @@ bool getWindowsSDKDir(vfs::FileSystem &VFS, std::optional<StringRef> WinSdkDir,
460463 return false ;
461464}
462465
463- bool getUniversalCRTSdkDir (vfs::FileSystem &VFS,
464- std::optional<StringRef> WinSdkDir,
465- std::optional<StringRef> WinSdkVersion,
466- std::optional<StringRef> WinSysRoot,
467- std::string &Path, std::string &UCRTVersion) {
466+ bool llvm:: getUniversalCRTSdkDir (vfs::FileSystem &VFS,
467+ std::optional<StringRef> WinSdkDir,
468+ std::optional<StringRef> WinSdkVersion,
469+ std::optional<StringRef> WinSysRoot,
470+ std::string &Path, std::string &UCRTVersion) {
468471 // If /winsdkdir is passed, use it as location for the UCRT too.
469472 // FIXME: Should there be a dedicated /ucrtdir to override /winsdkdir?
470473 int Major;
@@ -491,11 +494,11 @@ bool getUniversalCRTSdkDir(vfs::FileSystem &VFS,
491494 return getWindows10SDKVersionFromPath (VFS, Path, UCRTVersion);
492495}
493496
494- bool findVCToolChainViaCommandLine (vfs::FileSystem &VFS,
495- std::optional<StringRef> VCToolsDir,
496- std::optional<StringRef> VCToolsVersion,
497- std::optional<StringRef> WinSysRoot,
498- std::string &Path, ToolsetLayout &VSLayout) {
497+ bool llvm::findVCToolChainViaCommandLine (
498+ vfs::FileSystem &VFS, std::optional<StringRef> VCToolsDir,
499+ std::optional<StringRef> VCToolsVersion,
500+ std::optional<StringRef> WinSysRoot, std::string &Path ,
501+ ToolsetLayout &VSLayout) {
499502 // Don't validate the input; trust the value supplied by the user.
500503 // The primary motivation is to prevent unnecessary file and registry access.
501504 if (VCToolsDir || WinSysRoot) {
@@ -518,8 +521,9 @@ bool findVCToolChainViaCommandLine(vfs::FileSystem &VFS,
518521 return false ;
519522}
520523
521- bool findVCToolChainViaEnvironment (vfs::FileSystem &VFS, std::string &Path,
522- ToolsetLayout &VSLayout) {
524+ bool llvm::findVCToolChainViaEnvironment (vfs::FileSystem &VFS,
525+ std::string &Path,
526+ ToolsetLayout &VSLayout) {
523527 // These variables are typically set by vcvarsall.bat
524528 // when launching a developer command prompt.
525529 if (std::optional<std::string> VCToolsInstallDir =
@@ -627,9 +631,9 @@ bool findVCToolChainViaEnvironment(vfs::FileSystem &VFS, std::string &Path,
627631 return false ;
628632}
629633
630- bool findVCToolChainViaSetupConfig (vfs::FileSystem &VFS,
631- std::optional<StringRef> VCToolsVersion,
632- std::string &Path, ToolsetLayout &VSLayout) {
634+ bool llvm::findVCToolChainViaSetupConfig (
635+ vfs::FileSystem &VFS, std::optional<StringRef> VCToolsVersion,
636+ std::string &Path, ToolsetLayout &VSLayout) {
633637#if !defined(USE_MSVC_SETUP_API)
634638 return false ;
635639#else
@@ -724,7 +728,8 @@ bool findVCToolChainViaSetupConfig(vfs::FileSystem &VFS,
724728#endif
725729}
726730
727- bool findVCToolChainViaRegistry (std::string &Path, ToolsetLayout &VSLayout) {
731+ bool llvm::findVCToolChainViaRegistry (std::string &Path,
732+ ToolsetLayout &VSLayout) {
728733 std::string VSInstallPath;
729734 if (getSystemRegistryString (R"( SOFTWARE\Microsoft\VisualStudio\$VERSION)" ,
730735 " InstallDir" , VSInstallPath, nullptr ) ||
@@ -744,5 +749,3 @@ bool findVCToolChainViaRegistry(std::string &Path, ToolsetLayout &VSLayout) {
744749 }
745750 return false ;
746751}
747-
748- } // namespace llvm
0 commit comments