r374443 - [MSVC] Automatically add atlmfc folder to include and libpath.
Zachary Turner via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 10 13:25:54 PDT 2019
Author: zturner
Date: Thu Oct 10 13:25:54 2019
New Revision: 374443
URL: http://llvm.org/viewvc/llvm-project?rev=374443&view=rev
Log:
[MSVC] Automatically add atlmfc folder to include and libpath.
Differential Revision: https://reviews.llvm.org/D68736
Modified:
cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
cfe/trunk/lib/Driver/ToolChains/MSVC.h
Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=374443&r1=374442&r2=374443&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Thu Oct 10 13:25:54 2019
@@ -331,6 +331,11 @@ void visualstudio::Linker::ConstructJob(
TC.getSubDirectoryPath(
toolchains::MSVCToolChain::SubDirectoryType::Lib)));
+ CmdArgs.push_back(Args.MakeArgString(
+ Twine("-libpath:") +
+ TC.getSubDirectoryPath(toolchains::MSVCToolChain::SubDirectoryType::Lib,
+ "atlmfc")));
+
if (TC.useUniversalCRT()) {
std::string UniversalCRTLibPath;
if (TC.getUniversalCRTLibraryPath(UniversalCRTLibPath))
@@ -548,7 +553,7 @@ void visualstudio::Linker::ConstructJob(
EnvVar.substr(0, PrefixLen) +
TC.getSubDirectoryPath(SubDirectoryType::Bin) +
llvm::Twine(llvm::sys::EnvPathSeparator) +
- TC.getSubDirectoryPath(SubDirectoryType::Bin, HostArch) +
+ TC.getSubDirectoryPath(SubDirectoryType::Bin, "", HostArch) +
(EnvVar.size() > PrefixLen
? llvm::Twine(llvm::sys::EnvPathSeparator) +
EnvVar.substr(PrefixLen)
@@ -824,6 +829,7 @@ static const char *llvmArchToDevDivInter
// of hardcoding paths.
std::string
MSVCToolChain::getSubDirectoryPath(SubDirectoryType Type,
+ llvm::StringRef SubdirParent,
llvm::Triple::ArchType TargetArch) const {
const char *SubdirName;
const char *IncludeName;
@@ -843,6 +849,9 @@ MSVCToolChain::getSubDirectoryPath(SubDi
}
llvm::SmallString<256> Path(VCToolChainPath);
+ if (!SubdirParent.empty())
+ llvm::sys::path::append(Path, SubdirParent);
+
switch (Type) {
case SubDirectoryType::Bin:
if (VSLayout == ToolsetLayout::VS2017OrNewer) {
@@ -1228,6 +1237,8 @@ void MSVCToolChain::AddClangSystemInclud
if (!VCToolChainPath.empty()) {
addSystemInclude(DriverArgs, CC1Args,
getSubDirectoryPath(SubDirectoryType::Include));
+ addSystemInclude(DriverArgs, CC1Args,
+ getSubDirectoryPath(SubDirectoryType::Include, "atlmfc"));
if (useUniversalCRT()) {
std::string UniversalCRTSdkPath;
Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.h?rev=374443&r1=374442&r2=374443&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/MSVC.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.h Thu Oct 10 13:25:54 2019
@@ -98,12 +98,14 @@ public:
Lib,
};
std::string getSubDirectoryPath(SubDirectoryType Type,
+ llvm::StringRef SubdirParent,
llvm::Triple::ArchType TargetArch) const;
// Convenience overload.
// Uses the current target arch.
- std::string getSubDirectoryPath(SubDirectoryType Type) const {
- return getSubDirectoryPath(Type, getArch());
+ std::string getSubDirectoryPath(SubDirectoryType Type,
+ llvm::StringRef SubdirParent = "") const {
+ return getSubDirectoryPath(Type, SubdirParent, getArch());
}
enum class ToolsetLayout {
More information about the cfe-commits
mailing list