aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGBuiltin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CGBuiltin.cpp')
-rw-r--r--clang/lib/CodeGen/CGBuiltin.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index bbcee34..0a2ea41 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -1211,14 +1211,10 @@ llvm::Value *CodeGenFunction::emitCountedByPointerSize(
getContext().getTypeSizeInChars(ElementTy->getPointeeType());
if (ElementSize.isZero()) {
- // This might be a __sized_by on a 'void *', which counts bytes, not
- // elements.
- auto *CAT = ElementTy->getAs<CountAttributedType>();
- if (!CAT || (CAT->getKind() != CountAttributedType::SizedBy &&
- CAT->getKind() != CountAttributedType::SizedByOrNull))
- // Okay, not sure what it is now.
- // FIXME: Should this be an assert?
- return std::optional<CharUnits>();
+ // This might be a __sized_by (or __counted_by) on a
+ // 'void *', which counts bytes, not elements.
+ [[maybe_unused]] auto *CAT = ElementTy->getAs<CountAttributedType>();
+ assert(CAT && "must have an CountAttributedType");
ElementSize = CharUnits::One();
}