aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/clang14/include/clang/Tooling/Transformer/Parsing.h
blob: d89ed53a8b139d5cab38cf56a2430bb0c3449710 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

//===--- Parsing.h - Parsing library for Transformer ------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
///  \file
///  Defines parsing functions for Transformer types.
///  FIXME: Currently, only supports `RangeSelectors` but parsers for other
///  Transformer types are under development.
///
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_TOOLING_TRANSFORMER_PARSING_H
#define LLVM_CLANG_TOOLING_TRANSFORMER_PARSING_H

#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Tooling/Transformer/RangeSelector.h"
#include "llvm/Support/Error.h"
#include <functional>

namespace clang {
namespace transformer {

/// Parses a string representation of a \c RangeSelector. The grammar of these
/// strings is closely based on the (sub)grammar of \c RangeSelectors as they'd
/// appear in C++ code. However, this language constrains the set of permissible
/// strings (for node ids) -- it does not support escapes in the
/// string. Additionally, the \c charRange combinator is not supported, because
/// there is no representation of values of type \c CharSourceRange in this
/// (little) language.
llvm::Expected<RangeSelector> parseRangeSelector(llvm::StringRef Input);

} // namespace transformer
} // namespace clang

#endif // LLVM_CLANG_TOOLING_TRANSFORMER_PARSING_H

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif