[PATCH] D110808: [APInt] Stop using soft-deprecated constructors and methods in clang. NFC.

2021-10-04 Thread Jay Foad via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd933adeaca7b: [APInt] Stop using soft-deprecated 
constructors and methods in clang. NFC. (authored by foad).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110808

Files:
  clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/StaticAnalyzer/Core/MemRegion.cpp
  clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp

Index: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
===
--- clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -128,14 +128,14 @@
 // a&0 and a&(~0)
 if (RHS == 0)
   return makeIntVal(0, resultTy);
-else if (RHS.isAllOnesValue())
+else if (RHS.isAllOnes())
   isIdempotent = true;
 break;
   case BO_Or:
 // a|0 and a|(~0)
 if (RHS == 0)
   isIdempotent = true;
-else if (RHS.isAllOnesValue()) {
+else if (RHS.isAllOnes()) {
   const llvm::APSInt  = BasicVals.Convert(resultTy, RHS);
   return nonloc::ConcreteInt(Result);
 }
@@ -509,7 +509,7 @@
 continue;
   case BO_Shr:
 // (~0)>>a
-if (LHSValue.isAllOnesValue() && LHSValue.isSigned())
+if (LHSValue.isAllOnes() && LHSValue.isSigned())
   return evalCast(lhs, resultTy, QualType{});
 LLVM_FALLTHROUGH;
   case BO_Shl:
Index: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
===
--- clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
@@ -1568,7 +1568,7 @@
 assert(!Constraint.isEmpty() && "Empty ranges shouldn't get here");
 
 if (Constraint.getConcreteValue())
-  return !Constraint.getConcreteValue()->isNullValue();
+  return !Constraint.getConcreteValue()->isZero();
 
 APSIntType T{Constraint.getMinValue()};
 Const Zero = T.getZeroValue();
Index: clang/lib/StaticAnalyzer/Core/MemRegion.cpp
===
--- clang/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ clang/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -794,7 +794,7 @@
 
 const AnalyzerOptions  = SVB.getAnalyzerOptions();
 if (Opts.ShouldConsiderSingleElementArraysAsFlexibleArrayMembers &&
-Size.isOneValue())
+Size.isOne())
   return true;
   }
   return false;
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -18895,7 +18895,7 @@
   Expr::EvalResult ResultL;
   if (!OASE->getLength()->isValueDependent() &&
   OASE->getLength()->EvaluateAsInt(ResultR, SemaRef.getASTContext()) &&
-  !ResultR.Val.getInt().isOneValue()) {
+  !ResultR.Val.getInt().isOne()) {
 SemaRef.Diag(OASE->getLength()->getExprLoc(),
  diag::err_omp_invalid_map_this_expr);
 SemaRef.Diag(OASE->getLength()->getExprLoc(),
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -3813,7 +3813,7 @@
 
 llvm::APInt Val(bit_width, 0, isSigned);
 bool Overflowed = Literal.GetFixedPointValue(Val, scale);
-bool ValIsZero = Val.isNullValue() && !Overflowed;
+bool ValIsZero = Val.isZero() && !Overflowed;
 
 auto MaxVal = Context.getFixedPointMax(Ty).getValue();
 if (Literal.isFract && Val == MaxVal + 1 && !ValIsZero)
@@ -5254,7 +5254,7 @@
   // OpenMP 5.0, 2.1.6 Iterators, Restrictions
   // If the step expression of a range-specification equals zero, the
   // behavior is unspecified.
-  if (Result && Result->isNullValue()) {
+  if (Result && Result->isZero()) {
 Diag(Step->getExprLoc(), diag::err_omp_iterator_step_constant_zero)
 << Step << Step->getSourceRange();
 IsCorrect = false;
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -1729,7 +1729,7 @@
 // value so we bail out.
 if (SizeOp->isValueDependent())
   break;
-if (!SizeOp->EvaluateKnownConstInt(Context).isNullValue()) {
+if (!SizeOp->EvaluateKnownConstInt(Context).isZero()) {
   CheckNonNullArgument(*this, 

[PATCH] D110808: [APInt] Stop using soft-deprecated constructors and methods in clang. NFC.

2021-10-03 Thread Chris Lattner via Phabricator via cfe-commits
lattner accepted this revision.
lattner added a comment.
This revision is now accepted and ready to land.

Thank you Jay!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110808: [APInt] Stop using soft-deprecated constructors and methods in clang. NFC.

2021-09-30 Thread Jay Foad via Phabricator via cfe-commits
foad created this revision.
Herald added a subscriber: martong.
foad requested review of this revision.
Herald added projects: clang, clang-tools-extra.
Herald added a subscriber: cfe-commits.

Stop using APInt constructors and methods that were soft-deprecated in
D109483 . This fixes all the uses I found in 
clang.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110808

Files:
  clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/StaticAnalyzer/Core/MemRegion.cpp
  clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp

Index: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
===
--- clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -128,14 +128,14 @@
 // a&0 and a&(~0)
 if (RHS == 0)
   return makeIntVal(0, resultTy);
-else if (RHS.isAllOnesValue())
+else if (RHS.isAllOnes())
   isIdempotent = true;
 break;
   case BO_Or:
 // a|0 and a|(~0)
 if (RHS == 0)
   isIdempotent = true;
-else if (RHS.isAllOnesValue()) {
+else if (RHS.isAllOnes()) {
   const llvm::APSInt  = BasicVals.Convert(resultTy, RHS);
   return nonloc::ConcreteInt(Result);
 }
@@ -509,7 +509,7 @@
 continue;
   case BO_Shr:
 // (~0)>>a
-if (LHSValue.isAllOnesValue() && LHSValue.isSigned())
+if (LHSValue.isAllOnes() && LHSValue.isSigned())
   return evalCast(lhs, resultTy, QualType{});
 LLVM_FALLTHROUGH;
   case BO_Shl:
Index: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
===
--- clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
@@ -1568,7 +1568,7 @@
 assert(!Constraint.isEmpty() && "Empty ranges shouldn't get here");
 
 if (Constraint.getConcreteValue())
-  return !Constraint.getConcreteValue()->isNullValue();
+  return !Constraint.getConcreteValue()->isZero();
 
 APSIntType T{Constraint.getMinValue()};
 Const Zero = T.getZeroValue();
Index: clang/lib/StaticAnalyzer/Core/MemRegion.cpp
===
--- clang/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ clang/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -794,7 +794,7 @@
 
 const AnalyzerOptions  = SVB.getAnalyzerOptions();
 if (Opts.ShouldConsiderSingleElementArraysAsFlexibleArrayMembers &&
-Size.isOneValue())
+Size.isOne())
   return true;
   }
   return false;
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -18895,7 +18895,7 @@
   Expr::EvalResult ResultL;
   if (!OASE->getLength()->isValueDependent() &&
   OASE->getLength()->EvaluateAsInt(ResultR, SemaRef.getASTContext()) &&
-  !ResultR.Val.getInt().isOneValue()) {
+  !ResultR.Val.getInt().isOne()) {
 SemaRef.Diag(OASE->getLength()->getExprLoc(),
  diag::err_omp_invalid_map_this_expr);
 SemaRef.Diag(OASE->getLength()->getExprLoc(),
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -3813,7 +3813,7 @@
 
 llvm::APInt Val(bit_width, 0, isSigned);
 bool Overflowed = Literal.GetFixedPointValue(Val, scale);
-bool ValIsZero = Val.isNullValue() && !Overflowed;
+bool ValIsZero = Val.isZero() && !Overflowed;
 
 auto MaxVal = Context.getFixedPointMax(Ty).getValue();
 if (Literal.isFract && Val == MaxVal + 1 && !ValIsZero)
@@ -5254,7 +5254,7 @@
   // OpenMP 5.0, 2.1.6 Iterators, Restrictions
   // If the step expression of a range-specification equals zero, the
   // behavior is unspecified.
-  if (Result && Result->isNullValue()) {
+  if (Result && Result->isZero()) {
 Diag(Step->getExprLoc(), diag::err_omp_iterator_step_constant_zero)
 << Step << Step->getSourceRange();
 IsCorrect = false;
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -1729,7 +1729,7 @@
 // value so we bail out.
 if (SizeOp->isValueDependent())
   break;
-if (!SizeOp->EvaluateKnownConstInt(Context).isNullValue()) {
+if (!SizeOp->EvaluateKnownConstInt(Context).isZero()) {