Replace the comment with an assert to enforce the correct index is used.
Differential revision: https://reviews.llvm.org/D153921
#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDECLCONTEXT_H
#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDECLCONTEXT_H
-#include <string>
-#include <vector>
#include "lldb/Utility/ConstString.h"
#include "DWARFDefines.h"
+#include <cassert>
+#include <string>
+#include <vector>
+
// DWARFDeclContext
//
// A class that represents a declaration context all the way down to a
uint32_t GetSize() const { return m_entries.size(); }
Entry &operator[](uint32_t idx) {
- // "idx" must be valid
+ assert(idx < m_entries.size() && "invalid index");
return m_entries[idx];
}
const Entry &operator[](uint32_t idx) const {
- // "idx" must be valid
+ assert(idx < m_entries.size() && "invalid index");
return m_entries[idx];
}