diff options
author | PiJoules <6019989+PiJoules@users.noreply.github.com> | 2023-11-13 12:31:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 12:31:49 -0800 |
commit | 2c65860667e202e182264d5c6dfe4c2961542f7d (patch) | |
tree | ab7ff939e0984077f59cb350057065e6c5dee472 /clang/lib/Basic/IdentifierTable.cpp | |
parent | 915e092400f92a617a4ca7cb9f03a642bb30c7cc (diff) | |
download | llvm-2c65860667e202e182264d5c6dfe4c2961542f7d.zip llvm-2c65860667e202e182264d5c6dfe4c2961542f7d.tar.gz llvm-2c65860667e202e182264d5c6dfe4c2961542f7d.tar.bz2 |
[clang] Remove fixed point arithmetic error (#71884)
Prior to this, clang would always report
```
compile with '-ffixed-point' to enable fixed point types
```
whenever it sees `_Accum`, `_Fract`, or `_Sat` when fixed point
arithmetic is not enabled. This can break existing code that uses these
as variable names and doesn't use fixed point arithmetic like in some
microsoft headers
(https://github.com/llvm/llvm-project/pull/67750#issuecomment-1775264907).
Fixed point should not raise this error for these cases, so this removes
the error altogether and defaults to the usual error clang gives where
it can see these keywords as either unknown types or regular variables.
Diffstat (limited to 'clang/lib/Basic/IdentifierTable.cpp')
-rw-r--r-- | clang/lib/Basic/IdentifierTable.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index c4c5a6e..38150d1 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -108,7 +108,8 @@ namespace { KEYSYCL = 0x800000, KEYCUDA = 0x1000000, KEYHLSL = 0x2000000, - KEYMAX = KEYHLSL, // The maximum key + KEYFIXEDPOINT = 0x4000000, + KEYMAX = KEYFIXEDPOINT, // The maximum key KEYALLCXX = KEYCXX | KEYCXX11 | KEYCXX20, KEYALL = (KEYMAX | (KEYMAX-1)) & ~KEYNOMS18 & ~KEYNOOPENCL // KEYNOMS18 and KEYNOOPENCL are used to exclude. @@ -210,6 +211,8 @@ static KeywordStatus getKeywordStatusHelper(const LangOptions &LangOpts, case KEYNOMS18: // The disable behavior for this is handled in getKeywordStatus. return KS_Unknown; + case KEYFIXEDPOINT: + return LangOpts.FixedPoint ? KS_Enabled : KS_Disabled; default: llvm_unreachable("Unknown KeywordStatus flag"); } |