[PATCH] D111769: [Polly] Switch checkIslAstExprInt to use RAII instead of manually freeing Expr

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 18:23:15 PDT 2021


Meinersbur added a comment.

Could you update the second parameter of `checkIslAstExprInt` as well? Yes, it's cheating in that it passes isl functions as callbacks which you will not be able to do anymore, but it also prohibits us to use proper use of RAII.

This time you actually need NFC to the title.



================
Comment at: polly/lib/CodeGen/IslNodeBuilder.cpp:153
                                isl_bool (*Predicate)(__isl_keep isl_val *)) {
-  if (isl_ast_expr_get_type(Expr) != isl_ast_expr_int) {
-    isl_ast_expr_free(Expr);
+  if (isl_ast_expr_get_type(Expr.get()) != isl_ast_expr_int) {
     return false;
----------------
Meinersbur wrote:
> [style] [[ https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements | don't use braces for single statements ]]
Use `Expr.isa<isl::ast_expr_int>()`


================
Comment at: polly/lib/CodeGen/IslNodeBuilder.cpp:153-155
+  if (isl_ast_expr_get_type(Expr.get()) != isl_ast_expr_int) {
     return false;
   }
----------------
[style] [[ https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements | don't use braces for single statements ]]


================
Comment at: polly/lib/CodeGen/IslNodeBuilder.cpp:156
   }
-  auto ExprVal = isl_ast_expr_get_val(Expr);
-  isl_ast_expr_free(Expr);
+  auto ExprVal = isl_ast_expr_get_val(Expr.get());
   if (Predicate(ExprVal) != isl_bool_true) {
----------------
`Expr.val()`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111769/new/

https://reviews.llvm.org/D111769



More information about the llvm-commits mailing list