Can't find all values of enum 'AttrKind' in Attributes.h file

In the file : llvm/IR/Attributes.h an enum ‘AttrKind’ is defined. Inside its definition a file is included as : #include "llvm/IR/Attributes.inc", however, this file is not present at the path mentioned in include statement. Is there any way to to find out all the values of ‘AttrKind’ enum? I want to use these values as arguments for addAttr() method.

So this is an instance of generating include files hurting discover-ability. Trade offs all the way down.

Anyway, what I do in these situations is search the codebase for the filename (text search that is). What you’re looking for is a cmake file telling you how that file was built. Because sometimes the source for the .inc has a different name to the final file.

In this case it’s llvm/include/llvm/IR/CMakeLists.txt. Which tells us that Attributes.td is used to generate the .inc file (llvm/include/llvm/IR/Attributes.td).

If you just wanted to see the content of the .inc file, you can search your build folder for the .inc filename. You should find it in include/llvm/IR/.. but in the build folder not the source folder.

Hope that helps!

1 Like