[cfe-dev] @encode() discrepancy between C++11 and earlier

Nico Weber via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 12 06:04:08 PST 2020


Hi,

http://reviews.llvm.org/D76801 changed clang/lib/AST/TypePrinter.cpp to not
print a space between consecutive '>'s in templates if targeting C++11 or
later.

I noticed recently that this affects Objective-C's @encode too, which means
it has different results based on language standard, making it impossible
to build part of a program with C++98 and another part with C++11 (...if
both parts need @encode if some common type to agree). It also
means @encode for types changed with that patch, which is an ABI break of
sorts.

However, the change landed in March, so maybe it's already deployed in new
Xcodes.

Should we make @encode opt out of this pretty printing change to restore
the old behavior? (Several other places also broke due to that change and
were changed to opt out -- debug info, for example).

I found this while writing tests for an unrelated change [1] and I don't
know of any projects adversely affected by this.

Nico


1: See "FIXME" in https://reviews.llvm.org/D90622#change-Aht3gYP3AIRe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201112/0bb28581/attachment.html>


More information about the cfe-dev mailing list