[clang] 4d7192a - [clang][doc] Provide documentation for FixedPointLiteral matcher (#125122)

via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 7 08:52:44 PST 2025


Author: earnol
Date: 2025-02-07T11:52:39-05:00
New Revision: 4d7192a5ecabb36263a2cacd4e9243b958424805

URL: https://github.com/llvm/llvm-project/commit/4d7192a5ecabb36263a2cacd4e9243b958424805
DIFF: https://github.com/llvm/llvm-project/commit/4d7192a5ecabb36263a2cacd4e9243b958424805.diff

LOG: [clang][doc] Provide documentation for FixedPointLiteral matcher (#125122)

Provide a documentation for FixedPointLiteral explaining which literals
will be matched and which are not. This documentation is compatible with
https://github.com/llvm/llvm-project/commit/53e92e48d0c03a2475e8517dd4c28968d84fc217
change.

Co-authored-by: Vladislav Aranov <vladislav.aranov at ericsson.com>

Added: 
    

Modified: 
    clang/include/clang/ASTMatchers/ASTMatchers.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h
index 239fcba4e5e0572..0f7e3a8a01762ce 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -2489,7 +2489,28 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral>
 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral>
     imaginaryLiteral;
 
-/// Matches fixed point literals
+/// Matches fixed-point literals eg.
+/// 0.5r, 0.5hr, 0.5lr, 0.5uhr, 0.5ur, 0.5ulr
+/// 1.0k, 1.0hk, 1.0lk, 1.0uhk, 1.0uk, 1.0ulk
+/// Exponents 1.0e10k
+/// Hexadecimal numbers 0x0.2p2r
+///
+/// Does not match implicit conversions such as first two lines:
+/// \code
+///    short _Accum sa = 2;
+///    _Accum a = 12.5;
+///    _Accum b = 1.25hk;
+///    _Fract c = 0.25hr;
+///    _Fract v = 0.35uhr;
+///    _Accum g = 1.45uhk;
+///    _Accum decexp1 = 1.575e1k;
+/// \endcode
+/// \compile_args{-ffixed-point;-std=c99}
+///
+/// The matcher \matcher{fixedPointLiteral()} matches
+/// \match{1.25hk}, \match{0.25hr}, \match{0.35uhr},
+/// \match{1.45uhk}, \match{1.575e1k}, but does not
+/// match \nomatch{12.5} and \nomatch{2} from the code block.
 extern const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral>
     fixedPointLiteral;
 


        


More information about the cfe-commits mailing list