brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 67ae36b Raw
43 lines · c
1//===--- TestVisitor.h ------------------------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8///9/// \file10/// \brief Defines a CRTP-based RecursiveASTVisitor helper for tests.11///12//===----------------------------------------------------------------------===//13 14#ifndef LLVM_CLANG_UNITTESTS_TOOLING_CRTPTESTVISITOR_H15#define LLVM_CLANG_UNITTESTS_TOOLING_CRTPTESTVISITOR_H16 17#include "TestVisitor.h"18#include "clang/AST/RecursiveASTVisitor.h"19 20// CRTP versions of the visitors in TestVisitor.h.21namespace clang {22template <typename T>23class CRTPTestVisitor : public RecursiveASTVisitor<T>,24                        public detail::TestVisitorHelper {25public:26  bool shouldVisitTemplateInstantiations() const { return true; }27  bool shouldVisitImplicitCode() const { return true; }28 29  void InvokeTraverseDecl(TranslationUnitDecl *D) override {30    RecursiveASTVisitor<T>::TraverseDecl(D);31  }32};33 34template <typename T>35class CRTPExpectedLocationVisitor36    : public CRTPTestVisitor<T>,37      public detail::ExpectedLocationVisitorHelper {38  ASTContext *getASTContext() override { return this->Context; }39};40} // namespace clang41 42#endif // LLVM_CLANG_UNITTESTS_TOOLING_CRTPTESTVISITOR_H43