[clang] 05a6d74 - [clang] NFC, move DarwinSDKInfo to lib/Basic

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 20 13:23:06 PDT 2021


Author: Alex Lorenz
Date: 2021-07-20T13:22:48-07:00
New Revision: 05a6d74c4845221907e25971937242b72489ef55

URL: https://github.com/llvm/llvm-project/commit/05a6d74c4845221907e25971937242b72489ef55
DIFF: https://github.com/llvm/llvm-project/commit/05a6d74c4845221907e25971937242b72489ef55.diff

LOG: [clang] NFC, move DarwinSDKInfo to lib/Basic

This is a preparation commit for https://reviews.llvm.org/D105958

Added: 
    clang/include/clang/Basic/DarwinSDKInfo.h
    clang/lib/Basic/DarwinSDKInfo.cpp

Modified: 
    clang/lib/Basic/CMakeLists.txt
    clang/lib/Driver/CMakeLists.txt
    clang/lib/Driver/ToolChains/Darwin.cpp
    clang/lib/Driver/ToolChains/Darwin.h

Removed: 
    clang/include/clang/Driver/DarwinSDKInfo.h
    clang/lib/Driver/DarwinSDKInfo.cpp


################################################################################
diff  --git a/clang/include/clang/Driver/DarwinSDKInfo.h b/clang/include/clang/Basic/DarwinSDKInfo.h
similarity index 87%
rename from clang/include/clang/Driver/DarwinSDKInfo.h
rename to clang/include/clang/Basic/DarwinSDKInfo.h
index f7075a8d3b7f9..f4428f29315b3 100644
--- a/clang/include/clang/Driver/DarwinSDKInfo.h
+++ b/clang/include/clang/Basic/DarwinSDKInfo.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_DRIVER_DARWIN_SDK_INFO_H
-#define LLVM_CLANG_DRIVER_DARWIN_SDK_INFO_H
+#ifndef LLVM_CLANG_BASIC_DARWIN_SDK_INFO_H
+#define LLVM_CLANG_BASIC_DARWIN_SDK_INFO_H
 
 #include "clang/Basic/LLVM.h"
 #include "llvm/Support/Error.h"
@@ -15,7 +15,6 @@
 #include "llvm/Support/VirtualFileSystem.h"
 
 namespace clang {
-namespace driver {
 
 /// The information about the darwin SDK that was used during this compilation.
 class DarwinSDKInfo {
@@ -35,7 +34,6 @@ class DarwinSDKInfo {
 Expected<Optional<DarwinSDKInfo>> parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS,
                                                      StringRef SDKRootPath);
 
-} // end namespace driver
 } // end namespace clang
 
-#endif // LLVM_CLANG_DRIVER_DARWIN_SDK_INFO_H
+#endif // LLVM_CLANG_BASIC_DARWIN_SDK_INFO_H

diff  --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index cbf99b2a848f2..c550e8cae03f3 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -42,6 +42,7 @@ add_clang_library(clangBasic
   CharInfo.cpp
   CodeGenOptions.cpp
   Cuda.cpp
+  DarwinSDKInfo.cpp
   Diagnostic.cpp
   DiagnosticIDs.cpp
   DiagnosticOptions.cpp

diff  --git a/clang/lib/Driver/DarwinSDKInfo.cpp b/clang/lib/Basic/DarwinSDKInfo.cpp
similarity index 90%
rename from clang/lib/Driver/DarwinSDKInfo.cpp
rename to clang/lib/Basic/DarwinSDKInfo.cpp
index 761c6717266bf..e2ea580565b98 100644
--- a/clang/lib/Driver/DarwinSDKInfo.cpp
+++ b/clang/lib/Basic/DarwinSDKInfo.cpp
@@ -6,17 +6,16 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/Driver/DarwinSDKInfo.h"
+#include "clang/Basic/DarwinSDKInfo.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 
-using namespace clang::driver;
 using namespace clang;
 
 Expected<Optional<DarwinSDKInfo>>
-driver::parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath) {
+clang::parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath) {
   llvm::SmallString<256> Filepath = SDKRootPath;
   llvm::sys::path::append(Filepath, "SDKSettings.json");
   llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File =

diff  --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index f59141f9e19fe..08be9f0115a19 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -13,7 +13,6 @@ endif()
 add_clang_library(clangDriver
   Action.cpp
   Compilation.cpp
-  DarwinSDKInfo.cpp
   Distro.cpp
   Driver.cpp
   DriverOptions.cpp

diff  --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 8a0c4721eea0e..0f41c0ff2a80d 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1786,7 +1786,7 @@ Optional<DarwinSDKInfo> parseSDKSettings(llvm::vfs::FileSystem &VFS,
   if (!A)
     return None;
   StringRef isysroot = A->getValue();
-  auto SDKInfoOrErr = driver::parseDarwinSDKInfo(VFS, isysroot);
+  auto SDKInfoOrErr = parseDarwinSDKInfo(VFS, isysroot);
   if (!SDKInfoOrErr) {
     llvm::consumeError(SDKInfoOrErr.takeError());
     TheDriver.Diag(diag::warn_drv_darwin_sdk_invalid_settings);

diff  --git a/clang/lib/Driver/ToolChains/Darwin.h b/clang/lib/Driver/ToolChains/Darwin.h
index 25c63fed922a8..775336ee3158c 100644
--- a/clang/lib/Driver/ToolChains/Darwin.h
+++ b/clang/lib/Driver/ToolChains/Darwin.h
@@ -11,8 +11,8 @@
 
 #include "Cuda.h"
 #include "ROCm.h"
+#include "clang/Basic/DarwinSDKInfo.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Driver/DarwinSDKInfo.h"
 #include "clang/Driver/Tool.h"
 #include "clang/Driver/ToolChain.h"
 #include "clang/Driver/XRayArgs.h"


        


More information about the cfe-commits mailing list