aaron.ballman added a comment.

I think that C and C++ should behave the same here; at least, I don't see any 
reason why they should have different capabilities.

The paper said that there is no expected code breakage from this change, but 
have you tried building a diverse corpus of code (like a distro's worth of 
packages) under this patch to see if anything actually breaks in practice? (I 
don't expect breakage that isn't identifying an actual issue in the code, but 
having some verification would be appreciated.) This would also help to 
identify whether the change is appropriate for C as well.



================
Comment at: clang/test/CodeGen/string-literal-short-wstring.c:1-2
-// RUN: %clang_cc1 -x c++ -triple %itanium_abi_triple -emit-llvm 
-fwchar-type=short -fno-signed-wchar %s -o - | FileCheck %s 
--check-prefix=CHECK --check-prefix=ITANIUM
-// RUN: %clang_cc1 -x c++ -triple %ms_abi_triple -emit-llvm -fwchar-type=short 
-fno-signed-wchar %s -o - | FileCheck %s --check-prefix=CHECK 
--check-prefix=MSABI
-// Runs in c++ mode so that wchar_t is available.
+// RUN: %clang_cc1 -x c -triple %itanium_abi_triple -emit-llvm 
-fwchar-type=short -fno-signed-wchar %s -o - | FileCheck %s 
--check-prefix=CHECK --check-prefix=ITANIUM
+// RUN: %clang_cc1 -x c -triple %ms_abi_triple -emit-llvm -fwchar-type=short 
-fno-signed-wchar %s -o - | FileCheck %s --check-prefix=CHECK 
--check-prefix=MSABI
+
----------------
No need to tell the file to be in C mode; it is by virtue of the extension.


================
Comment at: clang/test/CodeGen/string-literal-short-wstring.c:17
   // MSABI: linkonce_odr dso_local unnamed_addr constant [3 x i16] [i16 65, 
i16 66, i16 0]
-  const wchar_t *foo = L"AB";
+  const unsigned short *foo = L"AB";
 
----------------
I'd feel most comfortable if the top of the file did:
```
typedef __WCHAR_TYPE__ wchar_t;
```
as that's the definition of `wchar_t` from the `stddef.h` provided by Clang.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106215/new/

https://reviews.llvm.org/D106215

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to