[cfe-dev] Fiddling the Rewriter tests (anyone still care about Objective-C/C++?)

Duncan P. N. Exon Smith via cfe-dev cfe-dev at lists.llvm.org
Sun Dec 11 15:27:13 PST 2016


> On 2016-Dec-08, at 07:33, Robinson, Paul via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> 
> 
>> -----Original Message-----
>> From: Nat! [mailto:nat at mulle-kybernetik.com]
>> Sent: Thursday, December 08, 2016 1:31 AM
>> To: Robinson, Paul
>> Cc: cfe-dev at lists.llvm.org
>> Subject: Re: [cfe-dev] Fiddling the Rewriter tests (anyone still care
>> about Objective-C/C++?)
>> 
>> Robinson, Paul via cfe-dev schrieb:
>>> Privately, we set the default C++ dialect to C++11.  This causes all
>>> kinds of fun with the Clang tests, and Charles Li has been doing a lot
>>> of work to make the tests able to tolerate C++11.  I'm helping out a
>>> little bit.
>>> 
>>> Specifically I'm looking at the Rewriter tests.  It looks like these
>>> take Objective-C/C++ input, generate a non-Objective equivalent, and
>>> then compile the resulting C++ to make sure it's clean.  There are
>>> 32 tests that fail in the "compile the resulting C++" stage, when we
>>> set the default dialect to C++11.
>>> 
>>> I'm guessing that Objective-C/C++ is kind of passe, so nobody is really
>>> interested in modernizing it (or the C++ that the rewriter produces).
>>> Therefore I'm proposing to simply add '-std=gnu++98' to the failing
>> tests,
>>> and be done with it.
>>> 
>>> Anybody mind if I do this?
>>> Thanks,
>>> --paulr
>>> 
>> 
>> Hi Paul
>> 
>> 
>> If you look at "lib/Frontend/CompilerInvocation.cpp#1531" or so, you
>> will see that the language set for most ObjC runtimes is gnu++98.
>> 
>>    case IK_CXX:
>>    case IK_PreprocessedCXX:
>>    case IK_ObjCXX:
>>    case IK_PreprocessedObjCXX:
>>      LangStd = LangStandard::lang_gnucxx98;
>>      break;
>> 
>> So if the test somehow ignore this, then -std=gnu++98' sounds sensible
>> to me. Hope this helps. I myself have never used the Rewriter.
> 
> Hi Nat!  What we do privately is something like this:
> 
>    case IK_CXX:
>    case IK_PreprocessedCXX:
>      LangStd = LangStandard::lang_cxx11;
>      break;
>    case IK_ObjCXX:
>    case IK_PreprocessedObjCXX:
>      LangStd = LangStandard::lang_gnucxx98;
>      break;
> 
> 
> The tests I am looking at all do something like this:
> 
> RUN: %clang_cc1 -x objective-c++ ... %s -o %t.cpp
> RUN: %clang_cc1 -fsyntax-only ... %t.cpp
> 
> That is, rewrite the objective-c++ source, then compile the result.
> 
> So, the objective-c++ part is implicitly compiled with -std=gnu++98, 
> but then (for me) the C++ part is implicitly compiled -std=c++11.
> What I am doing is adding -std=gnu++98 to the C++ part.

Paul, your proposal SGTM.  Go ahead, and thanks for the cleanup.

> 
> Thanks,
> --paulr
> 
>> 
>> Ciao
>>   Nat!
>> 
>> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list