This is for matching float literals and for that it should provide good enough value. I don't think people will want to match the result of computations here and if they do want that, we can add more complex matchers.
On Tue, Feb 3, 2015 at 6:41 PM, Kim Gräsman <[email protected]> wrote: > Hi Daniel, > > On Tue, Feb 3, 2015 at 10:45 AM, Daniel Jasper <[email protected]> wrote: > > Author: djasper > > Date: Tue Feb 3 03:45:52 2015 > > New Revision: 227956 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=227956&view=rev > > Log: > > Add some overloads so that floating point literals can be AST matched > properly. > > > > I am not entirely sure whether the implemented sematics are ideal. In > > particular, should floatLiteral(equals(0.5)) match "0.5f" and should > > floatLiteral(equals(0.5f)) match "0.5". With the overloads in this > > patch, the answer to both questions is yes, but I am happy to change > > that. > > This looks scary to me given the general difficulties in comparing floats: > https://randomascii.wordpress.com/2013/07/16/floating-point-determinism/ > > Or is it safe because they're both fixed literals and not the result > of a calculation? Then again, nothing prevents me from doing; > > floatLiteral(equals(sqrt(AnArgument))) > > - Kim >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
