[PATCH] D33135: [ASTMatchers] Add support for floatLiterals
    Aaron Ballman via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Fri May 12 10:08:48 PDT 2017
    
    
  
aaron.ballman added inline comments.
================
Comment at: include/clang/ASTMatchers/Dynamic/Parser.h:25
 /// <Boolean>           := true | false
+/// <Double>            := 1.0 | 2e-3 | 3.45e67
 /// <Unsigned>          := [0-9]+
----------------
It'd be good to list the actual grammar rather than a few examples.
================
Comment at: include/clang/ASTMatchers/Dynamic/VariantValue.h:335
     unsigned Unsigned;
+    double Double;
     bool Boolean;
----------------
This may or may not be a good idea, but do we want to put the values into an APFloat rather than a double? My concern with double is that (0) it may be subtly different if the user wants a 16- or 32-bit float explicitly, (1) it won't be able to represent long double values, or quad double.
I'm thinking this value could be passed directly from the C++ API as an APFloat, float, or double, or provided using a StringRef for the dynamic API.
================
Comment at: lib/ASTMatchers/Dynamic/Parser.cpp:180
   /// \brief Consume an unsigned literal.
   void consumeUnsignedLiteral(TokenInfo *Result) {
+    bool isFloatingLiteral = false;
----------------
This function should be renamed and the comment updated.
https://reviews.llvm.org/D33135
    
    
More information about the cfe-commits
mailing list