[clang] NFC, move DarwinSDKInfo to lib/Basic
authorAlex Lorenz <arphaman@gmail.com>
Wed, 30 Jun 2021 14:44:42 +0000 (07:44 -0700)
committerAlex Lorenz <arphaman@gmail.com>
Tue, 20 Jul 2021 20:22:48 +0000 (13:22 -0700)
This is a preparation commit for https://reviews.llvm.org/D105958

clang/include/clang/Basic/DarwinSDKInfo.h [moved from clang/include/clang/Driver/DarwinSDKInfo.h with 87% similarity]
clang/lib/Basic/CMakeLists.txt
clang/lib/Basic/DarwinSDKInfo.cpp [moved from clang/lib/Driver/DarwinSDKInfo.cpp with 90% similarity]
clang/lib/Driver/CMakeLists.txt
clang/lib/Driver/ToolChains/Darwin.cpp
clang/lib/Driver/ToolChains/Darwin.h

similarity index 87%
rename from clang/include/clang/Driver/DarwinSDKInfo.h
rename to clang/include/clang/Basic/DarwinSDKInfo.h
index f7075a8..f4428f2 100644 (file)
@@ -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 @@ private:
 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
index cbf99b2..c550e8c 100644 (file)
@@ -42,6 +42,7 @@ add_clang_library(clangBasic
   CharInfo.cpp
   CodeGenOptions.cpp
   Cuda.cpp
+  DarwinSDKInfo.cpp
   Diagnostic.cpp
   DiagnosticIDs.cpp
   DiagnosticOptions.cpp
similarity index 90%
rename from clang/lib/Driver/DarwinSDKInfo.cpp
rename to clang/lib/Basic/DarwinSDKInfo.cpp
index 761c671..e2ea580 100644 (file)
@@ -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 =
index f59141f..08be9f0 100644 (file)
@@ -13,7 +13,6 @@ endif()
 add_clang_library(clangDriver
   Action.cpp
   Compilation.cpp
-  DarwinSDKInfo.cpp
   Distro.cpp
   Driver.cpp
   DriverOptions.cpp
index 8a0c472..0f41c0f 100644 (file)
@@ -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);
index 25c63fe..775336e 100644 (file)
@@ -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"