[PATCH] D11275: Fix quoting of #pragma comment for PS4

Yunzhong Gao Yunzhong_Gao at playstation.sony.com
Thu Jul 16 17:40:35 PDT 2015


ygao added a comment.

> I don't have a strong feeling about it, but it seems like this wouldn't require a static helper function given how short it is (either way).

>  ~Aaron


Sure. I'll inline that.


================
Comment at: lib/CodeGen/TargetInfo.cpp:1653-1655
@@ -1649,1 +1652,5 @@
+    return Lib.str();
+  return "\"" + Lib.str() + "\"";
+}
+
 class PS4TargetCodeGenInfo : public X86_64TargetCodeGenInfo {
----------------
I did some research in this, and found that on Windows, the following characters are not acceptable as part of a file name or a folder name:
```
List of character:
\ / : * ? " < > |
End of list
```
Since the PS4 development is expected to be done in a Windows host environment, the backslash problem does not really impact us.

On a cross-development environment, e.g., a Linux host environment, special characters may appear in file names, and that will pose problems for quoting. For example, if a library contains both a space and a double-quote, and one cross-compiles for a Windows target, and clang tries to quote the library name. I am not sure what would be a good way to fix that. Just don't do that?

In a little experiment, I created on Linux a file with the name being a single double-quote and then I try to access the file on Windows, the file name on Windows did not display as a single double-quote but a tilda followed by 1.

Back to your question of where the escaping takes place in clang. I did not find anything in clang that does escaping, and I am coming to believe that no escaping was done, contrary to my prior statement. In the earlier testing I was doing a "clang -cc1 -triple x86_64-pc-win32 -emit-llvm", and the PrintEscapedString() in AsmWriter.cpp is printing the metadata in escaped format, but that is different than saying that the string has been converted to an escaped format. Very sorry for making the misleading statement.


http://reviews.llvm.org/D11275







More information about the cfe-commits mailing list