This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PROPOSED PATCH: Robustify cp_fold_obj_type_ref() for ObjC++ use


Andrew Pinski wrote:


On Sep 20, 2004, at 11:44 PM, Mark Mitchell wrote:


Andrew Pinski wrote:

It looks like you're not only getting OBJ_TYPE_REF nodes -- you're getting OBJ_TYPE_REF nodes that indicate that you're using a virtual function. (That's the OBJ_TYPE_REF_TOKEN.) Either the Objective-C and C++ front ends disagree about what OBJ_TYPE_REF_TOKEN means, or you shouldn't be building an OBJ_TYPE_REF at all in objc-act.c. My guess is the latter.



No, the Objective-C front-end is correct in creating a OBJ_TYPE_REF node as it is a virtual call (not like C++ but still a virtual call). If we make OBJ_TYPE_REF_TOKEN a null then we get a crash in cp_fold_obj_type_ref, anyways.


OK.
Then, as you suggest, you should make it a hook. In Objective-C++, do the special thing, and then forward to the cp_fold_obj_type_ref function if you're not in the Objective-C++ special case. That will keep the Objective-C code separate from the C++ code.


Why make an extra hook?

Because that will keep more of the Objective-C++ code in the Objective-C/C++ subdirectory, where it ideally belongs. Thinking of hooks like virtual functions, what you want to do is derive from the C++-compiler base class.


--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]