[cfe-dev] Using C++11 in clang/tools/extra

David Blaikie dblaikie at gmail.com
Wed Nov 28 11:23:59 PST 2012


On Wed, Nov 28, 2012 at 11:17 AM, Vane, Edwin <edwin.vane at intel.com> wrote:
> Really? What happens if you link against libraries not built with C++11? Do you get undefined behaviour? We've been building and running our tools in clang/tools/extra with C++11 turned on and have had no trouble linking with clang libraries so far.

Are you turning on C++11 just for the tools? not for the LLVM/Clang
build overall?

Obvious breakage would be: Any STL type used across the boundary
(though we don't have many standard container types in LLVM/Clang
compared to custom data structures like DenseMap, etc) could be quite
broken.

Less obvious: ODR violations in both standard types and non-standard
types (several of the core LLVM data structures have move semantics
explicitly defined conditional on being compiled with C++11 - that
means LLVM (if you compile it as C++98) would see one definition of
this type and your tool would see a different definition. This is an
ODR violation & All Bets Are Off)

- David

>
> -----Original Message-----
> From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Marshall Clow
> Sent: Wednesday, November 28, 2012 1:46 PM
> To: cfe-dev at cs.uiuc.edu Developers
> Subject: Re: [cfe-dev] Using C++11 in clang/tools/extra
>
> On Nov 28, 2012, at 7:15 AM, "Vane, Edwin" <edwin.vane at intel.com> wrote:
>
>> Hi all,
>>
>> It came up in a recent code review (http://llvm-reviews.chandlerc.com/D136) that C++11 features aren't allowed in the codebase. I can understand the reason for this in the LLVM and clang codebases as they're both widely used. However, would it be a problem to use C++11 officially in clang/tools/extra? It's not nearly as widely used and has less of a chance of impacting critical work in the community. Are there other problems I'm missing? If not, could the use of C++11 in clang/tools/extra be officially blessed?
>
> One of the problems with doing this (as we've found with lld), is that you need to link it against a set of clang libraries that are also built with C++11.
>
>
> -- Marshall
>
> Marshall Clow     Idio Software   <mailto:mclow.lists at gmail.com>
>
> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
>         -- Yu Suzuki
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list