clang: include/clang/AST/DeclVisitor.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_CLANG_AST_DECLVISITOR_H

14#define LLVM_CLANG_AST_DECLVISITOR_H

15

23#include "llvm/ADT/STLExtras.h"

24#include "llvm/Support/ErrorHandling.h"

25

27

28namespace declvisitor {

29

30template<template <typename> class Ptr, typename ImplClass, typename RetTy=void>

32public:

33#define PTR(CLASS) typename Ptr::type

34#define DISPATCH(NAME, CLASS) \

35 return static_cast<ImplClass*>(this)->Visit##NAME(static_cast<PTR(CLASS)>(D))

36

38 switch (D->getKind()) {

39#define DECL(DERIVED, BASE) \

40 case Decl::DERIVED: DISPATCH(DERIVED##Decl, DERIVED##Decl);

41#define ABSTRACT_DECL(DECL)

42#include "clang/AST/DeclNodes.inc"

43 }

44 llvm_unreachable("Decl that isn't part of DeclNodes.inc!");

45 }

46

47

48

49#define DECL(DERIVED, BASE) \

50 RetTy Visit##DERIVED##Decl(PTR(DERIVED##Decl) D) { DISPATCH(BASE, BASE); }

51#include "clang/AST/DeclNodes.inc"

52

54

55#undef PTR

56#undef DISPATCH

57};

58

59}

60

61

62

63

64

65template <typename ImplClass, typename RetTy = void>

67 : public declvisitor::Base<std::add_pointer, ImplClass, RetTy> {};

68

69

70

71

72template <typename ImplClass, typename RetTy = void>

74 : public declvisitor::Base<llvm::make_const_ptr, ImplClass, RetTy> {};

75

76}

77

78#endif

Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....

This file defines OpenMP nodes for declarative directives.

Defines the C++ template declaration subclasses.

A simple visitor class that helps create declaration visitors.

A simple visitor class that helps create declaration visitors.

Decl - This represents one declaration (or definition), e.g.

A simple visitor class that helps create declaration visitors.

RetTy VisitDecl(PTR(Decl) D)

The JSON file list parser is used to communicate input to InstallAPI.