The patch mainly focuses on the no warnings for -Wtautological-compare. I t work fine for the positive numbers but doesn't for the negative numbers as mention in the post that this is because the warning explicitly checks for an IntegerLiteral AST node, but -1 is represented by a UnaryOperator with an IntegerLiteral sub-Expr.
So, for the solution lib/Analysis/CFG.cpp was updated by using the different hellper functions to identify that it is a integer lliteral and then will take value from the expression. The functions checkIncorrectEqualityOperator and also functions for the relational operators will be updated.
For the below code we have warnings:
if (0 == (5 | x)) {}
but not for
if (0 == (-5 | x)) {}
Thus updating to tackle this issue.
For debugging?
Have you tried llvm::errs() << "message"; ? A few streams are provided by LLVM support which most places have already, so no extra header is needed to make it work.