Skip to content

Commit 3e7b080

Browse files
committed
Clang-Format
1 parent 0ce1f28 commit 3e7b080

File tree

1 file changed

+49
-51
lines changed

1 file changed

+49
-51
lines changed

lib/Driver/ToolChains.cpp

Lines changed: 49 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,14 +1113,10 @@ getSanitizerRuntimeLibNameForDarwin(StringRef Sanitizer,
11131113
+ (shared ? "_dynamic.dylib" : ".a")).str();
11141114
}
11151115

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();
11241120
}
11251121

11261122
static std::string
@@ -1138,11 +1134,12 @@ bool toolchains::Darwin::sanitizerRuntimeLibExists(
11381134
return llvm::sys::fs::exists(sanitizerLibPath.str());
11391135
}
11401136

1141-
bool toolchains::Windows::sanitizerRuntimeLibExists(
1142-
const ArgList &args, StringRef sanitizer) const {
1137+
bool toolchains::Windows::sanitizerRuntimeLibExists(const ArgList &args,
1138+
StringRef sanitizer) const {
11431139
SmallString<128> sanitizerLibPath;
11441140
getClangLibraryPathOnWindows(sanitizerLibPath, args, *this);
1145-
llvm::sys::path::append(sanitizerLibPath,
1141+
llvm::sys::path::append(
1142+
sanitizerLibPath,
11461143
getSanitizerRuntimeLibNameForWindows(sanitizer, this->getTriple()));
11471144
return llvm::sys::fs::exists(sanitizerLibPath.str());
11481145
}
@@ -1151,8 +1148,8 @@ bool toolchains::GenericUnix::sanitizerRuntimeLibExists(
11511148
const ArgList &args, StringRef sanitizer) const {
11521149
SmallString<128> sanitizerLibPath;
11531150
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()));
11561153
return llvm::sys::fs::exists(sanitizerLibPath.str());
11571154
}
11581155

@@ -1187,10 +1184,10 @@ addLinkRuntimeLibForDarwin(const ArgList &Args, ArgStringList &Arguments,
11871184
}
11881185
}
11891186

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) {
11941191
SmallString<128> P;
11951192
getClangLibraryPathOnWindows(P);
11961193
llvm::sys::path::append(P, WindowsLibName);
@@ -1225,18 +1222,18 @@ addLinkSanitizerLibArgsForDarwin(const ArgList &Args,
12251222
/*AddRPath=*/ shared, TC);
12261223
}
12271224

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) {
12351230
// Sanitizer runtime libraries requires C++.
12361231
Arguments.push_back("-lc++");
12371232

1238-
addLinkRuntimeLibForWindows(Args, Arguments,
1239-
getSanitizerRuntimeLibNameForWindows(Sanitizer, TC.getTriple(), shared), TC);
1233+
addLinkRuntimeLibForWindows(
1234+
Args, Arguments,
1235+
getSanitizerRuntimeLibNameForWindows(Sanitizer, TC.getTriple(), shared),
1236+
TC);
12401237
}
12411238

12421239
static void
@@ -1521,15 +1518,15 @@ toolchains::Darwin::constructInvocation(const LinkJobAction &job,
15211518

15221519
ToolChain::InvocationInfo
15231520
toolchains::Windows::constructInvocation(const InterpretJobAction &job,
1524-
const JobContext &context) const {
1521+
const JobContext &context) const {
15251522
InvocationInfo II = ToolChain::constructInvocation(job, context);
15261523

15271524
return II;
15281525
}
15291526

15301527
ToolChain::InvocationInfo
15311528
toolchains::Windows::constructInvocation(const LinkJobAction &job,
1532-
const JobContext &context) const {
1529+
const JobContext &context) const {
15331530
assert(context.Output.getPrimaryOutputType() == types::TY_Image &&
15341531
"Invalid linker output type.");
15351532

@@ -1557,12 +1554,13 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
15571554

15581555
// Configure the toolchain.
15591556
// By default, use the system clang++ to link.
1560-
const char * Clang = "clang++";
1557+
const char *Clang = "clang++";
15611558
if (const Arg *A = context.Args.getLastArg(options::OPT_tools_directory)) {
15621559
StringRef toolchainPath(A->getValue());
15631560

15641561
// 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})) {
15661564
Clang = context.Args.MakeArgString(toolchainClang.get());
15671565
}
15681566
}
@@ -1577,12 +1575,10 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
15771575
bool staticStdlib = false;
15781576

15791577
if (context.Args.hasFlag(options::OPT_static_executable,
1580-
options::OPT_no_static_executable,
1581-
false)) {
1578+
options::OPT_no_static_executable, false)) {
15821579
staticExecutable = true;
15831580
} else if (context.Args.hasFlag(options::OPT_static_stdlib,
1584-
options::OPT_no_static_stdlib,
1585-
false)) {
1581+
options::OPT_no_static_stdlib, false)) {
15861582
staticStdlib = true;
15871583
}
15881584

@@ -1630,20 +1626,22 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
16301626

16311627
if (!VCToolsDir.empty()) {
16321628
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));
16351631
}
16361632

16371633
StringRef UCRTDir(UniversalCRTSdkDir);
16381634
StringRef UCRTVer(UCRTVersion);
16391635

16401636
if (!UCRTDir.empty() && !UCRTVer.empty()) {
16411637
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));
16441641
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));
16471645
}
16481646

16491647
addPrimaryInputsOfType(Arguments, context.Inputs, types::TY_Object);
@@ -1676,10 +1674,10 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
16761674
if (llvm::sys::fs::is_regular_file(linkFile)) {
16771675
Arguments.push_back(context.Args.MakeArgString(Twine("@") + linkFile));
16781676
} 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");
16801679
}
1681-
}
1682-
else if (staticStdlib) {
1680+
} else if (staticStdlib) {
16831681
Arguments.push_back(context.Args.MakeArgString(StaticRuntimeLibPath));
16841682

16851683
SmallString<128> linkFilePath = StaticRuntimeLibPath;
@@ -1690,9 +1688,9 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
16901688
} else {
16911689
llvm::report_fatal_error(linkFile + " not found");
16921690
}
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"));
16961694
}
16971695

16981696
if (job.getKind() == LinkKind::Executable) {
@@ -1703,9 +1701,10 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
17031701
addLinkSanitizerLibArgsForWindows(context.Args, Arguments, "tsan", *this);
17041702

17051703
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);
17091708
}
17101709

17111710
if (context.Args.hasArg(options::OPT_profile_generate)) {
@@ -1715,8 +1714,7 @@ toolchains::Windows::constructInvocation(const LinkJobAction &job,
17151714

17161715
llvm::sys::path::append(LibProfile, getTriple().getOSName(),
17171716
Twine("clang_rt.profile-") +
1718-
getTriple().getArchName() +
1719-
".lib");
1717+
getTriple().getArchName() + ".lib");
17201718
Arguments.push_back(context.Args.MakeArgString(LibProfile));
17211719
Arguments.push_back(context.Args.MakeArgString(
17221720
Twine("-u", llvm::getInstrProfRuntimeHookVarName())));

0 commit comments

Comments
 (0)