[PATCH] D151172: [CodeGen] Fix the type of the constant that is used to zero-initialize a flexible array member
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 22 17:40:46 PDT 2023
efriedma added inline comments.
================
Comment at: clang/lib/CodeGen/CGExprConstant.cpp:964
+ if (NonzeroLength == 0 &&
+ (DesiredType->getNumElements() != 0 || Elements.empty()))
return llvm::ConstantAggregateZero::get(DesiredType);
----------------
Not sure I like this fix. If we're going to pass in the DesiredType to indicate the correct result type, the caller should make sure it uses the correct type; we shouldn't need to correct it after the fact.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151172/new/
https://reviews.llvm.org/D151172
More information about the cfe-commits
mailing list