[PATCH] D46915: Set Fixed Point Precision Bits and Create Fixed Point Literals
Leonard Chan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 15 16:23:13 PDT 2018
leonardchan created this revision.
leonardchan added reviewers: phosek, mcgrathr, jakehehrlich.
leonardchan added a project: clang.
Herald added a subscriber: mgorny.
This diff includes the logic for setting the precision bits for each primary fixed point type when building clang and logic for initializing a fixed point literal.
The precision bits are set when building cmake via the flags
SACCUM_FBIT
ACCUM_FBIT
LACCUM_FBIT
...
More checks to ensure the bit values used are valid will be added in future patches.
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 literal values that exceed the range of the type corresponding to the suffix
unsigned short _Accum u_short_accum = 256.0uhk; // expected-error{{the integral part of this literal is too large for this unsigned _Accum type}}
This is a parent of https://reviews.llvm.org/D46911
Repository:
rC Clang
https://reviews.llvm.org/D46915
Files:
CMakeLists.txt
cmake/modules/InitFixedPointBits.cmake
include/clang/AST/Expr.h
include/clang/AST/OperationKinds.def
include/clang/AST/RecursiveASTVisitor.h
include/clang/AST/Type.h
include/clang/Basic/DiagnosticCommonKinds.td
include/clang/Basic/FixedPoint.h.in
include/clang/Basic/StmtNodes.td
include/clang/Lex/LiteralSupport.h
lib/AST/ASTContext.cpp
lib/AST/ASTDumper.cpp
lib/AST/Expr.cpp
lib/AST/ExprClassification.cpp
lib/AST/ExprConstant.cpp
lib/AST/ItaniumMangle.cpp
lib/AST/StmtPrinter.cpp
lib/AST/StmtProfile.cpp
lib/AST/Type.cpp
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGExprAgg.cpp
lib/CodeGen/CGExprComplex.cpp
lib/CodeGen/CGExprConstant.cpp
lib/CodeGen/CGExprScalar.cpp
lib/Edit/RewriteObjCFoundationAPI.cpp
lib/Lex/LiteralSupport.cpp
lib/Sema/Sema.cpp
lib/Sema/SemaExceptionSpec.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/TreeTransform.h
lib/Serialization/ASTReaderStmt.cpp
lib/Serialization/ASTWriterStmt.cpp
lib/StaticAnalyzer/Core/ExprEngine.cpp
lib/StaticAnalyzer/Core/ExprEngineC.cpp
test/Frontend/fixed_point.c
test/Frontend/fixed_point_declarations.c
test/Frontend/fixed_point_errors.c
test/Frontend/fixed_point_validation.c
tools/libclang/CXCursor.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46915.146954.patch
Type: text/x-patch
Size: 57417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180515/d1981a6f/attachment-0001.bin>
More information about the cfe-commits
mailing list