On 05/11/2018 09:06 AM, Jakub Jelinek wrote: > On Fri, May 11, 2018 at 10:42:13AM -0400, Jason Merrill wrote: >> On Fri, May 11, 2018 at 8:48 AM, Paolo Carlini <paolo.carl...@oracle.com> >> wrote: >>> we got this very old comment in tree.h: >>> >>> /* Nonzero if TYPE represents a pointer or reference type. >>> (It should be renamed to INDIRECT_TYPE_P.) Keep these checks in >>> ascending code order. */ >>> >>> #define POINTER_TYPE_P(TYPE) \ >>> (TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE) >>> >>> and, FWIW my personal experience, over the years I got confused a couple of >>> times because of that name: for example I tried, incorrectly, to replace a >>> few TREE_CODE (type) == POINTER_TYPE checks with POINTER_TYPE_P (type) in >>> the C++ front-end. >> >> I think my inclination would be to keep this change local to the C++ > > If any change needs to be done, yeah. For the middle-end, having > POINTER_TYPE_P including reference type is highly desirable, otherwise > people will just forget to handle REFERENCE_TYPE; after all, > useless_type_conversion_p says that POINTER_TYPE <-> REFERENCE_TYPE > conversions are useless, so the distinction is lost during optimizations > really soon. Exactly. We've seen this several times in the past in the gimple/ssa optimizers.
Jeff