Seems quite possible I think. The compiler plugin API offers `Checker`s which allow reporting errors, and you can thus create a checker for every mention of declarations, check what file it comes from, and thus create a basic graph then check for cycles and report errors