Skip to content

Commit

Permalink
[NFC] clang-format lld/COFF/Driver.cpp and lld/Common/Filesystem.cpp
Browse files Browse the repository at this point in the history
In order to reduce noise for a MR.

(cherry picked from commit a5e280b)
  • Loading branch information
mizvekov authored and tru committed Oct 2, 2023
1 parent 0a2d7da commit 71be0aa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
32 changes: 17 additions & 15 deletions lld/COFF/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ void LinkerDriver::enqueueArchiveMember(const Archive::Child &c,
CHECK(c.getFullName(),
"could not get the filename for the member defining symbol " +
toCOFFString(ctx, sym));
auto future = std::make_shared<std::future<MBErrPair>>(
createFutureForFile(childName));
auto future =
std::make_shared<std::future<MBErrPair>>(createFutureForFile(childName));
enqueueTask([=]() {
auto mbOrErr = future->get();
if (mbOrErr.second)
Expand Down Expand Up @@ -640,26 +640,28 @@ void LinkerDriver::detectWinSysRoot(const opt::InputArgList &Args) {
void LinkerDriver::addClangLibSearchPaths(const std::string &argv0) {
std::string lldBinary = sys::fs::getMainExecutable(argv0.c_str(), nullptr);
SmallString<128> binDir(lldBinary);
sys::path::remove_filename(binDir); // remove lld-link.exe
sys::path::remove_filename(binDir); // remove lld-link.exe
StringRef rootDir = sys::path::parent_path(binDir); // remove 'bin'

SmallString<128> libDir(rootDir);
sys::path::append(libDir, "lib");
// We need to prepend the paths here in order to make sure that we always
// try to link the clang versions of the builtins over the ones supplied by MSVC.
// try to link the clang versions of the builtins over the ones supplied by
// MSVC.
searchPaths.insert(searchPaths.begin(), saver().save(libDir.str()));

// Add the resource dir library path
SmallString<128> runtimeLibDir(rootDir);
sys::path::append(runtimeLibDir, "lib", "clang", std::to_string(LLVM_VERSION_MAJOR), "lib");
sys::path::append(runtimeLibDir, "lib", "clang",
std::to_string(LLVM_VERSION_MAJOR), "lib");
searchPaths.insert(searchPaths.begin(), saver().save(runtimeLibDir.str()));

// Resource dir + osname, which is hardcoded to windows since we are in the
// COFF driver.
SmallString<128> runtimeLibDirWithOS(runtimeLibDir);
sys::path::append(runtimeLibDirWithOS, "windows");
searchPaths.insert(searchPaths.begin(), saver().save(runtimeLibDirWithOS.str()));

searchPaths.insert(searchPaths.begin(),
saver().save(runtimeLibDirWithOS.str()));
}

void LinkerDriver::addWinSysRootLibSearchPaths() {
Expand Down Expand Up @@ -1145,8 +1147,7 @@ void LinkerDriver::parseOrderFile(StringRef arg) {
if (set.count(s) == 0) {
if (ctx.config.warnMissingOrderSymbol)
warn("/order:" + arg + ": missing symbol: " + s + " [LNK4037]");
}
else
} else
ctx.config.order[s] = INT_MIN + ctx.config.order.size();
}

Expand Down Expand Up @@ -1313,8 +1314,8 @@ void LinkerDriver::parsePDBAltPath() {
else if (var.equals_insensitive("%_ext%"))
buf.append(binaryExtension);
else {
warn("only %_PDB% and %_EXT% supported in /pdbaltpath:, keeping " +
var + " as literal");
warn("only %_PDB% and %_EXT% supported in /pdbaltpath:, keeping " + var +
" as literal");
buf.append(var);
}

Expand Down Expand Up @@ -1448,8 +1449,8 @@ getVFS(const opt::InputArgList &args) {
return nullptr;
}

if (auto ret = vfs::getVFSFromYAML(std::move(*bufOrErr), /*DiagHandler*/ nullptr,
arg->getValue()))
if (auto ret = vfs::getVFSFromYAML(std::move(*bufOrErr),
/*DiagHandler*/ nullptr, arg->getValue()))
return ret;

error("Invalid vfs overlay");
Expand Down Expand Up @@ -2101,7 +2102,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
// Handle /RELEASE
if (args.hasArg(OPT_release))
config->writeCheckSum = true;

// Handle /safeseh, x86 only, on by default, except for mingw.
if (config->machine == I386) {
config->safeSEH = args.hasFlag(OPT_safeseh, OPT_safeseh_no, !config->mingw);
Expand Down Expand Up @@ -2342,7 +2343,8 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
std::vector<WrappedSymbol> wrapped = addWrappedSymbols(ctx, args);
// Load more object files that might be needed for wrapped symbols.
if (!wrapped.empty())
while (run());
while (run())
;

if (config->autoImport || config->stdcallFixup) {
// MinGW specific.
Expand Down
2 changes: 1 addition & 1 deletion lld/Common/Filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void lld::unlinkAsync(StringRef path) {
//
// The code here allows LLD to work on all versions of Windows.
// However, at Windows 10 1903 it seems that the behavior of
// Windows has changed, so that we could simply delete the output
// Windows has changed, so that we could simply delete the output
// file. This code should be simplified once support for older
// versions of Windows is dropped.
//
Expand Down

0 comments on commit 71be0aa

Please sign in to comment.