using CodeGenOptions::EmitDeclMetadata()?

Does anyone know how to take advantage of this? The header file has a comment that reads “Only useful when running CodeGen as a subroutine”, I would like to use this feature in a Pass and don’t know where to begin.

Is there example code somewhere?

Thank you

LLDB uses it; you can check out their code and see the details. Essentially, if you set the flag, alloca instructions and global declarations will be marked with a metadata whose argument is the integral value of some corresponding Decl*. I would not count on this information surviving arbitrary optimizations, though.

John.

Only global declarations? Thats not good…

I need some simple way of marking function pointers and functions at the AST level(with a Plugin) and having it survive to the IR level(as a Pass).

Thanks

I very clearly said "alloca instructions and global declarations". These are the most obvious IR products corresponding to individual decls.

John.

I was more concerned about VarDecls created inside functions and if there was any possibility of getting those. I don’t know if that would be a reasonable thing to add, horrible idea, or very difficult.

If you don't recognize "alloca instructions" as pertaining to local variables, I think you might be in over your head.

John.