[cfe-commits] r136210 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Lex/ include/clang/Parse/ lib/AST/ lib/CodeGen/ lib/Lex/ lib/Parse/ lib/Rewrite/ lib/Sema/ lib/Serialization/ test/CXX/lex/lex.literal/lex.ccon/ test/Cod

Craig Topper craig.topper at gmail.com
Wed Jul 27 21:45:11 PDT 2011


This patch makes the literal tests run in C, C++98/03, and C++0x mode.
I split the type-convert-construct.cpp test into a c++0x piece since
expected-error/warning don't understand #ifdefs.

On Wed, Jul 27, 2011 at 8:30 AM, Douglas Gregor <dgregor at apple.com> wrote:
>
> On Jul 27, 2011, at 7:17 AM, Nico Weber wrote:
>
>> On Tue, Jul 26, 2011 at 10:40 PM, Douglas Gregor <dgregor at apple.com> wrote:
>>> Author: dgregor
>>> Date: Wed Jul 27 00:40:30 2011
>>> New Revision: 136210
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=136210&view=rev
>>> Log:
>>> Add support for C++0x unicode string and character literals, from Craig Topper!
>>
>> Cool! One question below.
>>
>>>
>>> Modified: cfe/trunk/test/SemaCXX/type-convert-construct.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/type-convert-construct.cpp?rev=136210&r1=136209&r2=136210&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/SemaCXX/type-convert-construct.cpp (original)
>>> +++ cfe/trunk/test/SemaCXX/type-convert-construct.cpp Wed Jul 27 00:40:30 2011
>>> @@ -1,4 +1,5 @@
>>> -// RUN: %clang_cc1 -fsyntax-only -verify %s
>>> +// RUN: %clang_cc1 -std=gnu++0x -fsyntax-only -verify %s
>>> +// Runs in c++0x mode so that char16_t and char32_t are available.
>>>
>>>  void f() {
>>>   float v1 = float(1);
>>> @@ -14,4 +15,8 @@
>>>   str = "a string"; // expected-warning{{conversion from string literal to 'char *' is deprecated}}
>>>   wchar_t *wstr;
>>>   wstr = L"a wide string"; // expected-warning{{conversion from string literal to 'wchar_t *' is deprecated}}
>>> +  char16_t *ustr;
>>> +  ustr = u"a UTF-16 string"; // expected-error {{assigning to 'char16_t *' from incompatible type 'const char16_t [16]'}}
>>> +  char32_t *Ustr;
>>> +  Ustr = U"a UTF-32 string"; // expected-error {{assigning to 'char32_t *' from incompatible type 'const char32_t [16]'}}
>>>  }
>>
>> Are there any tests left for wide characters in non-c++0x mode? Should there be?
>
> Ah, that's a good point. Yes, there should be. I think the best way to handle this would be to run each of these tests in both C mode and in C++0x mode, and #ifdef away the C++ stuff when we're not in C++ mode. Craig, would you might submitting a patch to do that?
>
>        - Doug
>



-- 
~Craig
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unicode_string_test_fixes.patch
Type: application/octet-stream
Size: 10312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110727/db5ffb48/attachment.obj>


More information about the cfe-commits mailing list