Fix some warnings introduced in r353324 (ReproducerInstrumentation patch)

GetIndexForObjectImpl generated a bunch of "conversion casts away
constness warnings". Change the function to use "const void *" (and
static_cast, while I'm at it), to avoid this.

Driver.cpp: unused variable "replay" (this was actually caused by a
subsequent partial revert of this patch). I just finish the revert by
removing the variable completely.

llvm-svn: 353405
This commit is contained in:
Pavel Labath 2019-02-07 13:51:38 +00:00
parent 3f35ab8b30
commit 76016ba1ca
3 changed files with 4 additions and 8 deletions

View File

@ -431,13 +431,13 @@ struct invoke<void (Class::*)(Args...)> {
class ObjectToIndex {
public:
template <typename T> unsigned GetIndexForObject(T *t) {
return GetIndexForObjectImpl((void *)t);
return GetIndexForObjectImpl(static_cast<const void *>(t));
}
private:
unsigned GetIndexForObjectImpl(void *object);
unsigned GetIndexForObjectImpl(const void *object);
llvm::DenseMap<void *, unsigned> m_mapping;
llvm::DenseMap<const void *, unsigned> m_mapping;
};
/// Serializes functions, their arguments and their return type to a stream.

View File

@ -68,7 +68,7 @@ unsigned Registry::GetID(uintptr_t addr) {
return id;
}
unsigned ObjectToIndex::GetIndexForObjectImpl(void *object) {
unsigned ObjectToIndex::GetIndexForObjectImpl(const void *object) {
unsigned index = m_mapping.size() + 1;
auto it = m_mapping.find(object);
if (it == m_mapping.end())

View File

@ -888,9 +888,6 @@ main(int argc, char const *argv[])
<< '\n';
}
// Remember if we're in replay mode for later.
bool replay = false;
SBInitializerOptions options;
if (auto *arg = input_args.getLastArg(OPT_capture)) {
auto arg_value = arg->getValue();
@ -902,7 +899,6 @@ main(int argc, char const *argv[])
auto arg_value = arg->getValue();
options.SetReplayReproducer(true);
options.SetReproducerPath(arg_value);
replay = true;
}
SBError error = SBDebugger::Initialize(options);