RemarkFormat.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //===-- llvm/Remarks/RemarkFormat.h - The format of remarks -----*- C++/-*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file defines utilities to deal with the format of remarks.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_REMARKS_REMARKFORMAT_H
  13. #define LLVM_REMARKS_REMARKFORMAT_H
  14. #include "llvm/ADT/StringRef.h"
  15. #include "llvm/Support/Error.h"
  16. namespace llvm {
  17. namespace remarks {
  18. constexpr StringLiteral Magic("REMARKS");
  19. /// The format used for serializing/deserializing remarks.
  20. enum class Format { Unknown, YAML, YAMLStrTab, Bitstream };
  21. /// Parse and validate a string for the remark format.
  22. Expected<Format> parseFormat(StringRef FormatStr);
  23. /// Parse and validate a magic number to a remark format.
  24. Expected<Format> magicToFormat(StringRef Magic);
  25. } // end namespace remarks
  26. } // end namespace llvm
  27. #endif // LLVM_REMARKS_REMARKFORMAT_H