3.4 Recursive AST visitor
Recursive AST visitors address the limitations observed with specialized visitors. We will create the same program, which searches for and prints function declarations along with their parameters, but we’ll use a recursive visitor this time.
The CMakeLists.txt
for recursive visitor test tool will be used in a similar way as before. Only the project name (Lines 2 and 15-17 in Figure 3.20) and source filename (Line 14 in Figure 3.20 were changed:
1 cmake_minimum_required(VERSION 3.16) 2 project("recursivevisitor") 3 4 if ( NOT DEFINED ENV{LLVM_HOME}) 5 message(FATAL_ERROR "$LLVM_HOME is not defined") 6 else() 7 message(STATUS "$LLVM_HOME found: $ENV{LLVM_HOME}") 8 set(LLVM_HOME $ENV{LLVM_HOME} CACHE PATH "Root of LLVM installation") 9 set(LLVM_LIB...