Fix quoting of #pragma comment for PS4.

This is the PS4 counterpart to r229376, which quotes the library name if the
name contains space. It was discovered that if a library name contains both
double-quote and space characters, quoting the name might produce unexpected
results, but we are mostly concerned with a Windows host environment, which
does not allow double-quote or slashes in file/folder names.

Differential Revision: http://reviews.llvm.org/D11275

llvm-svn: 242689
This commit is contained in:
Yunzhong Gao 2015-07-20 17:46:56 +00:00
parent 384db3ab16
commit d65200cbfd
2 changed files with 6 additions and 1 deletions

View File

@ -1655,7 +1655,11 @@ public:
void getDependentLibraryOption(llvm::StringRef Lib,
llvm::SmallString<24> &Opt) const override {
Opt = "\01";
Opt += Lib;
// If the argument contains a space, enclose it in quotes.
if (Lib.find(" ") != StringRef::npos)
Opt += "\"" + Lib.str() + "\"";
else
Opt += Lib;
}
};

View File

@ -30,3 +30,4 @@
// PS4: !{!"\01msvcrt.lib"}
// PS4: !{!"\01kernel32"}
// PS4: !{!"\01USER32.LIB"}
// PS4: !{!"\01\22with space\22"}