[PATCH] [ms-cxxabi] Fix the calling convention for operator new in records

Reid Kleckner rnk at google.com
Thu Sep 26 10:04:45 PDT 2013



================
Comment at: lib/Sema/SemaDecl.cpp:6497
@@ -6497,1 +6496,3 @@
+  }
+
   FunctionTemplateDecl *FunctionTemplate = 0;
----------------
Eli Friedman wrote:
> Did you mean to remove the other code which sets isFriend?
I got this assert when removing that assignment:
Assertion failed: D->getFriendObjectKind() || (cast<CXXRecordDecl>(DC)->getTemplateSpecializationKind()), file ..\tools\clang\lib\AST\DeclFriend.cpp, line 43

Maybe something modifies it?

================
Comment at: lib/Sema/SemaType.cpp:2452
@@ -2449,2 +2451,3 @@
       IsCXXInstanceMethod =
           (D.getContext() == Declarator::MemberContext &&
+           DS.getStorageClassSpec() != DeclSpec::SCS_typedef &&
----------------
Eli Friedman wrote:
> The MemberContext check is redundant.
It isn't.  We're looking for instance methods here, and skipping static methods.

================
Comment at: include/clang/Basic/OperatorKinds.h:34-44
@@ +33,13 @@
+
+/// Returns true if the given operator is implicitly static in a record
+/// context.
+inline bool isImplicitlyStaticOperator(OverloadedOperatorKind OOK) {
+  // [class.free]p1:
+  // Any allocation function for a class T is a static member
+  // (even if not explicitly declared static).
+  // [class.free]p6 Any deallocation function for a class X is a static member
+  // (even if not explicitly declared static).
+  return OOK == OO_New || OOK == OO_Array_New || OOK == OO_Delete ||
+         OOK == OO_Array_Delete;
+}
+
----------------
Eli Friedman wrote:
> Reid Kleckner wrote:
> > Doing this here seems wrong.  Any better ideas?  I didn't want to include DeclCXX.h from DeclSpec.h.
> You could sink the isStaticMember() implementation into DeclSpec.cpp.
Done, and moved the operator check back to a static method on CXXMethodDecl.


http://llvm-reviews.chandlerc.com/D1761



More information about the cfe-commits mailing list