Parsing.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- Parsing.h - Parsing library for Transformer ------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. ///
  14. /// \file
  15. /// Defines parsing functions for Transformer types.
  16. /// FIXME: Currently, only supports `RangeSelectors` but parsers for other
  17. /// Transformer types are under development.
  18. ///
  19. //===----------------------------------------------------------------------===//
  20. #ifndef LLVM_CLANG_TOOLING_TRANSFORMER_PARSING_H
  21. #define LLVM_CLANG_TOOLING_TRANSFORMER_PARSING_H
  22. #include "clang/ASTMatchers/ASTMatchFinder.h"
  23. #include "clang/Basic/SourceLocation.h"
  24. #include "clang/Tooling/Transformer/RangeSelector.h"
  25. #include "llvm/Support/Error.h"
  26. #include <functional>
  27. namespace clang {
  28. namespace transformer {
  29. /// Parses a string representation of a \c RangeSelector. The grammar of these
  30. /// strings is closely based on the (sub)grammar of \c RangeSelectors as they'd
  31. /// appear in C++ code. However, this language constrains the set of permissible
  32. /// strings (for node ids) -- it does not support escapes in the
  33. /// string. Additionally, the \c charRange combinator is not supported, because
  34. /// there is no representation of values of type \c CharSourceRange in this
  35. /// (little) language.
  36. llvm::Expected<RangeSelector> parseRangeSelector(llvm::StringRef Input);
  37. } // namespace transformer
  38. } // namespace clang
  39. #endif // LLVM_CLANG_TOOLING_TRANSFORMER_PARSING_H
  40. #ifdef __GNUC__
  41. #pragma GCC diagnostic pop
  42. #endif