@@ -1113,14 +1113,10 @@ getSanitizerRuntimeLibNameForDarwin(StringRef Sanitizer,
1113
1113
+ (shared ? " _dynamic.dylib" : " .a" )).str ();
1114
1114
}
1115
1115
1116
- static std::string
1117
- getSanitizerRuntimeLibNameForWindows (StringRef Sanitizer,
1118
- const llvm::Triple &Triple,
1119
- bool shared = true ) {
1120
- return (Twine (" clang_rt." )
1121
- + Sanitizer + " -"
1122
- + Triple.getArchName ()
1123
- + " .lib" ).str ();
1116
+ static std::string getSanitizerRuntimeLibNameForWindows (
1117
+ StringRef Sanitizer, const llvm::Triple &Triple, bool shared = true ) {
1118
+ return (Twine (" clang_rt." ) + Sanitizer + " -" + Triple.getArchName () + " .lib" )
1119
+ .str ();
1124
1120
}
1125
1121
1126
1122
static std::string
@@ -1138,11 +1134,12 @@ bool toolchains::Darwin::sanitizerRuntimeLibExists(
1138
1134
return llvm::sys::fs::exists (sanitizerLibPath.str ());
1139
1135
}
1140
1136
1141
- bool toolchains::Windows::sanitizerRuntimeLibExists (
1142
- const ArgList &args, StringRef sanitizer) const {
1137
+ bool toolchains::Windows::sanitizerRuntimeLibExists (const ArgList &args,
1138
+ StringRef sanitizer) const {
1143
1139
SmallString<128 > sanitizerLibPath;
1144
1140
getClangLibraryPathOnWindows (sanitizerLibPath, args, *this );
1145
- llvm::sys::path::append (sanitizerLibPath,
1141
+ llvm::sys::path::append (
1142
+ sanitizerLibPath,
1146
1143
getSanitizerRuntimeLibNameForWindows (sanitizer, this ->getTriple ()));
1147
1144
return llvm::sys::fs::exists (sanitizerLibPath.str ());
1148
1145
}
@@ -1151,8 +1148,8 @@ bool toolchains::GenericUnix::sanitizerRuntimeLibExists(
1151
1148
const ArgList &args, StringRef sanitizer) const {
1152
1149
SmallString<128 > sanitizerLibPath;
1153
1150
getClangLibraryPathOnLinux (sanitizerLibPath, args, *this );
1154
- llvm::sys::path::append (sanitizerLibPath,
1155
- getSanitizerRuntimeLibNameForLinux ( sanitizer, this ->getTriple ()));
1151
+ llvm::sys::path::append (sanitizerLibPath, getSanitizerRuntimeLibNameForLinux (
1152
+ sanitizer, this ->getTriple ()));
1156
1153
return llvm::sys::fs::exists (sanitizerLibPath.str ());
1157
1154
}
1158
1155
@@ -1187,10 +1184,10 @@ addLinkRuntimeLibForDarwin(const ArgList &Args, ArgStringList &Arguments,
1187
1184
}
1188
1185
}
1189
1186
1190
- static void
1191
- addLinkRuntimeLibForWindows ( const ArgList &Args, ArgStringList &Arguments,
1192
- StringRef WindowsLibName,
1193
- const ToolChain &TC) {
1187
+ static void addLinkRuntimeLibForWindows ( const ArgList &Args,
1188
+ ArgStringList &Arguments,
1189
+ StringRef WindowsLibName,
1190
+ const ToolChain &TC) {
1194
1191
SmallString<128 > P;
1195
1192
getClangLibraryPathOnWindows (P);
1196
1193
llvm::sys::path::append (P, WindowsLibName);
@@ -1225,18 +1222,18 @@ addLinkSanitizerLibArgsForDarwin(const ArgList &Args,
1225
1222
/* AddRPath=*/ shared, TC);
1226
1223
}
1227
1224
1228
- static void
1229
- addLinkSanitizerLibArgsForWindows (const ArgList &Args,
1230
- ArgStringList &Arguments,
1231
- StringRef Sanitizer,
1232
- const ToolChain &TC,
1233
- bool shared = true
1234
- ) {
1225
+ static void addLinkSanitizerLibArgsForWindows (const ArgList &Args,
1226
+ ArgStringList &Arguments,
1227
+ StringRef Sanitizer,
1228
+ const ToolChain &TC,
1229
+ bool shared = true ) {
1235
1230
// Sanitizer runtime libraries requires C++.
1236
1231
Arguments.push_back (" -lc++" );
1237
1232
1238
- addLinkRuntimeLibForWindows (Args, Arguments,
1239
- getSanitizerRuntimeLibNameForWindows (Sanitizer, TC.getTriple (), shared), TC);
1233
+ addLinkRuntimeLibForWindows (
1234
+ Args, Arguments,
1235
+ getSanitizerRuntimeLibNameForWindows (Sanitizer, TC.getTriple (), shared),
1236
+ TC);
1240
1237
}
1241
1238
1242
1239
static void
@@ -1521,15 +1518,15 @@ toolchains::Darwin::constructInvocation(const LinkJobAction &job,
1521
1518
1522
1519
ToolChain::InvocationInfo
1523
1520
toolchains::Windows::constructInvocation (const InterpretJobAction &job,
1524
- const JobContext &context) const {
1521
+ const JobContext &context) const {
1525
1522
InvocationInfo II = ToolChain::constructInvocation (job, context);
1526
1523
1527
1524
return II;
1528
1525
}
1529
1526
1530
1527
ToolChain::InvocationInfo
1531
1528
toolchains::Windows::constructInvocation (const LinkJobAction &job,
1532
- const JobContext &context) const {
1529
+ const JobContext &context) const {
1533
1530
assert (context.Output .getPrimaryOutputType () == types::TY_Image &&
1534
1531
" Invalid linker output type." );
1535
1532
@@ -1557,12 +1554,13 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
1557
1554
1558
1555
// Configure the toolchain.
1559
1556
// By default, use the system clang++ to link.
1560
- const char * Clang = " clang++" ;
1557
+ const char *Clang = " clang++" ;
1561
1558
if (const Arg *A = context.Args .getLastArg (options::OPT_tools_directory)) {
1562
1559
StringRef toolchainPath (A->getValue ());
1563
1560
1564
1561
// If there is a clang in the toolchain folder, use that instead.
1565
- if (auto toolchainClang = llvm::sys::findProgramByName (" clang++" , {toolchainPath})) {
1562
+ if (auto toolchainClang =
1563
+ llvm::sys::findProgramByName (" clang++" , {toolchainPath})) {
1566
1564
Clang = context.Args .MakeArgString (toolchainClang.get ());
1567
1565
}
1568
1566
}
@@ -1577,12 +1575,10 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
1577
1575
bool staticStdlib = false ;
1578
1576
1579
1577
if (context.Args .hasFlag (options::OPT_static_executable,
1580
- options::OPT_no_static_executable,
1581
- false )) {
1578
+ options::OPT_no_static_executable, false )) {
1582
1579
staticExecutable = true ;
1583
1580
} else if (context.Args .hasFlag (options::OPT_static_stdlib,
1584
- options::OPT_no_static_stdlib,
1585
- false )) {
1581
+ options::OPT_no_static_stdlib, false )) {
1586
1582
staticStdlib = true ;
1587
1583
}
1588
1584
@@ -1630,20 +1626,22 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
1630
1626
1631
1627
if (!VCToolsDir.empty ()) {
1632
1628
Arguments.push_back (" -L" );
1633
- Arguments.push_back (context.Args .MakeArgString (llvm::Twine (VCToolsInstallDir)
1634
- + " /Lib/" + tripleWinArchName));
1629
+ Arguments.push_back (context.Args .MakeArgString (
1630
+ llvm::Twine (VCToolsInstallDir) + " /Lib/" + tripleWinArchName));
1635
1631
}
1636
1632
1637
1633
StringRef UCRTDir (UniversalCRTSdkDir);
1638
1634
StringRef UCRTVer (UCRTVersion);
1639
1635
1640
1636
if (!UCRTDir.empty () && !UCRTVer.empty ()) {
1641
1637
Arguments.push_back (" -L" );
1642
- Arguments.push_back (context.Args .MakeArgString (llvm::Twine (UCRTDir)
1643
- + " /Lib/" + llvm::Twine (UCRTVer) + " /ucrt/" + tripleWinArchName));
1638
+ Arguments.push_back (context.Args .MakeArgString (
1639
+ llvm::Twine (UCRTDir) + " /Lib/" + llvm::Twine (UCRTVer) + " /ucrt/" +
1640
+ tripleWinArchName));
1644
1641
Arguments.push_back (" -L" );
1645
- Arguments.push_back (context.Args .MakeArgString (llvm::Twine (UCRTDir)
1646
- + " /Lib/" + llvm::Twine (UCRTVer) + " /um/" + tripleWinArchName));
1642
+ Arguments.push_back (context.Args .MakeArgString (
1643
+ llvm::Twine (UCRTDir) + " /Lib/" + llvm::Twine (UCRTVer) + " /um/" +
1644
+ tripleWinArchName));
1647
1645
}
1648
1646
1649
1647
addPrimaryInputsOfType (Arguments, context.Inputs , types::TY_Object);
@@ -1676,10 +1674,10 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
1676
1674
if (llvm::sys::fs::is_regular_file (linkFile)) {
1677
1675
Arguments.push_back (context.Args .MakeArgString (Twine (" @" ) + linkFile));
1678
1676
} else {
1679
- llvm::report_fatal_error (" -static-executable not supported on this platform" );
1677
+ llvm::report_fatal_error (
1678
+ " -static-executable not supported on this platform" );
1680
1679
}
1681
- }
1682
- else if (staticStdlib) {
1680
+ } else if (staticStdlib) {
1683
1681
Arguments.push_back (context.Args .MakeArgString (StaticRuntimeLibPath));
1684
1682
1685
1683
SmallString<128 > linkFilePath = StaticRuntimeLibPath;
@@ -1690,9 +1688,9 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
1690
1688
} else {
1691
1689
llvm::report_fatal_error (linkFile + " not found" );
1692
1690
}
1693
- }
1694
- else {
1695
- Arguments. push_back ( context.Args .MakeArgString (SharedRuntimeLibPath + " /swiftCore.lib" ));
1691
+ } else {
1692
+ Arguments. push_back (
1693
+ context.Args .MakeArgString (SharedRuntimeLibPath + " /swiftCore.lib" ));
1696
1694
}
1697
1695
1698
1696
if (job.getKind () == LinkKind::Executable) {
@@ -1703,9 +1701,10 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
1703
1701
addLinkSanitizerLibArgsForWindows (context.Args , Arguments, " tsan" , *this );
1704
1702
1705
1703
if (context.OI .SelectedSanitizers & SanitizerKind::Fuzzer)
1706
- addLinkRuntimeLibForWindows (context.Args , Arguments,
1707
- getSanitizerRuntimeLibNameForWindows (
1708
- " fuzzer" , this ->getTriple ()), *this );
1704
+ addLinkRuntimeLibForWindows (
1705
+ context.Args , Arguments,
1706
+ getSanitizerRuntimeLibNameForWindows (" fuzzer" , this ->getTriple ()),
1707
+ *this );
1709
1708
}
1710
1709
1711
1710
if (context.Args .hasArg (options::OPT_profile_generate)) {
@@ -1715,8 +1714,7 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
1715
1714
1716
1715
llvm::sys::path::append (LibProfile, getTriple ().getOSName (),
1717
1716
Twine (" clang_rt.profile-" ) +
1718
- getTriple ().getArchName () +
1719
- " .lib" );
1717
+ getTriple ().getArchName () + " .lib" );
1720
1718
Arguments.push_back (context.Args .MakeArgString (LibProfile));
1721
1719
Arguments.push_back (context.Args .MakeArgString (
1722
1720
Twine (" -u" , llvm::getInstrProfRuntimeHookVarName ())));
0 commit comments