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

Conversation

earnol
Copy link
Contributor

@earnol earnol commented Jan 30, 2025

Provide a documentation for FixedPointLiteral explaining which literals will be matched and which are not. This documentation is compatible with 53e92e4 change.

Provide a documentation for FixedPointLiteral exaplaining which
literals will be matched and which are not. This documentation is
compatible with llvm@53e92e4
change.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jan 30, 2025
@earnol earnol requested a review from 5chmidti January 30, 2025 22:07
@llvmbot
Copy link
Member

llvmbot commented Jan 30, 2025

@llvm/pr-subscribers-clang

Author: None (earnol)

Changes

Provide a documentation for FixedPointLiteral exaplaining which literals will be matched and which are not. This documentation is compatible with 53e92e4 change.


Full diff: https://github.com/llvm/llvm-project/pull/125122.diff

1 Files Affected:

  • (modified) clang/include/clang/ASTMatchers/ASTMatchers.h (+22-1)
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;
 

@earnol
Copy link
Contributor Author

earnol commented Feb 6, 2025

A gentle reminder to request a review for this PR since it is a week without a review.

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! (Thank you for the ping, this fell off my radar).

@earnol earnol merged commit 4d7192a into llvm:main Feb 7, 2025
11 checks passed
@earnol earnol deleted the AstMatcher branch February 7, 2025 16:53
Icohedron pushed a commit to Icohedron/llvm-project that referenced this pull request Feb 11, 2025
…m#125122)

Provide a documentation for FixedPointLiteral explaining which literals
will be matched and which are not. This documentation is compatible with
llvm@53e92e4
change.

Co-authored-by: Vladislav Aranov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants