File indexing completed on 2026-05-10 08:44:38
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_TEXTAPI_UTILS_H
0014 #define LLVM_TEXTAPI_UTILS_H
0015
0016 #include "llvm/ADT/Twine.h"
0017 #include "llvm/Support/Error.h"
0018 #include "llvm/Support/FileSystem.h"
0019 #include "llvm/Support/MemoryBuffer.h"
0020 #include "llvm/Support/Path.h"
0021 #include "llvm/Support/Regex.h"
0022 #include "llvm/TextAPI/Symbol.h"
0023 #include <map>
0024
0025 #if !defined(PATH_MAX)
0026 #define PATH_MAX 1024
0027 #endif
0028
0029 #define MACCATALYST_PREFIX_PATH "/System/iOSSupport"
0030 #define DRIVERKIT_PREFIX_PATH "/System/DriverKit"
0031
0032 namespace llvm::MachO {
0033
0034 using PathSeq = std::vector<std::string>;
0035 using PathToPlatform = std::pair<std::string, std::optional<PlatformType>>;
0036 using PathToPlatformSeq = std::vector<PathToPlatform>;
0037
0038
0039 struct SymLink {
0040 std::string SrcPath;
0041 std::string LinkContent;
0042
0043 SymLink(std::string Path, std::string Link)
0044 : SrcPath(std::move(Path)), LinkContent(std::move(Link)) {}
0045
0046 SymLink(StringRef Path, StringRef Link)
0047 : SrcPath(std::string(Path)), LinkContent(std::string(Link)) {}
0048 };
0049
0050
0051
0052
0053
0054 void replace_extension(SmallVectorImpl<char> &Path, const Twine &Extension);
0055
0056
0057
0058
0059
0060
0061 std::error_code shouldSkipSymLink(const Twine &Path, bool &Result);
0062
0063
0064
0065
0066
0067
0068 std::error_code make_relative(StringRef From, StringRef To,
0069 SmallVectorImpl<char> &RelativePath);
0070
0071
0072
0073
0074
0075
0076 bool isPrivateLibrary(StringRef Path, bool IsSymLink = false);
0077
0078
0079
0080
0081 llvm::Expected<llvm::Regex> createRegexFromGlob(llvm::StringRef Glob);
0082
0083 using AliasEntry = std::pair<std::string, EncodeKind>;
0084 using AliasMap = std::map<AliasEntry, AliasEntry>;
0085
0086
0087
0088
0089
0090 Expected<AliasMap> parseAliasList(std::unique_ptr<llvm::MemoryBuffer> &Buffer);
0091
0092
0093
0094
0095
0096 PathSeq getPathsForPlatform(const PathToPlatformSeq &Paths,
0097 PlatformType Platform);
0098
0099 }
0100 #endif