From: Peter Collingbourne Date: Sat, 23 Nov 2013 01:34:36 +0000 (+0000) Subject: Rename *MatcherCreateCallback to *MatcherDescriptor, and its member run() to create(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d654f6b47211cac43d082aaf2995e8ff68f5f3a9;p=clang Rename *MatcherCreateCallback to *MatcherDescriptor, and its member run() to create(). The new names will be more appropriate when the objects are taught to return type information for the code completer. Differential Revision: http://llvm-reviews.chandlerc.com/D2208 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195539 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/ASTMatchers/Dynamic/Registry.h b/include/clang/ASTMatchers/Dynamic/Registry.h index ffdd8b21a9..f56a2c892e 100644 --- a/include/clang/ASTMatchers/Dynamic/Registry.h +++ b/include/clang/ASTMatchers/Dynamic/Registry.h @@ -29,10 +29,10 @@ namespace ast_matchers { namespace dynamic { namespace internal { -class MatcherCreateCallback; +class MatcherDescriptor; } -typedef const internal::MatcherCreateCallback *MatcherCtor; +typedef const internal::MatcherDescriptor *MatcherCtor; class Registry { public: diff --git a/lib/ASTMatchers/Dynamic/Marshallers.h b/lib/ASTMatchers/Dynamic/Marshallers.h index 2f9db9c56b..122d804133 100644 --- a/lib/ASTMatchers/Dynamic/Marshallers.h +++ b/lib/ASTMatchers/Dynamic/Marshallers.h @@ -76,25 +76,25 @@ template <> struct ArgTypeTraits { } }; -/// \brief Generic MatcherCreate interface. +/// \brief Matcher descriptor interface. /// -/// Provides a \c run() method that constructs the matcher from the provided +/// Provides a \c create() method that constructs the matcher from the provided /// arguments. -class MatcherCreateCallback { +class MatcherDescriptor { public: - virtual ~MatcherCreateCallback() {} - virtual VariantMatcher run(const SourceRange &NameRange, - ArrayRef Args, - Diagnostics *Error) const = 0; + virtual ~MatcherDescriptor() {} + virtual VariantMatcher create(const SourceRange &NameRange, + ArrayRef Args, + Diagnostics *Error) const = 0; }; /// \brief Simple callback implementation. Marshaller and function are provided. /// /// This class wraps a function of arbitrary signature and a marshaller -/// function into a MatcherCreateCallback. +/// function into a MatcherDescriptor. /// The marshaller is in charge of taking the VariantValue arguments, checking /// their types, unpacking them and calling the underlying function. -class FixedArgCountMatcherCreateCallback : public MatcherCreateCallback { +class FixedArgCountMatcherDescriptor : public MatcherDescriptor { public: typedef VariantMatcher (*MarshallerType)(void (*Func)(), StringRef MatcherName, @@ -105,12 +105,12 @@ public: /// \param Marshaller Function to unpack the arguments and call \c Func /// \param Func Matcher construct function. This is the function that /// compile-time matcher expressions would use to create the matcher. - FixedArgCountMatcherCreateCallback(MarshallerType Marshaller, void (*Func)(), - StringRef MatcherName) + FixedArgCountMatcherDescriptor(MarshallerType Marshaller, void (*Func)(), + StringRef MatcherName) : Marshaller(Marshaller), Func(Func), MatcherName(MatcherName) {} - VariantMatcher run(const SourceRange &NameRange, ArrayRef Args, - Diagnostics *Error) const { + VariantMatcher create(const SourceRange &NameRange, + ArrayRef Args, Diagnostics *Error) const { return Marshaller(Func, MatcherName, NameRange, Args, Error); } @@ -123,22 +123,22 @@ private: /// \brief Simple callback implementation. Free function is wrapped. /// /// This class simply wraps a free function with the right signature to export -/// it as a MatcherCreateCallback. +/// it as a MatcherDescriptor. /// This allows us to have one implementation of the interface for as many free /// functions as we want, reducing the number of symbols and size of the /// object file. -class FreeFuncMatcherCreateCallback : public MatcherCreateCallback { +class FreeFuncMatcherDescriptor : public MatcherDescriptor { public: typedef VariantMatcher (*RunFunc)(StringRef MatcherName, const SourceRange &NameRange, ArrayRef Args, Diagnostics *Error); - FreeFuncMatcherCreateCallback(RunFunc Func, StringRef MatcherName) + FreeFuncMatcherDescriptor(RunFunc Func, StringRef MatcherName) : Func(Func), MatcherName(MatcherName.str()) {} - VariantMatcher run(const SourceRange &NameRange, ArrayRef Args, - Diagnostics *Error) const { + VariantMatcher create(const SourceRange &NameRange, + ArrayRef Args, Diagnostics *Error) const { return Func(MatcherName, NameRange, Args, Error); } @@ -243,9 +243,8 @@ static VariantMatcher matcherMarshall2(void (*Func)(), StringRef MatcherName, template )> VariantMatcher -variadicMatcherCreateCallback(StringRef MatcherName, - const SourceRange &NameRange, - ArrayRef Args, Diagnostics *Error) { +variadicMatcherDescriptor(StringRef MatcherName, const SourceRange &NameRange, + ArrayRef Args, Diagnostics *Error) { ArgT **InnerArgs = new ArgT *[Args.size()](); bool HasError = false; @@ -282,7 +281,7 @@ template