1 //===--- DarwinSDKInfo.h - SDK Information parser for darwin ----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_DRIVER_DARWIN_SDK_INFO_H
10 #define LLVM_CLANG_DRIVER_DARWIN_SDK_INFO_H
11 
12 #include "clang/Basic/LLVM.h"
13 #include "llvm/Support/Error.h"
14 #include "llvm/Support/VersionTuple.h"
15 #include "llvm/Support/VirtualFileSystem.h"
16 
17 namespace clang {
18 namespace driver {
19 
20 /// The information about the darwin SDK that was used during this compilation.
21 class DarwinSDKInfo {
22 public:
DarwinSDKInfo(llvm::VersionTuple Version)23   DarwinSDKInfo(llvm::VersionTuple Version) : Version(Version) {}
24 
getVersion()25   const llvm::VersionTuple &getVersion() const { return Version; }
26 
27 private:
28   llvm::VersionTuple Version;
29 };
30 
31 /// Parse the SDK information from the SDKSettings.json file.
32 ///
33 /// \returns an error if the SDKSettings.json file is invalid, None if the
34 /// SDK has no SDKSettings.json, or a valid \c DarwinSDKInfo otherwise.
35 Expected<Optional<DarwinSDKInfo>> parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS,
36                                                      StringRef SDKRootPath);
37 
38 } // end namespace driver
39 } // end namespace clang
40 
41 #endif // LLVM_CLANG_DRIVER_DARWIN_SDK_INFO_H
42