aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2025-07-25 15:13:35 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2025-07-25 15:13:35 -0400
commitcf7b34b7f3083689dbcdd87991b0d5fc20cccfbf (patch)
tree56fdc108a1de98b756bfc8c174eeb7096bc505ab /gcc
parent1743dd35a7705ebf76ee505796f71c3ec0d9a39c (diff)
downloadgcc-cf7b34b7f3083689dbcdd87991b0d5fc20cccfbf.zip
gcc-cf7b34b7f3083689dbcdd87991b0d5fc20cccfbf.tar.gz
gcc-cf7b34b7f3083689dbcdd87991b0d5fc20cccfbf.tar.bz2
diagnostics: move diagnostic_metadata to diagnostics::metadata
renamed: gcc/diagnostic-metadata.h -> gcc/diagnostics/metadata.h No functional change intended. gcc/analyzer/ChangeLog: * diagnostic-manager.cc: Update for move of diagnostic_metadata to diagnostics::metadata. * kf.cc: Likewise. * pending-diagnostic.h: Likewise; also, update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h". gcc/cobol/ChangeLog: * util.cc: Remove redundant #includes gcc/ChangeLog: * diagnostic-core.h: Update for move of diagnostic_metadata to diagnostics::metadata. * diagnostic-format-html.cc: Likewise; also, update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h". * diagnostic-format-sarif.cc: Likewise. * diagnostic-format-text.cc: Likewise. * diagnostic-global-context.cc: Likewise. * diagnostic.cc: Likewise. * diagnostic.h: Likewise. * diagnostic-metadata.h: Move to... * diagnostics/metadata.h: ...here, updating header guard. (class diagnostic_metadata): Move to... (class diagnostics::metadata): ...here. Drop redundant "diagnostics::" qualifiers. * libgdiagnostics.cc: : Update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h", and update for move of diagnostic_metadata to diagnostics::metadata. * selftest-diagnostic.cc: Update for move of diagnostic_metadata to diagnostics::metadata. * selftest-diagnostic.h: Likewise. gcc/rust/ChangeLog: * rust-diagnostics.cc: Update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h", and update for move of diagnostic_metadata to diagnostics::metadata. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.cc: : Update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h" * gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_graphs.cc: Likewise. Also update for move of diagnostic_metadata to diagnostics::metadata. * gcc.dg/plugin/diagnostic_plugin_test_metadata.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/analyzer/diagnostic-manager.cc4
-rw-r--r--gcc/analyzer/kf.cc2
-rw-r--r--gcc/analyzer/pending-diagnostic.h8
-rw-r--r--gcc/cobol/util.cc8
-rw-r--r--gcc/diagnostic-core.h10
-rw-r--r--gcc/diagnostic-format-html.cc28
-rw-r--r--gcc/diagnostic-format-sarif.cc6
-rw-r--r--gcc/diagnostic-format-text.cc4
-rw-r--r--gcc/diagnostic-global-context.cc6
-rw-r--r--gcc/diagnostic.cc10
-rw-r--r--gcc/diagnostic.h10
-rw-r--r--gcc/diagnostics/metadata.h (renamed from gcc/diagnostic-metadata.h)22
-rw-r--r--gcc/libgdiagnostics.cc8
-rw-r--r--gcc/rust/rust-diagnostics.cc10
-rw-r--r--gcc/selftest-diagnostic.cc2
-rw-r--r--gcc/selftest-diagnostic.h2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_graphs.cc4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_metadata.cc12
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc8
22 files changed, 83 insertions, 87 deletions
diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc
index a3bec72..9258ffa 100644
--- a/gcc/analyzer/diagnostic-manager.cc
+++ b/gcc/analyzer/diagnostic-manager.cc
@@ -1541,12 +1541,12 @@ diagnostic_manager::emit_saved_diagnostics (const exploded_graph &eg)
best_candidates.emit_best (this, eg);
}
-/* Custom subclass of diagnostic_metadata which, for SARIF output,
+/* Custom subclass of diagnostics::metadata which, for SARIF output,
populates the property bag of the diagnostic's "result" object
with information from the saved_diagnostic and the
pending_diagnostic. */
-class pending_diagnostic_metadata : public diagnostic_metadata
+class pending_diagnostic_metadata : public diagnostics::metadata
{
public:
pending_diagnostic_metadata (const saved_diagnostic &sd)
diff --git a/gcc/analyzer/kf.cc b/gcc/analyzer/kf.cc
index fe25520..2a7c357 100644
--- a/gcc/analyzer/kf.cc
+++ b/gcc/analyzer/kf.cc
@@ -783,7 +783,7 @@ public:
/* SEI CERT C Coding Standard: "POS34-C. Do not call putenv() with a
pointer to an automatic variable as the argument". */
- diagnostic_metadata::precanned_rule
+ diagnostics::metadata::precanned_rule
rule ("POS34-C", "https://wiki.sei.cmu.edu/confluence/x/6NYxBQ");
ctxt.add_rule (rule);
diff --git a/gcc/analyzer/pending-diagnostic.h b/gcc/analyzer/pending-diagnostic.h
index 469513c..e703e80 100644
--- a/gcc/analyzer/pending-diagnostic.h
+++ b/gcc/analyzer/pending-diagnostic.h
@@ -21,7 +21,7 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_ANALYZER_PENDING_DIAGNOSTIC_H
#define GCC_ANALYZER_PENDING_DIAGNOSTIC_H
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
#include "diagnostic-path.h"
#include "analyzer/sm.h"
@@ -138,7 +138,7 @@ class diagnostic_emission_context
public:
diagnostic_emission_context (const saved_diagnostic &sd,
rich_location &rich_loc,
- diagnostic_metadata &metadata,
+ diagnostics::metadata &metadata,
logger *logger)
: m_sd (sd),
m_rich_loc (rich_loc),
@@ -156,7 +156,7 @@ public:
logger *get_logger () const { return m_logger; }
void add_cwe (int cwe) { m_metadata.add_cwe (cwe); }
- void add_rule (const diagnostic_metadata::rule &r)
+ void add_rule (const diagnostics::metadata::rule &r)
{
m_metadata.add_rule (r);
}
@@ -164,7 +164,7 @@ public:
private:
const saved_diagnostic &m_sd;
rich_location &m_rich_loc;
- diagnostic_metadata &m_metadata;
+ diagnostics::metadata &m_metadata;
logger *m_logger;
};
diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc
index 69b758a..ca53b26 100644
--- a/gcc/cobol/util.cc
+++ b/gcc/cobol/util.cc
@@ -47,15 +47,7 @@
#include <intl.h>
#include <backtrace.h>
#include <diagnostic.h>
-#include <diagnostic-color.h>
-#include <diagnostic-url.h>
-#include <diagnostic-metadata.h>
-#include <diagnostic-path.h>
-#include <edit-context.h>
-#include <selftest.h>
-#include <selftest-diagnostic.h>
#include <opts.h>
-
#include "util.h"
#include "cbldiag.h"
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h
index 1e89c9f..0132e95 100644
--- a/gcc/diagnostic-core.h
+++ b/gcc/diagnostic-core.h
@@ -61,7 +61,9 @@ class auto_diagnostic_nesting_level
};
/* Forward decl. */
-class diagnostic_metadata; /* See diagnostic-metadata.h. */
+namespace diagnostics {
+ class metadata; /* See diagnostics/metadata.h. */
+} // namespace diagnostics
/* A class to use for the ID of an option that controls
a particular diagnostic.
@@ -130,7 +132,7 @@ extern bool warning_at (rich_location *,
const char *, ...)
ATTRIBUTE_GCC_DIAG(3,4);
extern bool warning_meta (rich_location *,
- const diagnostic_metadata &,
+ const diagnostics::metadata &,
diagnostic_option_id,
const char *, ...)
ATTRIBUTE_GCC_DIAG(4,5);
@@ -141,7 +143,7 @@ extern void error_n (location_t, unsigned HOST_WIDE_INT, const char *,
extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void error_at (rich_location *, const char *, ...)
ATTRIBUTE_GCC_DIAG(2,3);
-extern void error_meta (rich_location *, const diagnostic_metadata &,
+extern void error_meta (rich_location *, const diagnostics::metadata &,
const char *, ...)
ATTRIBUTE_GCC_DIAG(3,4);
extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3)
@@ -189,7 +191,7 @@ extern bool emit_diagnostic_valist (diagnostic_t,
ATTRIBUTE_GCC_DIAG (4,0);
extern bool emit_diagnostic_valist_meta (diagnostic_t,
rich_location *,
- const diagnostic_metadata *,
+ const diagnostics::metadata *,
diagnostic_option_id,
const char *,
va_list *) ATTRIBUTE_GCC_DIAG (5,0);
diff --git a/gcc/diagnostic-format-html.cc b/gcc/diagnostic-format-html.cc
index 945be3e..ceca161 100644
--- a/gcc/diagnostic-format-html.cc
+++ b/gcc/diagnostic-format-html.cc
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "diagnostic.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
#include "diagnostic-format.h"
#include "diagnostic-format-html.h"
#include "diagnostic-format-text.h"
@@ -142,7 +142,7 @@ public:
}
std::unique_ptr<xml::element>
- make_element_for_metadata (const diagnostic_metadata &metadata);
+ make_element_for_metadata (const metadata &);
std::unique_ptr<xml::element>
make_element_for_patch (const diagnostic_info &diagnostic);
@@ -1209,11 +1209,11 @@ html_builder::make_metadata_element (label_text label,
}
std::unique_ptr<xml::element>
-html_builder::make_element_for_metadata (const diagnostic_metadata &metadata)
+html_builder::make_element_for_metadata (const metadata &m)
{
auto span_metadata = make_span ("gcc-metadata");
- int cwe = metadata.get_cwe ();
+ int cwe = m.get_cwe ();
if (cwe)
{
pretty_printer pp;
@@ -1224,9 +1224,9 @@ html_builder::make_element_for_metadata (const diagnostic_metadata &metadata)
(make_metadata_element (std::move (label), std::move (url)));
}
- for (unsigned idx = 0; idx < metadata.get_num_rules (); ++idx)
+ for (unsigned idx = 0; idx < m.get_num_rules (); ++idx)
{
- auto &rule = metadata.get_rule (idx);
+ auto &rule = m.get_rule (idx);
label_text label = label_text::take (rule.make_description ());
label_text url = label_text::take (rule.make_url ());
span_metadata->add_child
@@ -1652,9 +1652,9 @@ test_metadata ()
html_builder &b = dc.get_builder ();
{
- diagnostic_metadata metadata;
- metadata.add_cwe (415);
- auto element = b.make_element_for_metadata (metadata);
+ metadata m;
+ m.add_cwe (415);
+ auto element = b.make_element_for_metadata (m);
ASSERT_XML_PRINT_EQ
(*element,
"<span class=\"gcc-metadata\">"
@@ -1669,11 +1669,11 @@ test_metadata ()
}
{
- diagnostic_metadata metadata;
- diagnostic_metadata::precanned_rule rule ("MISC-42",
- "http://example.com");
- metadata.add_rule (rule);
- auto element = b.make_element_for_metadata (metadata);
+ metadata m;
+ metadata::precanned_rule rule ("MISC-42",
+ "http://example.com");
+ m.add_rule (rule);
+ auto element = b.make_element_for_metadata (m);
ASSERT_XML_PRINT_EQ
(*element,
"<span class=\"gcc-metadata\">"
diff --git a/gcc/diagnostic-format-sarif.cc b/gcc/diagnostic-format-sarif.cc
index 2a9956b..44d94c7 100644
--- a/gcc/diagnostic-format-sarif.cc
+++ b/gcc/diagnostic-format-sarif.cc
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "diagnostic.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
#include "diagnostics/digraphs.h"
#include "diagnostics/state-graphs.h"
#include "diagnostic-path.h"
@@ -745,7 +745,7 @@ sarif_serialization_format_json::write_to_file (FILE *outf,
- doesn't capture -Werror cleanly
- doesn't capture inlining information (can SARIF handle this?)
- doesn't capture macro expansion information (can SARIF handle this?).
- - doesn't capture any diagnostic_metadata::rules associated with
+ - doesn't capture any diagnostics::metadata::rules associated with
a diagnostic. */
class sarif_builder
@@ -2039,7 +2039,7 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic,
diagnostic.metadata->maybe_add_sarif_properties (*result_obj);
- /* We don't yet support diagnostic_metadata::rule. */
+ /* We don't yet support diagnostics::metadata::rule. */
}
/* "level" property (SARIF v2.1.0 section 3.27.10). */
diff --git a/gcc/diagnostic-format-text.cc b/gcc/diagnostic-format-text.cc
index 7ecbe5f..0696a34 100644
--- a/gcc/diagnostic-format-text.cc
+++ b/gcc/diagnostic-format-text.cc
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "diagnostic-color.h"
#include "diagnostic-url.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
#include "diagnostic-path.h"
#include "diagnostic-client-data-hooks.h"
#include "diagnostic-diagram.h"
@@ -512,7 +512,7 @@ print_any_rules (const diagnostic_info &diagnostic)
for (unsigned idx = 0; idx < diagnostic.metadata->get_num_rules (); idx++)
{
- const diagnostic_metadata::rule &rule
+ const diagnostics::metadata::rule &rule
= diagnostic.metadata->get_rule (idx);
if (char *desc = rule.make_description ())
{
diff --git a/gcc/diagnostic-global-context.cc b/gcc/diagnostic-global-context.cc
index 1165915..5eba3aa 100644
--- a/gcc/diagnostic-global-context.cc
+++ b/gcc/diagnostic-global-context.cc
@@ -103,7 +103,7 @@ emit_diagnostic_valist (diagnostic_t kind,
bool
emit_diagnostic_valist_meta (diagnostic_t kind,
rich_location *richloc,
- const diagnostic_metadata *metadata,
+ const diagnostics::metadata *metadata,
diagnostic_option_id option_id,
const char *gmsgid, va_list *ap)
{
@@ -210,7 +210,7 @@ warning_at (rich_location *richloc,
bool
warning_meta (rich_location *richloc,
- const diagnostic_metadata &metadata,
+ const diagnostics::metadata &metadata,
diagnostic_option_id option_id,
const char *gmsgid, ...)
{
@@ -443,7 +443,7 @@ error_at (rich_location *richloc, const char *gmsgid, ...)
/* Same as above, but with metadata. */
void
-error_meta (rich_location *richloc, const diagnostic_metadata &metadata,
+error_meta (rich_location *richloc, const diagnostics::metadata &metadata,
const char *gmsgid, ...)
{
gcc_assert (richloc);
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 9eab7ba..86bf4e3 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "diagnostic-color.h"
#include "diagnostic-url.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
#include "diagnostic-path.h"
#include "diagnostic-client-data-hooks.h"
#include "diagnostic-diagram.h"
@@ -1372,7 +1372,7 @@ bool
diagnostic_context::
emit_diagnostic_with_group (diagnostic_t kind,
rich_location &richloc,
- const diagnostic_metadata *metadata,
+ const diagnostics::metadata *metadata,
diagnostic_option_id option_id,
const char *gmsgid, ...)
{
@@ -1395,7 +1395,7 @@ bool
diagnostic_context::
emit_diagnostic_with_group_va (diagnostic_t kind,
rich_location &richloc,
- const diagnostic_metadata *metadata,
+ const diagnostics::metadata *metadata,
diagnostic_option_id option_id,
const char *gmsgid, va_list *ap)
{
@@ -1688,7 +1688,7 @@ trim_filename (const char *name)
and internal_error_no_backtrace, as documented and defined below. */
bool
diagnostic_context::diagnostic_impl (rich_location *richloc,
- const diagnostic_metadata *metadata,
+ const diagnostics::metadata *metadata,
diagnostic_option_id option_id,
const char *gmsgid,
va_list *ap, diagnostic_t kind)
@@ -1714,7 +1714,7 @@ diagnostic_context::diagnostic_impl (rich_location *richloc,
defined below. */
bool
diagnostic_context::diagnostic_n_impl (rich_location *richloc,
- const diagnostic_metadata *metadata,
+ const diagnostics::metadata *metadata,
diagnostic_option_id option_id,
unsigned HOST_WIDE_INT n,
const char *singular_gmsgid,
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 5ccf30c..70156fe 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -161,7 +161,7 @@ struct diagnostic_info
/* An optional bundle of metadata associated with the diagnostic
(or NULL). */
- const diagnostic_metadata *metadata;
+ const diagnostics::metadata *metadata;
/* Auxiliary data for client. */
void *x_data;
@@ -615,13 +615,13 @@ public:
bool emit_diagnostic_with_group (diagnostic_t kind,
rich_location &richloc,
- const diagnostic_metadata *metadata,
+ const diagnostics::metadata *metadata,
diagnostic_option_id option_id,
const char *gmsgid, ...)
ATTRIBUTE_GCC_DIAG(6,7);
bool emit_diagnostic_with_group_va (diagnostic_t kind,
rich_location &richloc,
- const diagnostic_metadata *metadata,
+ const diagnostics::metadata *metadata,
diagnostic_option_id option_id,
const char *gmsgid, va_list *ap)
ATTRIBUTE_GCC_DIAG(6,0);
@@ -785,10 +785,10 @@ public:
return m_lang_mask;
}
- bool diagnostic_impl (rich_location *, const diagnostic_metadata *,
+ bool diagnostic_impl (rich_location *, const diagnostics::metadata *,
diagnostic_option_id, const char *,
va_list *, diagnostic_t) ATTRIBUTE_GCC_DIAG(5,0);
- bool diagnostic_n_impl (rich_location *, const diagnostic_metadata *,
+ bool diagnostic_n_impl (rich_location *, const diagnostics::metadata *,
diagnostic_option_id, unsigned HOST_WIDE_INT,
const char *, const char *, va_list *,
diagnostic_t) ATTRIBUTE_GCC_DIAG(7,0);
diff --git a/gcc/diagnostic-metadata.h b/gcc/diagnostics/metadata.h
index f6ea7dc..d0b4220 100644
--- a/gcc/diagnostic-metadata.h
+++ b/gcc/diagnostics/metadata.h
@@ -18,16 +18,16 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-#ifndef GCC_DIAGNOSTIC_METADATA_H
-#define GCC_DIAGNOSTIC_METADATA_H
+#ifndef GCC_DIAGNOSTICS_METADATA_H
+#define GCC_DIAGNOSTICS_METADATA_H
class sarif_object;
namespace diagnostics {
+
namespace digraphs {
class lazy_digraphs;
} // namespace digraphs
-} // namespace diagnostics
/* A bundle of additional metadata that can be associated with a
diagnostic.
@@ -38,7 +38,7 @@ namespace diagnostics {
Additionally, this provides a place to associate a diagnostic
with zero or more directed graphs. */
-class diagnostic_metadata
+class metadata
{
public:
/* Abstract base class for referencing a rule that has been violated,
@@ -73,8 +73,8 @@ class diagnostic_metadata
const char *m_url;
};
- diagnostic_metadata () : m_cwe (0), m_lazy_digraphs (nullptr) {}
- virtual ~diagnostic_metadata () {}
+ metadata () : m_cwe (0), m_lazy_digraphs (nullptr) {}
+ virtual ~metadata () {}
/* Hook for SARIF output to allow for adding diagnostic-specific
properties to the result object's property bag. */
@@ -97,12 +97,12 @@ class diagnostic_metadata
const rule &get_rule (unsigned idx) const { return *(m_rules[idx]); }
void
- set_lazy_digraphs (const diagnostics::digraphs::lazy_digraphs *lazy_digraphs)
+ set_lazy_digraphs (const digraphs::lazy_digraphs *lazy_digraphs)
{
m_lazy_digraphs = lazy_digraphs;
}
- const diagnostics::digraphs::lazy_digraphs *
+ const digraphs::lazy_digraphs *
get_lazy_digraphs () const
{
return m_lazy_digraphs;
@@ -114,7 +114,9 @@ class diagnostic_metadata
/* An optional way to create directed graphs associated with the
diagnostic, for the sinks that support this (e.g. SARIF). */
- const diagnostics::digraphs::lazy_digraphs *m_lazy_digraphs;
+ const digraphs::lazy_digraphs *m_lazy_digraphs;
};
-#endif /* ! GCC_DIAGNOSTIC_METADATA_H */
+} // namespace diagnostics
+
+#endif /* ! GCC_DIAGNOSTICS_METADATA_H */
diff --git a/gcc/libgdiagnostics.cc b/gcc/libgdiagnostics.cc
index 8ccb278..7e93593 100644
--- a/gcc/libgdiagnostics.cc
+++ b/gcc/libgdiagnostics.cc
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "diagnostic-color.h"
#include "diagnostic-url.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
#include "diagnostic-path.h"
#include "diagnostic-client-data-hooks.h"
#include "diagnostic-format-sarif.h"
@@ -930,7 +930,7 @@ private:
char *m_text;
};
-class impl_rule : public diagnostic_metadata::rule
+class impl_rule : public diagnostics::metadata::rule
{
public:
impl_rule (const char *title, const char *url)
@@ -1226,7 +1226,7 @@ public:
enum diagnostic_level get_level () const { return m_level; }
rich_location *get_rich_location () { return &m_rich_loc; }
- const diagnostic_metadata *get_metadata () { return &m_metadata; }
+ const diagnostics::metadata *get_metadata () { return &m_metadata; }
void set_cwe (unsigned cwe_id)
{
@@ -1322,7 +1322,7 @@ private:
enum diagnostic_level m_level;
impl_rich_location m_rich_loc;
const diagnostic_logical_location *m_logical_loc;
- diagnostic_metadata m_metadata;
+ diagnostics::metadata m_metadata;
prebuilt_digraphs m_graphs;
std::vector<std::unique_ptr<range_label>> m_labels;
std::vector<std::unique_ptr<impl_rule>> m_rules;
diff --git a/gcc/rust/rust-diagnostics.cc b/gcc/rust/rust-diagnostics.cc
index 0c0ef6e..702da71 100644
--- a/gcc/rust/rust-diagnostics.cc
+++ b/gcc/rust/rust-diagnostics.cc
@@ -22,7 +22,7 @@
#include "rust-diagnostics.h"
#include "options.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
static std::string
mformat_value ()
@@ -192,7 +192,7 @@ rust_error_at (const location_t location, const char *fmt, ...)
va_end (ap);
}
-class rust_error_code_rule : public diagnostic_metadata::rule
+class rust_error_code_rule : public diagnostics::metadata::rule
{
public:
rust_error_code_rule (const ErrorCode code) : m_code (code) {}
@@ -237,7 +237,7 @@ rust_be_error_at (const location_t location, const ErrorCode code,
const std::string &errmsg)
{
rich_location gcc_loc (line_table, location);
- diagnostic_metadata m;
+ diagnostics::metadata m;
rust_error_code_rule rule (code);
m.add_rule (rule);
error_meta (&gcc_loc, m, "%s", errmsg.c_str ());
@@ -260,7 +260,7 @@ rust_be_error_at (const rich_location &location, const ErrorCode code,
{
/* TODO: 'error_at' would like a non-'const' 'rich_location *'. */
rich_location &gcc_loc = const_cast<rich_location &> (location);
- diagnostic_metadata m;
+ diagnostics::metadata m;
rust_error_code_rule rule (code);
m.add_rule (rule);
error_meta (&gcc_loc, m, "%s", errmsg.c_str ());
@@ -281,7 +281,7 @@ void
rust_be_error_at (rich_location *richloc, const ErrorCode code,
const std::string &errmsg)
{
- diagnostic_metadata m;
+ diagnostics::metadata m;
rust_error_code_rule rule (code);
m.add_rule (rule);
error_meta (richloc, m, "%s", errmsg.c_str ());
diff --git a/gcc/selftest-diagnostic.cc b/gcc/selftest-diagnostic.cc
index eeee2eb..3687d60 100644
--- a/gcc/selftest-diagnostic.cc
+++ b/gcc/selftest-diagnostic.cc
@@ -68,7 +68,7 @@ start_span_cb (const diagnostic_location_print_policy &loc_policy,
bool
test_diagnostic_context::report (diagnostic_t kind,
rich_location &richloc,
- const diagnostic_metadata *metadata,
+ const diagnostics::metadata *metadata,
diagnostic_option_id option,
const char * fmt, ...)
{
diff --git a/gcc/selftest-diagnostic.h b/gcc/selftest-diagnostic.h
index 4a43310..53a78f8 100644
--- a/gcc/selftest-diagnostic.h
+++ b/gcc/selftest-diagnostic.h
@@ -49,7 +49,7 @@ class test_diagnostic_context : public diagnostic_context
bool
report (diagnostic_t kind,
rich_location &richloc,
- const diagnostic_metadata *metadata,
+ const diagnostics::metadata *metadata,
diagnostic_option_id option,
const char * fmt, ...) ATTRIBUTE_GCC_DIAG(6,7);
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc b/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc
index 1fe5b5c..fe59b72 100644
--- a/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_cpython_plugin.cc
@@ -24,7 +24,7 @@
#include "fold-const.h"
#include "tree-pretty-print.h"
#include "diagnostic-color.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
#include "tristate.h"
#include "bitmap.h"
#include "selftest.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc b/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc
index 18e054b..bbcdb7a 100644
--- a/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_kernel_plugin.cc
@@ -24,7 +24,7 @@
#include "fold-const.h"
#include "tree-pretty-print.h"
#include "diagnostic-color.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
#include "tristate.h"
#include "bitmap.h"
#include "selftest.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc b/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc
index 5a6e075..1c0cc60 100644
--- a/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_known_fns_plugin.cc
@@ -24,7 +24,7 @@
#include "fold-const.h"
#include "tree-pretty-print.h"
#include "diagnostic-color.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
#include "tristate.h"
#include "bitmap.h"
#include "selftest.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_graphs.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_graphs.cc
index cfaffbf..fe54fe9 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_graphs.cc
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_graphs.cc
@@ -33,7 +33,7 @@
#include "diagnostic.h"
#include "context.h"
#include "gcc-rich-location.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
#include "diagnostics/digraphs.h"
#include "pass_manager.h"
@@ -230,7 +230,7 @@ report_diag_with_graphs (location_t loc)
};
gcc_rich_location rich_loc (loc);
- diagnostic_metadata meta;
+ diagnostics::metadata meta;
my_lazy_digraphs ldg;
meta.set_lazy_digraphs (&ldg);
error_meta (&rich_loc, meta,
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_metadata.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_metadata.cc
index b86a8b3..a1d003e 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_metadata.cc
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_metadata.cc
@@ -1,4 +1,4 @@
-/* This plugin exercises diagnostic_metadata. */
+/* This plugin exercises diagnostics::metadata. */
#include "gcc-plugin.h"
#include "config.h"
@@ -28,7 +28,7 @@
#include "diagnostic.h"
#include "context.h"
#include "gcc-rich-location.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
int plugin_is_GPL_compatible;
@@ -89,7 +89,7 @@ check_for_named_call (gimple *stmt,
return call;
}
-/* Exercise diagnostic_metadata. */
+/* Exercise diagnostics::metadata. */
unsigned int
pass_test_metadata::execute (function *fun)
@@ -106,13 +106,13 @@ pass_test_metadata::execute (function *fun)
if (gcall *call = check_for_named_call (stmt, "gets", 1))
{
gcc_rich_location richloc (gimple_location (call));
- diagnostic_metadata m;
+ diagnostics::metadata m;
/* CWE-242: Use of Inherently Dangerous Function. */
m.add_cwe (242);
- /* Example of a diagnostic_metadata::rule. */
- diagnostic_metadata::precanned_rule
+ /* Example of a diagnostics::metadata::rule. */
+ diagnostics::metadata::precanned_rule
test_rule ("STR34-C", "https://example.com/");
m.add_rule (test_rule);
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc
index a7963fa..babfc3b 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.cc
@@ -33,7 +33,7 @@
#include "plugin-version.h"
#include "diagnostic.h"
#include "diagnostic-path.h"
-#include "diagnostic-metadata.h"
+#include "diagnostics/metadata.h"
#include "context.h"
#include "print-tree.h"
#include "gcc-rich-location.h"
@@ -363,7 +363,7 @@ example_2 ()
richloc.set_path (&path);
- diagnostic_metadata m;
+ diagnostics::metadata m;
m.add_cwe (415); /* CWE-415: Double Free. */
warning_meta (&richloc, m, 0,
@@ -441,7 +441,7 @@ example_3 ()
richloc.set_path (&path);
- diagnostic_metadata m;
+ diagnostics::metadata m;
/* CWE-479: Signal Handler Use of a Non-reentrant Function. */
m.add_cwe (479);
@@ -524,7 +524,7 @@ example_4 ()
thread_2, event_a_acquired);
richloc.set_path (&path);
- diagnostic_metadata m;
+ diagnostics::metadata m;
warning_meta (&richloc, m, 0,
"deadlock due to inconsistent lock acquisition order");
}