================
@@ -11679,6 +11500,15 @@ static std::optional<IntRange>
TryGetExprRange(ASTContext &C, const Expr *E,
Approximate);
}
+ QualType T = E->getType();
+ if (const auto *VT = T->getAs<VectorType>()) {
+ QualType ElemTy = VT->getElementType();
+ if (ElemTy->isUnsignedIntegerType()) {
+ return TryGetExprRange(C, UO->getSubExpr(), MaxWidth,
+ InConstantContext, Approximate);
+ }
+ }
+
----------------
ojhunt wrote:
There's a lot of duplication here. I think a better approach would be
```cpp
case UO_Minus:
QualType ElemType = E->getType();
if (const VectorType *VT = ElementType->getAs<VectorType>())
ElementType = VT->getElementType();
if (ElementType->isUnsignedIntegerType())
...
```
and again for below.
Long term there should probably be a function that can provide the fundamental
type of a scalar, but for now there isn't.
https://github.com/llvm/llvm-project/pull/182627
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits