[PATCH] D68736: [MSVC] Automatically add atlmfc include and lib directories as system paths.
Zachary Turner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 9 14:52:19 PDT 2019
zturner created this revision.
zturner added a reviewer: rnk.
This matches the behavior of cl.
https://reviews.llvm.org/D68736
Files:
clang/lib/Driver/ToolChains/MSVC.cpp
clang/lib/Driver/ToolChains/MSVC.h
Index: clang/lib/Driver/ToolChains/MSVC.h
===================================================================
--- clang/lib/Driver/ToolChains/MSVC.h
+++ clang/lib/Driver/ToolChains/MSVC.h
@@ -98,12 +98,14 @@
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 {
Index: clang/lib/Driver/ToolChains/MSVC.cpp
===================================================================
--- clang/lib/Driver/ToolChains/MSVC.cpp
+++ clang/lib/Driver/ToolChains/MSVC.cpp
@@ -331,6 +331,11 @@
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 @@
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 @@
// 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 @@
}
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 @@
if (!VCToolChainPath.empty()) {
addSystemInclude(DriverArgs, CC1Args,
getSubDirectoryPath(SubDirectoryType::Include));
+ addSystemInclude(DriverArgs, CC1Args,
+ getSubDirectoryPath(SubDirectoryType::Include, "atlmfc"));
if (useUniversalCRT()) {
std::string UniversalCRTSdkPath;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68736.224177.patch
Type: text/x-patch
Size: 2936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191009/6f6b3ee6/attachment-0001.bin>
More information about the cfe-commits
mailing list