[ms-cxxabi] Set proper SRet flags for most functions; also handle empty struct arguments correctly
John McCall
rjmccall at apple.com
Fri Mar 22 13:56:51 PDT 2013
On Mar 21, 2013, at 1:45 PM, Timur Iskhodzhanov <timurrrr at google.com> wrote:
> Hi John,
>
> Please see the attached patch.
>
> It addresses most of the Clang-side change needed to fix http://llvm.org/PR13676
+ bool IsMicrosoftABI = getContext().getTargetInfo().getCXXABI().isMicrosoft();
+
if (isAggregateTypeForABI(RetTy)) {
if (const RecordType *RT = RetTy->getAs<RecordType>()) {
// Structures with either a non-trivial destructor or a non-trivial
// copy constructor are always indirect.
- if (hasNonTrivialDestructorOrCopyConstructor(RT))
+ if (hasNonTrivialDestructorOrCopyConstructor(RT) ||
+ (IsMicrosoftABI && hasNonTrivialDefaultConstructor(RT)))
Please don't compute IsMicrosoftABI before it's needed.
Are you sure it's just that the *default* constructor is non-trivial, or is it
the presence of *any* non-trivial constructor, or possibly even any
explicit constructor?
For example, this class doesn't even have a default constructor:
struct A {
int x;
A(int x) : x(x) {}
};
And this C++11 class has a trivial default constructor, but it does still have
non-trivial constructors:
struct A {
int x;
A() = default;
A(int x) : x(x) {}
};
And this C++11 class has no non-trivial constructors, but its constructor is
explicitly declared:
struct A {
int x;
A() = default;
};
John.
More information about the cfe-commits
mailing list