https://github.com/earnol created https://github.com/llvm/llvm-project/pull/125122
Provide a documentation for FixedPointLiteral exaplaining which literals will be matched and which are not. This documentation is compatible with https://github.com/llvm/llvm-project/commit/53e92e48d0c03a2475e8517dd4c28968d84fc217 change. >From ee48a372842815f8477f2ff0cd72a2002e8ed062 Mon Sep 17 00:00:00 2001 From: Vladislav Aranov <vladislav.ara...@ericsson.com> Date: Thu, 30 Jan 2025 23:00:34 +0100 Subject: [PATCH] [clang] [doc] Provide documentation for FixedPointLiteral matcher Provide a documentation for FixedPointLiteral exaplaining which literals will be matched and which are not. This documentation is compatible with https://github.com/llvm/llvm-project/commit/53e92e48d0c03a2475e8517dd4c28968d84fc217 change. --- clang/include/clang/ASTMatchers/ASTMatchers.h | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index 239fcba4e5e057..0f7e3a8a01762c 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; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits