[analyzer] Add ProgramStatePartialTrait<const void *>.
This should fix cast-away-const warnings reported by David Greene. llvm-svn: 172446
This commit is contained in:
parent
d540aed61b
commit
269894ca23
|
@ -555,7 +555,7 @@ private:
|
|||
struct ReplayWithoutInlining{};
|
||||
template <>
|
||||
struct ProgramStateTrait<ReplayWithoutInlining> :
|
||||
public ProgramStatePartialTrait<void*> {
|
||||
public ProgramStatePartialTrait<const void*> {
|
||||
static void *GDMIndex() { static int index = 0; return &index; }
|
||||
};
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace ento {
|
|||
}
|
||||
|
||||
static inline void *MakeVoidPtr(data_type D) {
|
||||
return const_cast<llvm::ImmutableListImpl<T> >(D.getInternalPointer());
|
||||
return const_cast<llvm::ImmutableListImpl<T> *>(D.getInternalPointer());
|
||||
}
|
||||
|
||||
static inline context_type MakeContext(void *p) {
|
||||
|
@ -223,7 +223,20 @@ namespace ento {
|
|||
}
|
||||
};
|
||||
|
||||
} // end GR namespace
|
||||
// Partial specialization for const void *.
|
||||
template <> struct ProgramStatePartialTrait<const void *> {
|
||||
typedef const void *data_type;
|
||||
|
||||
static inline data_type MakeData(void * const *p) {
|
||||
return p ? *p : data_type();
|
||||
}
|
||||
|
||||
static inline void *MakeVoidPtr(data_type d) {
|
||||
return const_cast<void *>(d);
|
||||
}
|
||||
};
|
||||
|
||||
} // end ento namespace
|
||||
|
||||
} // end clang namespace
|
||||
|
||||
|
|
|
@ -608,11 +608,11 @@ bool ExprEngine::inlineCall(const CallEvent &Call, const Decl *D,
|
|||
|
||||
static ProgramStateRef getInlineFailedState(ProgramStateRef State,
|
||||
const Stmt *CallE) {
|
||||
void *ReplayState = State->get<ReplayWithoutInlining>();
|
||||
const void *ReplayState = State->get<ReplayWithoutInlining>();
|
||||
if (!ReplayState)
|
||||
return 0;
|
||||
|
||||
assert(ReplayState == (const void*)CallE && "Backtracked to the wrong call.");
|
||||
assert(ReplayState == CallE && "Backtracked to the wrong call.");
|
||||
(void)CallE;
|
||||
|
||||
return State->remove<ReplayWithoutInlining>();
|
||||
|
|
Loading…
Reference in New Issue