Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/AST/ModuleDependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "swift/AST/PluginLoader.h"
#include "swift/AST/SourceFile.h"
#include "swift/Frontend/Frontend.h"
#include "swift/Strings.h"
#include "clang/CAS/IncludeTree.h"
#include "llvm/CAS/CASProvidingFileSystem.h"
#include "llvm/CAS/CachingOnDiskFileSystem.h"
Expand Down Expand Up @@ -500,7 +501,7 @@ swift::dependencies::registerCxxInteropLibraries(
RegistrationCallback(LinkLibrary("stdc++", LibraryKind::Library));

// Do not try to link Cxx with itself.
if (mainModuleName != "Cxx") {
if (mainModuleName != CXX_MODULE_NAME) {
RegistrationCallback(LinkLibrary(Target.isOSWindows() && hasStaticCxx
? "libswiftCxx"
: "swiftCxx",
Expand All @@ -509,7 +510,7 @@ swift::dependencies::registerCxxInteropLibraries(

// Do not try to link CxxStdlib with the C++ standard library, Cxx or
// itself.
if (llvm::none_of(llvm::ArrayRef{"Cxx", "CxxStdlib", "std"},
if (llvm::none_of(llvm::ArrayRef<StringRef>{CXX_MODULE_NAME, "CxxStdlib", "std"},
[mainModuleName](StringRef Name) {
return mainModuleName == Name;
})) {
Expand Down
2 changes: 1 addition & 1 deletion lib/DependencyScan/ScanDependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ static void resolveImplicitLinkLibraries(const CompilerInstance &instance,
addLinkLibrary({"objc", LibraryKind::Library});

if (langOpts.EnableCXXInterop) {
auto OptionalCxxDep = cache.findDependency("Cxx");
auto OptionalCxxDep = cache.findDependency(CXX_MODULE_NAME);
auto OptionalCxxStdLibDep = cache.findDependency("CxxStdlib");
bool hasStaticCxx =
OptionalCxxDep.has_value() && OptionalCxxDep.value()->isStaticLibrary();
Expand Down
3 changes: 2 additions & 1 deletion lib/IRGen/IRGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "swift/IRGen/Linking.h"
#include "swift/Runtime/Config.h"
#include "swift/Runtime/RuntimeFnWrappersGen.h"
#include "swift/Strings.h"
#include "swift/Subsystems.h"
#include "clang/AST/ASTContext.h"
#include "clang/Basic/CharInfo.h"
Expand Down Expand Up @@ -1677,7 +1678,7 @@ void IRGenModule::addLinkLibraries() {
if (Context.LangOpts.EnableCXXInterop) {
bool hasStaticCxx = false;
bool hasStaticCxxStdlib = false;
if (const auto *M = Context.getModuleByName("Cxx"))
if (const auto *M = Context.getModuleByName(CXX_MODULE_NAME))
hasStaticCxx = M->isStaticLibrary();
if (Context.LangOpts.Target.getOS() == llvm::Triple::Win32)
if (const auto *M = Context.getModuleByName("CxxStdlib"))
Expand Down