ygao created this revision.
ygao added a reviewer: alexr.
ygao added subscribers: cfe-commits, mkuper.
Hi,
This is the PS4 counterpart to r229376, which quotes the library name if the
name contains space.
Can someone take a look whether this looks good to go in?
- Gao
http://reviews.llvm.org/D11275
Files:
lib/CodeGen/TargetInfo.cpp
test/CodeGen/pragma-comment.c
Index: test/CodeGen/pragma-comment.c
===================================================================
--- test/CodeGen/pragma-comment.c
+++ test/CodeGen/pragma-comment.c
@@ -30,3 +30,4 @@
// PS4: !{!"\01msvcrt.lib"}
// PS4: !{!"\01kernel32"}
// PS4: !{!"\01USER32.LIB"}
+// PS4: !{!"\01\22with space\22"}
Index: lib/CodeGen/TargetInfo.cpp
===================================================================
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -1647,6 +1647,15 @@
}
};
+static std::string qualifyPSLibrary(llvm::StringRef Lib) {
+ // If the argument contains a space, enclose it in quotes.
+ bool Quote = (Lib.find(" ") != StringRef::npos);
+ std::string ArgStr = Quote ? "\"" : "";
+ ArgStr += Lib;
+ ArgStr += Quote ? "\"" : "";
+ return ArgStr;
+}
+
class PS4TargetCodeGenInfo : public X86_64TargetCodeGenInfo {
public:
PS4TargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, X86AVXABILevel AVXLevel)
@@ -1655,7 +1664,7 @@
void getDependentLibraryOption(llvm::StringRef Lib,
llvm::SmallString<24> &Opt) const override {
Opt = "\01";
- Opt += Lib;
+ Opt += qualifyPSLibrary(Lib);
}
};
Index: test/CodeGen/pragma-comment.c
===================================================================
--- test/CodeGen/pragma-comment.c
+++ test/CodeGen/pragma-comment.c
@@ -30,3 +30,4 @@
// PS4: !{!"\01msvcrt.lib"}
// PS4: !{!"\01kernel32"}
// PS4: !{!"\01USER32.LIB"}
+// PS4: !{!"\01\22with space\22"}
Index: lib/CodeGen/TargetInfo.cpp
===================================================================
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -1647,6 +1647,15 @@
}
};
+static std::string qualifyPSLibrary(llvm::StringRef Lib) {
+ // If the argument contains a space, enclose it in quotes.
+ bool Quote = (Lib.find(" ") != StringRef::npos);
+ std::string ArgStr = Quote ? "\"" : "";
+ ArgStr += Lib;
+ ArgStr += Quote ? "\"" : "";
+ return ArgStr;
+}
+
class PS4TargetCodeGenInfo : public X86_64TargetCodeGenInfo {
public:
PS4TargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, X86AVXABILevel AVXLevel)
@@ -1655,7 +1664,7 @@
void getDependentLibraryOption(llvm::StringRef Lib,
llvm::SmallString<24> &Opt) const override {
Opt = "\01";
- Opt += Lib;
+ Opt += qualifyPSLibrary(Lib);
}
};
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits