]> granicus.if.org Git - clang/commitdiff
Fix quoting of #pragma comment for PS4.
authorYunzhong Gao <Yunzhong_Gao@playstation.sony.com>
Mon, 20 Jul 2015 17:46:56 +0000 (17:46 +0000)
committerYunzhong Gao <Yunzhong_Gao@playstation.sony.com>
Mon, 20 Jul 2015 17:46:56 +0000 (17:46 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242689 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetInfo.cpp
test/CodeGen/pragma-comment.c

index f95b945af4e05e4974ff619d3c579cc48efa6fda..15e50c188943c5aaa6627fa74d21e0ce250b9870 100644 (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;
   }
 };
 
index fbae9d532357b008968efe97c9c84ccb752a8844..6da20686e95711366234619393ba6c0087f8e906 100644 (file)
@@ -30,3 +30,4 @@
 // PS4: !{!"\01msvcrt.lib"}
 // PS4: !{!"\01kernel32"}
 // PS4: !{!"\01USER32.LIB"}
+// PS4: !{!"\01\22with space\22"}