Modifying the AST

I want a (out-of-tree) plugin which examines the AST.
This plugin traverses the AST identifying whether certain prohibited objects are used.
An example of such an object would be, for example, a function from the standard library, such as sinh.

My (current) issue is that the include files are not found by cmake.

// tag::visitor_hdr[]
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h"
// end::visitor_hdr[]

Do I need to clone the git repo for llvm or is there a lighter weight approach?

Here is the project so far.

Surprise. It depends. Ubuntu ships:

If you are on some kind of Linux, there will be a similar package with the headers.
Homebrew installed the headers for me in:
/usr/local/opt/llvm/include/clang/

1 Like

There is a clang dev package for Windows via the conda ecosystem.