[Patch] Use CAN_HAVE_LOCATION_P in EXPR_LOCATION

2012-05-15 Thread Paolo Carlini

Hi,

this is something I noticed when looking into more EXPR_LOC_OR_HERE uses 
in the C++ front-end: I don't think we want to crash if EXPR_LOC_OR_HERE 
is passed a NULL_TREE. Tested x86_64-linux.


Thanks,
Paolo.

///
2012-05-15  Paolo Carlini  paolo.carl...@oracle.com

* tree.h (EXPR_LOCATION): Use CAN_HAVE_LOCATION_P.
Index: tree.h
===
--- tree.h  (revision 187501)
+++ tree.h  (working copy)
@@ -1684,7 +1684,7 @@ struct GTY(()) tree_constructor {
decls and constants can be shared among multiple locations, so
return nothing.  */
 #define EXPR_LOCATION(NODE) \
-  (EXPR_P ((NODE)) ? (NODE)-exp.locus : UNKNOWN_LOCATION)
+  (CAN_HAVE_LOCATION_P ((NODE)) ? (NODE)-exp.locus : UNKNOWN_LOCATION)
 #define SET_EXPR_LOCATION(NODE, LOCUS) EXPR_CHECK ((NODE))-exp.locus = (LOCUS)
 #define EXPR_HAS_LOCATION(NODE) (EXPR_LOCATION (NODE) != UNKNOWN_LOCATION)
 #define EXPR_LOC_OR_HERE(NODE) (EXPR_HAS_LOCATION (NODE) ? (NODE)-exp.locus : 
input_location)


Re: [Patch] Use CAN_HAVE_LOCATION_P in EXPR_LOCATION

2012-05-15 Thread Jason Merrill

OK.

Jason