forked from OSchip/llvm-project
[analyzer] Rename the function to better reflect what it actually does.
llvm-svn: 161617
This commit is contained in:
parent
8d1f1f3b06
commit
a0105b2320
|
@ -334,14 +334,14 @@ public:
|
|||
/// \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));
|
||||
}
|
||||
|
||||
//==---------------------------------------------------------------------==//
|
||||
|
|
|
@ -68,7 +68,7 @@ void DynamicTypePropagation::checkPostCall(const CallEvent &Call,
|
|||
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 @@ void DynamicTypePropagation::checkPostCall(const CallEvent &Call,
|
|||
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 @@ void DynamicTypePropagation::checkPostStmt(const ImplicitCastExpr *CastE,
|
|||
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;
|
||||
|
|
|
@ -762,12 +762,10 @@ DynamicTypeInfo ProgramState::getDynamicTypeInfo(const MemRegion *Reg) const {
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue