No functional change intended.
gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Replace edit-context.o with
diagnostics/edit-context.o.
* diagnostic-format-html.cc: Update #include for move
of edit-context.h to diagnostics subdir.
* diagnostic.cc: Likewise. Update for move of edit_context to
diagnostics::edit_context.
* diagnostic.h: Likewise.
* edit-context.cc: Move to...
* diagnostics/edit-context.cc: ...here. Update #include for move
of edit-context.h to diagnostics subdir. Move all code
within namespace diagnostics.
* edit-context.h: Move to...
* diagnostics/edit-context.h: ...here, updating header guard.
Move all code within namespace diagnostics.
* libgdiagnostics.cc: Update #include for move of edit-context.h
to diagnostics subdir. Update for move of edit_context
to diagnostics::edit_context.
* toplev.cc: Update #include for move of edit-context.h
to diagnostics subdir.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/expensive_selftests_plugin.cc: Update #include for
move of edit-context.h to diagnostics subdir. Update
for move of edit_context to diagnostics::edit_context.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
diagnostic-path-output.o \
diagnostic-show-locus.o \
diagnostics/digraphs.o \
+ diagnostics/edit-context.o \
diagnostics/state-graphs.o \
diagnostics/state-graphs-to-dot.o \
diagnostics/selftest-logical-locations.o \
- edit-context.o \
graphviz.o pex.o \
pretty-print.o intl.o \
json.o json-parsing.o \
#include "selftest-diagnostic.h"
#include "pretty-print-format-impl.h"
#include "pretty-print-urlifier.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
#include "intl.h"
#include "xml.h"
#include "xml-printer.h"
#include "diagnostic-format.h"
#include "diagnostic-format-sarif.h"
#include "diagnostic-format-text.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
#include "selftest.h"
#include "selftest-diagnostic.h"
#include "opts.h"
{
delete m_edit_context_ptr;
gcc_assert (m_file_cache);
- m_edit_context_ptr = new edit_context (*m_file_cache);
+ m_edit_context_ptr = new diagnostics::edit_context (*m_file_cache);
}
/* Initialize DIAGNOSTIC, where the message MSG has already been
} // namespace diagnostics::logical_locations
class diagram;
+ class edit_context;
} // namespace diagnostics
virtual char *make_option_url (diagnostic_option_id option_id) const = 0;
};
-class edit_context;
class diagnostic_client_data_hooks;
class diagnostic_source_effect_info;
class diagnostic_output_format;
source code
- a cache for use when quoting the user's source code (class file_cache)
- a text_art::theme
- - an edit_context for generating patches from fix-it hints
+ - a diagnostics::edit_context for generating patches from fix-it hints
- diagnostic_client_data_hooks for metadata.
Try to avoid adding new responsibilities to this class itself, to avoid
return *m_file_cache;
}
- edit_context *get_edit_context () const
+ diagnostics::edit_context *get_edit_context () const
{
return m_edit_context_ptr;
}
applied, for generating patches.
Owned by the context; this would be a std::unique_ptr if
diagnostic_context had a proper ctor. */
- edit_context *m_edit_context_ptr;
+ diagnostics::edit_context *m_edit_context_ptr;
/* Fields relating to diagnostic groups. */
struct {
#include "system.h"
#include "coretypes.h"
#include "line-map.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
#include "pretty-print.h"
#include "diagnostic-color.h"
#include "selftest.h"
+namespace diagnostics {
+
/* This file implements a way to track the effect of fix-its,
via a class edit_context; the other classes are support classes for
edit_context.
m_content[m_len] = '\0';
}
+} // namespace diagnostics
+
#if CHECKING_P
/* Selftests of code-editing. */
namespace selftest {
+using edit_context = diagnostics::edit_context;
+
/* A wrapper class for ensuring that the underlying pointer is freed. */
template <typename POINTER_T>
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-#ifndef GCC_EDIT_CONTEXT_H
-#define GCC_EDIT_CONTEXT_H
+#ifndef GCC_DIAGNOSTICS_EDIT_CONTEXT_H
+#define GCC_DIAGNOSTICS_EDIT_CONTEXT_H
#include "typed-splay-tree.h"
class fixit_hint;
+
+namespace diagnostics {
+
class edit_context;
class edited_file;
typed_splay_tree<const char *, edited_file *> m_files;
};
-#endif /* GCC_EDIT_CONTEXT_H. */
+} // namespace diagnostics
+
+#endif /* GCC_DIAGNOSTICS_EDIT_CONTEXT_H. */
#include "diagnostics/digraphs.h"
#include "diagnostics/state-graphs.h"
#include "diagnostics/logical-locations.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
#include "libgdiagnostics.h"
#include "libgdiagnostics-private.h"
#include "pretty-print-format-impl.h"
diagnostic_text_starter (&m_dc) = diagnostic_text_sink::text_starter;
- m_edit_context = std::make_unique <edit_context> (m_dc.get_file_cache ());
+ m_edit_context
+ = std::make_unique <diagnostics::edit_context> (m_dc.get_file_cache ());
}
~diagnostic_manager ()
logical_locs_map_t m_logical_locs;
const diagnostic *m_current_diag;
const diagnostic_logical_location *m_prev_diag_logical_loc;
- std::unique_ptr<edit_context> m_edit_context;
+ std::unique_ptr<diagnostics::edit_context> m_edit_context;
};
class impl_rich_location : public rich_location
#include "system.h"
#include "coretypes.h"
#include "diagnostic.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
#include "selftest.h"
#include "selftest-diagnostic.h"
richloc, DK_ERROR, dc.get_reference_printer ());
/* Generate a diff. */
- edit_context ec (global_dc->get_file_cache ());
+ diagnostics::edit_context ec (global_dc->get_file_cache ());
ec.add_fixits (richloc);
char *diff = ec.generate_diff (true);
free (diff);
#include "ipa-utils.h"
#include "gcse.h"
#include "omp-offload.h"
-#include "edit-context.h"
+#include "diagnostics/edit-context.h"
#include "tree-pass.h"
#include "dumpfile.h"
#include "ipa-fnsummary.h"