From: Nat! [mailto:nat@mulle-kybernetik.com]
Sent: Thursday, December 08, 2016 1:31 AM
To: Robinson, Paul
Cc: cfe-dev@lists.llvm.org
Subject: Re: [cfe-dev] Fiddling the Rewriter tests (anyone still care
about Objective-C/C++?)
> 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.
Thanks,
--paulr