[clang] [clang][ExprConst] allow single element access of vector object to be constant expression (PR #72607)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu May 9 07:47:04 PDT 2024
================
@@ -437,6 +442,16 @@ namespace {
MostDerivedArraySize = 2;
MostDerivedPathLength = Entries.size();
}
+ void addVectorUnchecked(QualType EltTy, uint64_t Size, uint64_t Idx) {
+ Entries.push_back(PathEntry::ArrayIndex(Idx));
+
+ // This is technically a most-derived object, though in practice this
+ // is unlikely to matter.
+ MostDerivedType = EltTy;
+ MostDerivedIsArrayElement = true;
+ MostDerivedArraySize = Size;
----------------
AaronBallman wrote:
Until we have evidence that `&V[0]` makes sense for vector types, I think we should disallow it. It's easier for us to introduce support once we have a use case than to have to maintain support should someone start relying on this without us intending it as a stable extension.
https://github.com/llvm/llvm-project/pull/72607
More information about the cfe-commits
mailing list