Thanks, committed in r209221! Jordan
On May 19, 2014, at 5:24 , Anders Rönnholm <[email protected]> wrote: > Hi, > > Added testcases and changed to getValue(). Yes support for negative values > will be added when i do the same for my previous CFG patch. > > //Anders > ________________________________________ > Från: Jordan Rose [[email protected]] > Skickat: den 16 maj 2014 18:36 > Till: Anders Rönnholm > Cc: [email protected]; Daniel Marjamäki > Ämne: Re: [PATCH] Bitwise comparison always true > > Nifty. Some comments: > > + llvm::APSInt L1, L2; > + IntLiteral->EvaluateAsInt(L1, *Context); > + IntLiteral2->EvaluateAsInt(L2, *Context); > > IntegerLiteral extends APIntStorage, so you can skip the complicated > EvaluateAsInt path and just go with IntLiteral->getValue(). Note that this > returns an APInt because a minus sign is not part of the literal. You can add > that in a separate patch, though. > > Please add some tests that show "8 & x" instead of "x & 8". I see that it's > already handled, but it should be in the tests as well. Please also add tests > where the number being used for the bitwise op is not a power of 2, and where > neither of them are. > > Jordan > > > On May 16, 2014, at 4:42 , Anders Rönnholm <[email protected]> > wrote: > >> Hi, >> >> I have made a small patch which improves the CFG equality operator >> evaluation to detect logical errors in bitwise comparisons. >> >> It finds logical errors in and/or operations that always evaluates to >> true/false such as. >> (x & 8) == 4 >> >> //Anders >> <bitwisecomparison.diff>_______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > > <bitwisecomparison.diff> _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
