What is the quality of code generated by llc's cpp target?

I’ve been examining code generated by llc’s cpp target to get a handle on using llvm. I’m seeing a lot of new-ing without delete-ing, no use of smart pointers which iirc was approved on the mailing list a while back. I’m not %100 confident in my own knowledge of llvm, so I was wondering if the cpp target is a reasonable guide. Does it produce generally up-to-date use of the APIs or am I better off avoiding it all together?



Somewhere between the two. It's definitely not an example of the best
way to use the LLVM API (I'd say). It doesn't even use IRBuilder, let
alone smart pointers. Its output is primarily driven by the need to be
procedurally generated, rather than sane. I wouldn't even be surprised
if it didn't compile.

But even so it can be helpful for relationships between instructions
and to find out class and function names. Worth a try if the API docs
don't give you an answer immediately, in my view.