diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2022-05-17 05:14:14 +0200 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2022-05-17 05:36:17 +0200 |
commit | 2d2315a4884e22b0d7bd04a1eabee06b07faa319 (patch) | |
tree | a2c0821743281d50dc7e9ab0ec35e589a11f03f0 | |
parent | d12d1126ff0c22a727a6ed6d4a5151bc4c863deb (diff) |
Update for LLVM 12
- isIntegerConstantExpr that returns value has been renamed
https://github.com/llvm/llvm-project/commit/36036aa70ec1df7b51b5d30b2dd8090ad2b6e783
../clang-plugin/assertion-extracter.cpp:194:50: error: cannot convert 'llvm::APSInt' to 'const clang::ASTContext&'
194 | expr->isIntegerConstantExpr (bool_expr, context) &&
| ^~~~~~~~~
| |
| llvm::APSInt
-rw-r--r-- | clang-plugin/assertion-extracter.cpp | 20 | ||||
-rw-r--r-- | clang-plugin/gvariant-checker.cpp | 6 | ||||
-rw-r--r-- | meson.build | 2 |
3 files changed, 13 insertions, 15 deletions
diff --git a/clang-plugin/assertion-extracter.cpp b/clang-plugin/assertion-extracter.cpp index 3ebe4e5..231d03f 100644 --- a/clang-plugin/assertion-extracter.cpp +++ b/clang-plugin/assertion-extracter.cpp @@ -187,12 +187,12 @@ AssertionExtracter::is_assertion_stmt (Stmt& stmt, const ASTContext& context) Stmt* body = do_stmt.getBody (); Stmt* cond = do_stmt.getCond (); Expr* expr = dyn_cast<Expr> (cond); - llvm::APSInt bool_expr; + Optional<llvm::APSInt> bool_expr; if (body != NULL && expr != NULL && - expr->isIntegerConstantExpr (bool_expr, context) && - !bool_expr.getBoolValue ()) { + (bool_expr = expr->getIntegerConstantExpr (context)) && + !bool_expr->getBoolValue ()) { return is_assertion_stmt (*body, context); } @@ -605,17 +605,17 @@ _simplify_boolean_expr (Expr* expr, const ASTContext& context) return expr; } - llvm::APSInt bool_expr; + Optional<llvm::APSInt> bool_expr; - if (lhs->isIntegerConstantExpr (bool_expr, context)) { - if (is_or && bool_expr.getBoolValue ()) { + if (bool_expr = lhs->getIntegerConstantExpr (context)) { + if (is_or && bool_expr->getBoolValue ()) { /* 1 || S2 ↦ 1 */ return new (context) IntegerLiteral (context, context.MakeIntValue (1, context.getLogicalOperationType ()), context.getLogicalOperationType (), SourceLocation ()); - } else if (is_and && !bool_expr.getBoolValue ()) { + } else if (is_and && !bool_expr->getBoolValue ()) { /* 0 && S2 ↦ 0 */ return new (context) IntegerLiteral (context, @@ -628,15 +628,15 @@ _simplify_boolean_expr (Expr* expr, const ASTContext& context) * 0 || S2 ↦ simplify(S2) */ return rhs; } - } else if (rhs->isIntegerConstantExpr (bool_expr, context)) { - if (is_or && bool_expr.getBoolValue ()) { + } else if (bool_expr = rhs->getIntegerConstantExpr (context)) { + if (is_or && bool_expr->getBoolValue ()) { /* S1 || 1 ↦ 1 */ return new (context) IntegerLiteral (context, context.MakeIntValue (1, context.getLogicalOperationType ()), context.getLogicalOperationType (), SourceLocation ()); - } else if (is_and && !bool_expr.getBoolValue ()) { + } else if (is_and && !bool_expr->getBoolValue ()) { /* S2 && 0 ↦ 0 */ return new (context) IntegerLiteral (context, diff --git a/clang-plugin/gvariant-checker.cpp b/clang-plugin/gvariant-checker.cpp index 1557235..2518fd5 100644 --- a/clang-plugin/gvariant-checker.cpp +++ b/clang-plugin/gvariant-checker.cpp @@ -341,11 +341,9 @@ _consume_variadic_argument (QualType expected_type, Expr::NPC_ValueDependentIsNull); /* Check for int → uint promotions. */ - llvm::APSInt int_constant_value; - bool is_int_constant = arg->isIntegerConstantExpr (int_constant_value, - context); + Optional<llvm::APSInt> int_constant_value = arg->getIntegerConstantExpr (context); - if (is_int_constant && int_constant_value.isNonNegative () && + if (int_constant_value && int_constant_value->isNonNegative () && expected_type->isUnsignedIntegerType () && actual_type->hasSignedIntegerRepresentation ()) { /* Magically promote the int to a uint. */ diff --git a/meson.build b/meson.build index d67dc1f..3465b27 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,7 @@ cxx = meson.get_compiler('cpp') ### Check for required libraries ############################################### -llvm_requirement = '>= 11.0' +llvm_requirement = '>= 12.0' glib_requirement = '>= 2.38' gir_requirement = '>= 1.38.0' |