[PATCH] D46911: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents
Leonard Chan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 7 08:02:44 PDT 2018
leonardchan added inline comments.
================
Comment at: include/clang/Sema/DeclSpec.h:670
const PrintingPolicy &Policy);
+ bool SetTypeSpecSat(SourceLocation Loc, const char *&PrevSpec,
+ unsigned &DiagID);
----------------
ebevhan wrote:
> This should take a PrintingPolicy like the others.
I think the PrintingPolicy may not be necessary because it's only used for getting the name of the current TypeSpecType. More specifically, for just differentiating vetween "bool" and "_Bool" for `TST_bool`. It also seems that other setters that don't touch TypeSpecType use PrintingPolicy, like `SetTypeSpecComplex` or `SetTypeSpecSign`
================
Comment at: lib/Sema/SemaType.cpp:1612
+ // Only fixed point types can be saturated
+ if (DS.isTypeSpecSat() && !IsFixedPointType)
+ S.Diag(DS.getTypeSpecSatLoc(), diag::err_invalid_saturation_spec)
----------------
ebevhan wrote:
> Also, this does not seem to invalidate the declarator.
How so? I have tests under `test/Frontend/fixed_point_errors.c` that check for an error thrown if `_Sat` is used with non-fixed point types.
Repository:
rC Clang
https://reviews.llvm.org/D46911
More information about the cfe-commits
mailing list