Skip to content

Commit 4d7192a

Browse files
earnolVladislav Aranov
and
Vladislav Aranov
authored
[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 53e92e4 change. Co-authored-by: Vladislav Aranov <[email protected]>
1 parent 1438c8d commit 4d7192a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

clang/include/clang/ASTMatchers/ASTMatchers.h

+22-1
Original file line numberDiff line numberDiff line change
@@ -2489,7 +2489,28 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral>
24892489
extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral>
24902490
imaginaryLiteral;
24912491

2492-
/// Matches fixed point literals
2492+
/// Matches fixed-point literals eg.
2493+
/// 0.5r, 0.5hr, 0.5lr, 0.5uhr, 0.5ur, 0.5ulr
2494+
/// 1.0k, 1.0hk, 1.0lk, 1.0uhk, 1.0uk, 1.0ulk
2495+
/// Exponents 1.0e10k
2496+
/// Hexadecimal numbers 0x0.2p2r
2497+
///
2498+
/// Does not match implicit conversions such as first two lines:
2499+
/// \code
2500+
/// short _Accum sa = 2;
2501+
/// _Accum a = 12.5;
2502+
/// _Accum b = 1.25hk;
2503+
/// _Fract c = 0.25hr;
2504+
/// _Fract v = 0.35uhr;
2505+
/// _Accum g = 1.45uhk;
2506+
/// _Accum decexp1 = 1.575e1k;
2507+
/// \endcode
2508+
/// \compile_args{-ffixed-point;-std=c99}
2509+
///
2510+
/// The matcher \matcher{fixedPointLiteral()} matches
2511+
/// \match{1.25hk}, \match{0.25hr}, \match{0.35uhr},
2512+
/// \match{1.45uhk}, \match{1.575e1k}, but does not
2513+
/// match \nomatch{12.5} and \nomatch{2} from the code block.
24932514
extern const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral>
24942515
fixedPointLiteral;
24952516

0 commit comments

Comments
 (0)