]> granicus.if.org Git - clang/commit
Disable this-return optimizations when targeting iOS 5 and earlier.
authorBob Wilson <bob.wilson@apple.com>
Tue, 1 Apr 2014 01:38:16 +0000 (01:38 +0000)
committerBob Wilson <bob.wilson@apple.com>
Tue, 1 Apr 2014 01:38:16 +0000 (01:38 +0000)
commitbd3bddeedd0cf47e6dff27bf1f5f417f18234bbe
treea869a8e325fcc2e532a4e58d22b28bd006fd58e2
parent1f27b5db16ee5bc7496ba3b06f38deb609402c61
Disable this-return optimizations when targeting iOS 5 and earlier.

Clang implements the part of the ARM ABI saying that certain functions
(e.g., constructors and destructors) return "this", but Apple's version of
gcc and llvm-gcc did not. The libstdc++ dylib on iOS 5 was built with
llvm-gcc, which means that clang cannot safely assume that code from the C++
runtime will correctly follow the ABI. It is also possible to run into this
problem when linking with other libraries built with gcc or llvm-gcc. Even
though there is no way to reliably detect that situation, it is most likely
to come up when targeting older versions of iOS. Disabling the optimization
for any code targeting iOS 5 solves the libstdc++ problem and has a reasonably
good chance of fixing the issue for other older libraries as well.
<rdar://problem/16377159>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205272 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CodeGenModule.cpp
test/CodeGenCXX/arm.cpp
test/CodeGenCXX/constructor-destructor-return-this.cpp