summaryrefslogtreecommitdiffstats
path: root/include/clang/Driver/DarwinSDKInfo.h
blob: f7075a8d3b7f9e096174c71f29fe4846ed513e49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//===--- DarwinSDKInfo.h - SDK Information parser for darwin ----*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_DRIVER_DARWIN_SDK_INFO_H
#define LLVM_CLANG_DRIVER_DARWIN_SDK_INFO_H

#include "clang/Basic/LLVM.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/VersionTuple.h"
#include "llvm/Support/VirtualFileSystem.h"

namespace clang {
namespace driver {

/// The information about the darwin SDK that was used during this compilation.
class DarwinSDKInfo {
public:
  DarwinSDKInfo(llvm::VersionTuple Version) : Version(Version) {}

  const llvm::VersionTuple &getVersion() const { return Version; }

private:
  llvm::VersionTuple Version;
};

/// Parse the SDK information from the SDKSettings.json file.
///
/// \returns an error if the SDKSettings.json file is invalid, None if the
/// SDK has no SDKSettings.json, or a valid \c DarwinSDKInfo otherwise.
Expected<Optional<DarwinSDKInfo>> parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS,
                                                     StringRef SDKRootPath);

} // end namespace driver
} // end namespace clang

#endif // LLVM_CLANG_DRIVER_DARWIN_SDK_INFO_H