aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2020-10-15 17:50:48 -0700
committerRichard Smith <richard@metafoo.co.uk>2020-10-20 16:52:28 -0700
commit6781fee085058913444e0c5937da9c0e7e928db5 (patch)
tree25ca93c5f1bfe99b572400f0b9a7127a3c0509d2 /clang/lib/Basic/SourceManager.cpp
parentf88785460ecf40a9176f58637d38fb785eb91ac4 (diff)
downloadllvm-6781fee085058913444e0c5937da9c0e7e928db5.zip
llvm-6781fee085058913444e0c5937da9c0e7e928db5.tar.gz
llvm-6781fee085058913444e0c5937da9c0e7e928db5.tar.bz2
Don't permit array bound constant folding in OpenCL.
Permitting non-standards-driven "do the best you can" constant-folding of array bounds is permitted solely as a GNU compatibility feature. We should not be doing it in any language mode that is attempting to be conforming. From https://reviews.llvm.org/D20090 it appears the intent here was to permit `__constant int` globals to be used in array bounds, but the change in that patch only added half of the functionality necessary to support that in the constant evaluator. This patch adds the other half of the functionality and turns off constant folding for array bounds in OpenCL. I couldn't find any spec justification for accepting the kinds of cases that D20090 accepts, so a reference to where in the OpenCL specification this is permitted would be useful. Note that this change also affects the code generation in one test: because after 'const int n = 0' we now treat 'n' as a constant expression with value 0, it's now a null pointer, so '(local int *)n' forms a null pointer rather than a zero pointer. Reviewed By: Anastasia Differential Revision: https://reviews.llvm.org/D89520
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
0 files changed, 0 insertions, 0 deletions