How to register a Clang plugin?


I’ve compiled a Clang plugin as explained here: Everything works as expected, but I’m getting some problems when I go further and try to compile a plugin that has a more complex registration process.

For example, I have tried to compile the MallocChecker(from clang/lib/StaticAnalyzer/Checkers) as a separate plugin; the compilation works, but the analyzer does not report anything on an example which was previously checked with the original MallocChecker (in Clang) and some warnings were thrown.
This is a bit unexpected, since the code is exactly the same, except the registration part. I believe the problem is that the MallocChecker has some tricky initialization steps. Did anyone else encountered this problem before?