@@ -1045,22 +1045,16 @@ static void getRuntimeLibraryPath(SmallVectorImpl<char> &runtimeLibPath,
1045
1045
getPlatformNameForTriple (TC.getTriple ()));
1046
1046
}
1047
1047
1048
- static void getClangLibraryPathOnDarwin (SmallVectorImpl<char > &libPath,
1049
- const ArgList &args,
1050
- const ToolChain &TC) {
1051
- getRuntimeLibraryPath (libPath, args, TC);
1052
- // Remove platform name.
1053
- llvm::sys::path::remove_filename (libPath);
1054
- llvm::sys::path::append (libPath, " clang" , " lib" , " darwin" );
1055
- }
1048
+ static void getClangLibraryPath (const ToolChain &TC, const ArgList &Args,
1049
+ SmallString<128 > &LibPath) {
1050
+ const llvm::Triple &T = TC.getTriple ();
1056
1051
1057
- static void getClangLibraryPathOnLinux (SmallVectorImpl<char > &libPath,
1058
- const ArgList &args,
1059
- const ToolChain &TC) {
1060
- getRuntimeLibraryPath (libPath, args, TC);
1052
+ getRuntimeLibraryPath (LibPath, Args, TC);
1061
1053
// Remove platform name.
1062
- llvm::sys::path::remove_filename (libPath);
1063
- llvm::sys::path::append (libPath, " clang" , " lib" , " linux" );
1054
+ llvm::sys::path::remove_filename (LibPath);
1055
+ llvm::sys::path::append (LibPath, " clang" , " lib" ,
1056
+ T.isOSDarwin () ? " darwin"
1057
+ : getPlatformNameForTriple (T));
1064
1058
}
1065
1059
1066
1060
// / Get the runtime library link path for static linking,
@@ -1142,7 +1136,7 @@ getSanitizerRuntimeLibNameForLinux(StringRef Sanitizer, const llvm::Triple &Trip
1142
1136
bool toolchains::Darwin::sanitizerRuntimeLibExists (
1143
1137
const ArgList &args, StringRef sanitizer) const {
1144
1138
SmallString<128 > sanitizerLibPath;
1145
- getClangLibraryPathOnDarwin (sanitizerLibPath , args, * this );
1139
+ getClangLibraryPath (* this , args, sanitizerLibPath );
1146
1140
llvm::sys::path::append (sanitizerLibPath,
1147
1141
getSanitizerRuntimeLibNameForDarwin (sanitizer, this ->getTriple ()));
1148
1142
return llvm::sys::fs::exists (sanitizerLibPath.str ());
@@ -1151,7 +1145,7 @@ bool toolchains::Darwin::sanitizerRuntimeLibExists(
1151
1145
bool toolchains::GenericUnix::sanitizerRuntimeLibExists (
1152
1146
const ArgList &args, StringRef sanitizer) const {
1153
1147
SmallString<128 > sanitizerLibPath;
1154
- getClangLibraryPathOnLinux (sanitizerLibPath , args, * this );
1148
+ getClangLibraryPath (* this , args, sanitizerLibPath );
1155
1149
llvm::sys::path::append (sanitizerLibPath,
1156
1150
getSanitizerRuntimeLibNameForLinux (sanitizer, this ->getTriple ()));
1157
1151
return llvm::sys::fs::exists (sanitizerLibPath.str ());
@@ -1163,7 +1157,7 @@ addLinkRuntimeLibForDarwin(const ArgList &Args, ArgStringList &Arguments,
1163
1157
StringRef DarwinLibName, bool AddRPath,
1164
1158
const ToolChain &TC) {
1165
1159
SmallString<128 > ClangLibraryPath;
1166
- getClangLibraryPathOnDarwin (ClangLibraryPath , Args, TC );
1160
+ getClangLibraryPath (TC , Args, ClangLibraryPath );
1167
1161
1168
1162
SmallString<128 > P (ClangLibraryPath);
1169
1163
llvm::sys::path::append (P, DarwinLibName);
0 commit comments