/* Declarations relating to class gcc_rich_location
- Copyright (C) 2014-2019 Free Software Foundation, Inc.
+ Copyright (C) 2014-2024 Free Software Foundation, Inc.
This file is part of GCC.
#ifndef GCC_RICH_LOCATION_H
#define GCC_RICH_LOCATION_H
+#include "rich-location.h"
+
/* A gcc_rich_location is libcpp's rich_location with additional
- helper methods for working with gcc's types. */
+ helper methods for working with gcc's types. The class is not
+ copyable or assignable because rich_location isn't. */
+
class gcc_rich_location : public rich_location
{
public:
/* Constructors. */
/* Constructing from a location. */
- gcc_rich_location (location_t loc, const range_label *label = NULL)
+ explicit gcc_rich_location (location_t loc, const range_label *label = NULL)
: rich_location (line_table, loc, label)
{
}
if (!added secondary)
inform (secondary_loc, "message for secondary");
- Implemented in diagnostic-show-locus.c. */
+ Implemented in diagnostic-show-locus.cc. */
- bool add_location_if_nearby (location_t loc);
+ bool add_location_if_nearby (location_t loc,
+ bool restrict_to_current_line_spans = true,
+ const range_label *label = NULL);
/* Add a fix-it hint suggesting the insertion of CONTENT before
INSERTION_POINT.
public:
text_range_label (const char *text) : m_text (text) {}
- label_text get_text (unsigned /*range_idx*/) const FINAL OVERRIDE
+ label_text get_text (unsigned /*range_idx*/) const final override
{
- return label_text (const_cast <char *> (m_text), false);
+ return label_text::borrow (m_text);
}
private:
{
}
- label_text get_text (unsigned range_idx) const OVERRIDE;
+ label_text get_text (unsigned range_idx) const override;
protected:
tree m_labelled_type;
{
}
- label_text get_text (unsigned range_idx) const FINAL OVERRIDE;
+ label_text get_text (unsigned range_idx) const final override;
private:
tree m_expr;
tree m_other_expr;
};
-struct op_location_t;
+class op_location_t;
/* A subclass of rich_location for showing problems with binary operations.