diff options
Diffstat (limited to 'gcc/gcc-rich-location.h')
-rw-r--r-- | gcc/gcc-rich-location.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/gcc/gcc-rich-location.h b/gcc/gcc-rich-location.h index 200bbb5..202d4f4 100644 --- a/gcc/gcc-rich-location.h +++ b/gcc/gcc-rich-location.h @@ -162,4 +162,61 @@ class range_label_for_type_mismatch : public range_label tree m_other_type; }; +/* Subclass of range_label for labelling the type of EXPR when reporting + a type mismatch between EXPR and OTHER_EXPR. + Either or both of EXPR and OTHER_EXPR could be NULL. */ + +class maybe_range_label_for_tree_type_mismatch : public range_label +{ + public: + maybe_range_label_for_tree_type_mismatch (tree expr, tree other_expr) + : m_expr (expr), m_other_expr (other_expr) + { + } + + label_text get_text (unsigned range_idx) const FINAL OVERRIDE; + + private: + tree m_expr; + tree m_other_expr; +}; + +struct op_location_t; + +/* A subclass of rich_location for showing problems with binary operations. + + If enough location information is available, the ctor will make a + 3-location rich_location of the form: + + arg_0 op arg_1 + ~~~~~ ^~ ~~~~~ + | | + | arg1 type + arg0 type + + labelling the types of the arguments if SHOW_TYPES is true. + + Otherwise, it will fall back to a 1-location rich_location using the + compound location within LOC: + + arg_0 op arg_1 + ~~~~~~^~~~~~~~ + + for which we can't label the types. */ + +class binary_op_rich_location : public gcc_rich_location +{ + public: + binary_op_rich_location (const op_location_t &loc, + tree arg0, tree arg1, + bool show_types); + + private: + static bool use_operator_loc_p (const op_location_t &loc, + tree arg0, tree arg1); + + maybe_range_label_for_tree_type_mismatch m_label_for_arg0; + maybe_range_label_for_tree_type_mismatch m_label_for_arg1; +}; + #endif /* GCC_RICH_LOCATION_H */ |