diff options
| author | Leonard Chan <leonardchan@google.com> | 2018-06-20 17:19:40 +0000 |
|---|---|---|
| committer | Leonard Chan <leonardchan@google.com> | 2018-06-20 17:19:40 +0000 |
| commit | db01c3adc6f921a27e2bd39847140c401860aa56 (patch) | |
| tree | c4c7e6ec5b92b188b7224b963c196fb5fccc9c6d /clang/tools/libclang/CXCursor.cpp | |
| parent | 7e067ab1afec1984e8c9d663a333d145f66c2adf (diff) | |
| download | bcm5719-llvm-db01c3adc6f921a27e2bd39847140c401860aa56.tar.gz bcm5719-llvm-db01c3adc6f921a27e2bd39847140c401860aa56.zip | |
[Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals
This diff includes the logic for setting the precision bits for each primary fixed point type in the target info and logic for initializing a fixed point literal.
Fixed point literals are declared using the suffixes
```
hr: short _Fract
uhr: unsigned short _Fract
r: _Fract
ur: unsigned _Fract
lr: long _Fract
ulr: unsigned long _Fract
hk: short _Accum
uhk: unsigned short _Accum
k: _Accum
uk: unsigned _Accum
```
Errors are also thrown for illegal literal values
```
unsigned short _Accum u_short_accum = 256.0uhk; // expected-error{{the integral part of this literal is too large for this unsigned _Accum type}}
```
Differential Revision: https://reviews.llvm.org/D46915
llvm-svn: 335148
Diffstat (limited to 'clang/tools/libclang/CXCursor.cpp')
| -rw-r--r-- | clang/tools/libclang/CXCursor.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp index bce9351b948..b4ad0595cc5 100644 --- a/clang/tools/libclang/CXCursor.cpp +++ b/clang/tools/libclang/CXCursor.cpp @@ -305,6 +305,10 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent, K = CXCursor_IntegerLiteral; break; + case Stmt::FixedPointLiteralClass: + K = CXCursor_FixedPointLiteral; + break; + case Stmt::FloatingLiteralClass: K = CXCursor_FloatingLiteral; break; |

