[analyzer] Rename the function to better reflect what it actually does.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161617 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
index 84a8398..3785e90 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
@@ -334,14 +334,14 @@
/// \brief Get dynamic type information for a region.
DynamicTypeInfo getDynamicTypeInfo(const MemRegion *Reg) const;
- /// \brief Add dynamic type information to the region; return the new state.
- ProgramStateRef addDynamicTypeInfo(const MemRegion *Reg,
+ /// \brief Set dynamic type information of the region; return the new state.
+ ProgramStateRef setDynamicTypeInfo(const MemRegion *Reg,
DynamicTypeInfo NewTy) const;
- /// \brief Add dynamic type information to the region; return the new state.
- ProgramStateRef addDynamicTypeInfo(const MemRegion *Reg,
+ /// \brief Set dynamic type information of the region; return the new state.
+ ProgramStateRef setDynamicTypeInfo(const MemRegion *Reg,
QualType NewTy) const {
- return addDynamicTypeInfo(Reg, DynamicTypeInfo(NewTy));
+ return setDynamicTypeInfo(Reg, DynamicTypeInfo(NewTy));
}
//==---------------------------------------------------------------------==//
diff --git a/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp b/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
index d9edab8..d8bb5ea 100644
--- a/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
+++ b/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
@@ -68,7 +68,7 @@
return;
QualType DynResTy =
C.getASTContext().getObjCObjectPointerType(QualType(ObjTy, 0));
- C.addTransition(State->addDynamicTypeInfo(RetReg, DynResTy));
+ C.addTransition(State->setDynamicTypeInfo(RetReg, DynResTy));
break;
}
case OMF_init: {
@@ -78,7 +78,7 @@
if (!RecReg)
return;
DynamicTypeInfo RecDynType = State->getDynamicTypeInfo(RecReg);
- C.addTransition(State->addDynamicTypeInfo(RetReg, RecDynType));
+ C.addTransition(State->setDynamicTypeInfo(RetReg, RecDynType));
break;
}
}
@@ -98,7 +98,7 @@
case CK_BitCast:
// Only handle ObjCObjects for now.
if (const Type *NewTy = getBetterObjCType(CastE, C))
- C.addTransition(C.getState()->addDynamicTypeInfo(ToR, QualType(NewTy,0)));
+ C.addTransition(C.getState()->setDynamicTypeInfo(ToR, QualType(NewTy,0)));
break;
}
return;
diff --git a/lib/StaticAnalyzer/Core/ProgramState.cpp b/lib/StaticAnalyzer/Core/ProgramState.cpp
index c20979b..0e5ff78 100644
--- a/lib/StaticAnalyzer/Core/ProgramState.cpp
+++ b/lib/StaticAnalyzer/Core/ProgramState.cpp
@@ -762,12 +762,10 @@
return DynamicTypeInfo();
}
-ProgramStateRef ProgramState::addDynamicTypeInfo(const MemRegion *Reg,
+ProgramStateRef ProgramState::setDynamicTypeInfo(const MemRegion *Reg,
DynamicTypeInfo NewTy) const {
if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(Reg)) {
SymbolRef Sym = SR->getSymbol();
- // TODO: Instead of resetting the type info, check the old type info and
- // merge and pick the most precise type.
ProgramStateRef NewState = set<DynamicTypeMap>(Sym, NewTy);
assert(NewState);
return NewState;