Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang][doc] Provide documentation for FixedPointLiteral matcher #125122

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion clang/include/clang/ASTMatchers/ASTMatchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down