I have 2 out-of-tree plugins:
- A Clang plugin that adds specific function attributes to the Clang.
- A LLVM plugin that runs specific passes according to the attributes.
Currently, I have the following workflow:
- Run Clang with the Clang plugin which handles the attributes by collecting them into a JSON file (basically a map - “mangled function name” => “a list of the specific attributes”).
- Run Clang again with the LLVM plugin which parses the JSON into a global variable (ew) Then
the passes access later the global map and check if attributes were set for a function they were invoked for.
I do not like the following workflow because:
- I need to invoke the compiler twice. I tried to get it working with 2 plugins at one invocation but failed. Is there a way to invoke clang with the both plugins at once?
- The JSON file has a static name and the solution will break if source code is build in parallel (I mean
- Global variables
Any tips on how to make the workflow better are appreciated!
CC: @banach-space (as the author of llvm-tutor and clang-tutor)