[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)

Justin Stitt via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 10 15:35:07 PDT 2024


================
@@ -2237,6 +2237,21 @@ bool BinaryOperator::isNullPointerArithmeticExtension(ASTContext &Ctx,
   return true;
 }
 
+bool BinaryOperator::oneOfWraps(const ASTContext &Ctx) const {
+  llvm::SmallVector<Expr *, 2> Both = {getLHS(), getRHS()};
----------------
JustinStitt wrote:

I had trouble with your code snippet because `children()` gives `Stmt` iterators and I would have to add in a cast or two. I went with a simpler approach in a2f63982920f22d795c4971800bcc5cb55356570 (with QualType::hasWrapsAttr())

https://github.com/llvm/llvm-project/pull/86618


More information about the cfe-commits mailing list