]> granicus.if.org Git - clang/commitdiff
[analyzer] NFC: Remove unused parameteer of StoreManager::CastRetrievedVal().
authorArtem Dergachev <artem.dergachev@gmail.com>
Fri, 4 May 2018 00:53:41 +0000 (00:53 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Fri, 4 May 2018 00:53:41 +0000 (00:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331496 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
lib/StaticAnalyzer/Core/RegionStore.cpp
lib/StaticAnalyzer/Core/Store.cpp

index 84afb08708c3e4f4a35ba3e4426bb76e4a7d4eb1..18ae3c9135b6d211aac8c3b44894eade0c1d3249 100644 (file)
@@ -282,8 +282,8 @@ protected:
   /// CastRetrievedVal - Used by subclasses of StoreManager to implement
   ///  implicit casts that arise from loads from regions that are reinterpreted
   ///  as another region.
-  SVal CastRetrievedVal(SVal val, const TypedValueRegion *region, 
-                        QualType castTy, bool performTestOnly = true);
+  SVal CastRetrievedVal(SVal val, const TypedValueRegion *region,
+                        QualType castTy);
 
 private:
   SVal getLValueFieldOrIvar(const Decl *decl, SVal base);
index 94e84ba055becf5514aee02d92c29f7a4913e329..c4bc9810919c7936dc149b01fa3cbdeb924b423c 100644 (file)
@@ -1446,7 +1446,7 @@ SVal RegionStoreManager::getBinding(RegionBindingsConstRef B, Loc L, QualType T)
     return UnknownVal();
 
   if (const FieldRegion* FR = dyn_cast<FieldRegion>(R))
-    return CastRetrievedVal(getBindingForField(B, FR), FR, T, false);
+    return CastRetrievedVal(getBindingForField(B, FR), FR, T);
 
   if (const ElementRegion* ER = dyn_cast<ElementRegion>(R)) {
     // FIXME: Here we actually perform an implicit conversion from the loaded
@@ -1454,7 +1454,7 @@ SVal RegionStoreManager::getBinding(RegionBindingsConstRef B, Loc L, QualType T)
     // more intelligently.  For example, an 'element' can encompass multiple
     // bound regions (e.g., several bound bytes), or could be a subset of
     // a larger value.
-    return CastRetrievedVal(getBindingForElement(B, ER), ER, T, false);
+    return CastRetrievedVal(getBindingForElement(B, ER), ER, T);
   }
 
   if (const ObjCIvarRegion *IVR = dyn_cast<ObjCIvarRegion>(R)) {
@@ -1464,7 +1464,7 @@ SVal RegionStoreManager::getBinding(RegionBindingsConstRef B, Loc L, QualType T)
     // reinterpretted, it is possible we stored a different value that could
     // fit within the ivar.  Either we need to cast these when storing them
     // or reinterpret them lazily (as we do here).
-    return CastRetrievedVal(getBindingForObjCIvar(B, IVR), IVR, T, false);
+    return CastRetrievedVal(getBindingForObjCIvar(B, IVR), IVR, T);
   }
 
   if (const VarRegion *VR = dyn_cast<VarRegion>(R)) {
@@ -1474,7 +1474,7 @@ SVal RegionStoreManager::getBinding(RegionBindingsConstRef B, Loc L, QualType T)
     // variable is reinterpretted, it is possible we stored a different value
     // that could fit within the variable.  Either we need to cast these when
     // storing them or reinterpret them lazily (as we do here).
-    return CastRetrievedVal(getBindingForVar(B, VR), VR, T, false);
+    return CastRetrievedVal(getBindingForVar(B, VR), VR, T);
   }
 
   const SVal *V = B.lookup(R, BindingKey::Direct);
index b8fd67b66624ca7043d5b707063970312bb0e92b..e78ac0fe007df1f5bef4271f8372674110ee7b5a 100644 (file)
@@ -378,22 +378,10 @@ SVal StoreManager::attemptDownCast(SVal Base, QualType TargetType,
 ///  implicit casts that arise from loads from regions that are reinterpreted
 ///  as another region.
 SVal StoreManager::CastRetrievedVal(SVal V, const TypedValueRegion *R,
-                                    QualType castTy, bool performTestOnly) {
+                                    QualType castTy) {
   if (castTy.isNull() || V.isUnknownOrUndef())
     return V;
 
-  ASTContext &Ctx = svalBuilder.getContext();
-
-  if (performTestOnly) {
-    // Automatically translate references to pointers.
-    QualType T = R->getValueType();
-    if (const ReferenceType *RT = T->getAs<ReferenceType>())
-      T = Ctx.getPointerType(RT->getPointeeType());
-
-    assert(svalBuilder.getContext().hasSameUnqualifiedType(castTy, T));
-    return V;
-  }
-
   return svalBuilder.dispatchCast(V, castTy);
 }