[PATCH] D130268: [WIP] Add SmallVector constructor to allow creation of SmallVector<T> from ArrayRef of items convertible to type T
Dawid Jurczak via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 21 07:29:46 PDT 2022
yurai007 added inline comments.
================
Comment at: clang/lib/CodeGen/CGExprConstant.cpp:504
llvm::StructType *STy = llvm::ConstantStruct::getTypeForElements(
- CGM.getLLVMContext(), Packed ? PackedElems : UnpackedElems, Packed);
+ CGM.getLLVMContext(), Packed ? PackedElems : to_vector(UnpackedElems),
+ Packed);
----------------
nikic wrote:
> yurai007 wrote:
> > That's because of "error: conditional expression is ambiguous; 'llvm::SmallVector<llvm::Constant *, 32>' can be converted to 'ArrayRef<llvm::Constant *>' and vice versa". Need to check if there is easier workaround.
> Would making the ctor explicit help?
Nope :( Making constructor explicit disables implicit conversion so we cannot do things like: SmallVector<int, 16> NewMask = Mask; anymore.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130268/new/
https://reviews.llvm.org/D130268
More information about the cfe-commits
mailing list