proto_to_carbon.h 882 B

12345678910111213141516171819202122
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef CARBON_COMMON_FUZZING_PROTO_TO_CARBON_H_
  5. #define CARBON_COMMON_FUZZING_PROTO_TO_CARBON_H_
  6. #include "common/fuzzing/carbon.pb.h"
  7. namespace Carbon {
  8. // Builds a Carbon source from `compilation_unit`. The logic tries to produce a
  9. // syntactially valid Carbon source for all cases, even if the input protocol
  10. // buffer is invalid (like a variable declaration with an empty `name` field).
  11. // This is done to reduce the number of inputs the fuzzer framework generates
  12. // when trying to produce lexically valid source.
  13. auto ProtoToCarbon(const Fuzzing::CompilationUnit& compilation_unit)
  14. -> std::string;
  15. } // namespace Carbon
  16. #endif // CARBON_COMMON_FUZZING_PROTO_TO_CARBON_H_