blob: b092ed8fe150f3e799013a4783ac7f85112db51b (
plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
|
//===--- Registry.h - Matcher registry -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Registry of all known matchers.
///
/// The registry provides a generic interface to construct any matcher by name.
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_AST_MATCHERS_DYNAMIC_REGISTRY_H
#define LLVM_CLANG_AST_MATCHERS_DYNAMIC_REGISTRY_H
#include "clang/ASTMatchers/Dynamic/Diagnostics.h"
#include "clang/ASTMatchers/Dynamic/VariantValue.h"
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
namespace clang {
namespace ast_matchers {
namespace dynamic {
class Registry {
public:
/// \brief Construct a matcher from the registry by name.
///
/// Consult the registry of known matchers and construct the appropriate
/// matcher by name.
///
/// \param MatcherName The name of the matcher to instantiate.
///
/// \param NameRange The location of the name in the matcher source.
/// Useful for error reporting.
///
/// \param Args The argument list for the matcher. The number and types of the
/// values must be valid for the matcher requested. Otherwise, the function
/// will return an error.
///
/// \return The matcher if no error was found. NULL if the matcher is not
// found, or if the number of arguments or argument types do not
/// match the signature. In that case \c Error will contain the description
/// of the error.
static DynTypedMatcher *constructMatcher(StringRef MatcherName,
const SourceRange &NameRange,
ArrayRef<ParserValue> Args,
Diagnostics *Error);
private:
Registry() LLVM_DELETED_FUNCTION;
};
} // namespace dynamic
} // namespace ast_matchers
} // namespace clang
#endif // LLVM_CLANG_AST_MATCHERS_DYNAMIC_REGISTRY_H
|