string_helpers.h 703 B

12345678910111213141516171819202122232425
  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 COMMON_STRING_HELPERS_H_
  5. #define COMMON_STRING_HELPERS_H_
  6. #include <optional>
  7. #include <string>
  8. #include "llvm/ADT/StringRef.h"
  9. namespace Carbon {
  10. // Note llvm StringExtras has significant functionality which is intended to be
  11. // complementary to this.
  12. // Unescapes Carbon escape sequences in the source string. Returns std::nullopt
  13. // on bad input.
  14. auto UnescapeStringLiteral(llvm::StringRef source)
  15. -> std::optional<std::string>;
  16. } // namespace Carbon
  17. #endif // COMMON_STRING_HELPERS_H_