llvm/clang/include/clang/AST/AttrVisitor.h

//===- AttrVisitor.h - Visitor for Attr subclasses --------------*- 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
//
//===----------------------------------------------------------------------===//
//
//  This file defines the AttrVisitor interface.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_AST_ATTRVISITOR_H
#define LLVM_CLANG_AST_ATTRVISITOR_H

#include "clang/AST/Attr.h"

namespace clang {

namespace attrvisitor {

/// A simple visitor class that helps create attribute visitors.
template <template <typename> class Ptr, typename ImplClass,
          typename RetTy = void, class... ParamTys>
class Base {};

} // namespace attrvisitor

/// A simple visitor class that helps create attribute visitors.
///
/// This class does not preserve constness of Attr pointers (see
/// also ConstAttrVisitor).
template <typename ImplClass, typename RetTy = void, typename... ParamTys>
class AttrVisitor : public attrvisitor::Base<std::add_pointer, ImplClass, RetTy,
                                             ParamTys...> {};

/// A simple visitor class that helps create attribute visitors.
///
/// This class preserves constness of Attr pointers (see also
/// AttrVisitor).
template <typename ImplClass, typename RetTy = void, typename... ParamTys>
class ConstAttrVisitor
    : public attrvisitor::Base<llvm::make_const_ptr, ImplClass, RetTy,
                               ParamTys...> {};

} // namespace clang

#endif // LLVM_CLANG_AST_ATTRVISITOR_H