[Fixed Point Arithmetic] Fix for bug where integer literals could be treated as fixed...
authorLeonard Chan <leonardchan@google.com>
Tue, 17 Jul 2018 14:58:49 +0000 (14:58 +0000)
committerLeonard Chan <leonardchan@google.com>
Tue, 17 Jul 2018 14:58:49 +0000 (14:58 +0000)
commite5597ad9f3132bf9f4d9baddb513d5c704f28c2c
tree1d2cb457aaf1dd5127e67b0c501e2feeeeda0c3a
parentf10e4798b4d9f5d52da9c004341b7c98727638f8
[Fixed Point Arithmetic] Fix for bug where integer literals could be treated as fixed point literals

This addresses a bug brought up in https://bugs.llvm.org/show_bug.cgi?id=38161 where integer literals could be treated as fixed point types and throw errors related to fixed point types when the 'k' or 'r' suffix used. The fix also addresses the second issue brought up with the assertion by not treating integers as fixed point types in the first place.

Integers that have suffixes 'k' and 'r' now throw the error `invalid suffix 'k/r' on integer constant`.

A few more tests were also added to ensure that fixed point types, and any errors/warnings related to them, are limited to C for now.

Prior discussion also at https://reviews.llvm.org/D46915.

Differential Revision: https://reviews.llvm.org/D49327

llvm-svn: 337289
clang/lib/Lex/LiteralSupport.cpp
clang/test/Frontend/fixed_point_errors.c
clang/test/Frontend/fixed_point_errors.cpp
clang/test/Frontend/fixed_point_not_enabled.c