diagnostic-metadata.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* Additional metadata for a diagnostic.
  2. Copyright (C) 2019-2020 Free Software Foundation, Inc.
  3. Contributed by David Malcolm <dmalcolm@redhat.com>
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 3, or (at your option) any later
  8. version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_DIAGNOSTIC_METADATA_H
  17. #define GCC_DIAGNOSTIC_METADATA_H
  18. /* A bundle of additional metadata that can be associated with a
  19. diagnostic.
  20. Currently this only supports associating a CWE identifier with a
  21. diagnostic. */
  22. class diagnostic_metadata
  23. {
  24. public:
  25. diagnostic_metadata () : m_cwe (0) {}
  26. void add_cwe (int cwe) { m_cwe = cwe; }
  27. int get_cwe () const { return m_cwe; }
  28. private:
  29. int m_cwe;
  30. };
  31. #endif /* ! GCC_DIAGNOSTIC_METADATA_H */