Some compatibility changes for more recent versions of boost

- boost::shared_ptr now has "explicit operator bool", which means we
  can't "return <a shared ptr>" from a function with return type bool.

- Our use of shared_ptr<T[]> in debugger_client.h was screwed.
  Unfortunately it's not straightforward to make it a unique_ptr as per
  our discussion; there are other objects that call setLiveLists, and
  it's not clear to me that this is a total transfer of ownership. I'm
  just fixing the immediate problem using shared_array. (Also made the
  typedef less confusing, hopefully.)

- Our specialization of graph_traits<G> for ControlFlowGraph didn't
  define the null_vertex member function. This didn't matter in older
  versions of boost because they didn't use it internally, but now they
  do (the call to depth_first_search in control_flow.cpp was failing to
  compile).
Esse commit está contido em:
Owen Yamauchi
2013-05-29 14:47:39 -07:00
commit de Sara Golemon
commit fee428f6fb
12 arquivos alterados com 24 adições e 20 exclusões
+1 -1
Ver Arquivo
@@ -1681,7 +1681,7 @@ ExpressionPtr AliasManager::canonicalizeNode(
while (v->getCanonPtr() && v->getCanonPtr() != op0) {
v = v->getCanonPtr();
}
ok = v->getCanonPtr();
ok = (v->getCanonPtr() != nullptr);
}
if (ok) {
b2->setContext(Expression::DeadStore);
+2
Ver Arquivo
@@ -65,6 +65,8 @@ struct graph_traits<HPHP::ControlFlowGraph> {
typedef int vertices_size_type;
typedef int edges_size_type;
typedef std::list<HPHP::ControlEdge*>::size_type degree_size_type;
static vertex_descriptor null_vertex() { return nullptr; }
};
template<>
+2 -2
Ver Arquivo
@@ -14,8 +14,8 @@
+----------------------------------------------------------------------+
*/
#include "hphp/compiler/analysis/alias_manager.h"
#include "hphp/compiler/analysis/expr_dict.h"
#include "hphp/compiler/analysis/alias_manager.h"
#include "hphp/compiler/expression/expression.h"
#include "hphp/compiler/expression/assignment_expression.h"
@@ -59,7 +59,7 @@ void ExprDict::getTypes(ExpressionPtr e, TypePtrIdxPairVec &types) {
class TypeFunc { public:
bool operator()(const TypePtrIdxPair& entry) const {
return entry.first;
return entry.first != nullptr;
}
};
static TypeFunc s_type_func;
+1 -1
Ver Arquivo
@@ -464,7 +464,7 @@ bool FunctionScope::hasImpl() const {
}
if (m_stmt) {
MethodStatementPtr stmt = dynamic_pointer_cast<MethodStatement>(m_stmt);
return stmt->getStmts();
return stmt->getStmts() != nullptr;
}
return false;
}
+2 -2
Ver Arquivo
@@ -227,7 +227,7 @@ ConstructPtr VariableTable::getStaticInitVal(string varName) {
bool VariableTable::setStaticInitVal(string varName,
ConstructPtr value) {
Symbol *sym = addSymbol(varName);
bool exists = sym->getStaticInitVal();
bool exists = (sym->getStaticInitVal() != nullptr);
sym->setStaticInitVal(value);
return exists;
}
@@ -241,7 +241,7 @@ ConstructPtr VariableTable::getClassInitVal(string varName) {
bool VariableTable::setClassInitVal(string varName, ConstructPtr value) {
Symbol *sym = addSymbol(varName);
bool exists = sym->getClassInitVal();
bool exists = (sym->getClassInitVal() != nullptr);
sym->setClassInitVal(value);
return exists;
}
+1 -1
Ver Arquivo
@@ -210,7 +210,7 @@ bool ExpressionList::getScalarValue(Variant &value) {
Variant v;
bool ret1 = name->getScalarValue(n);
bool ret2 = val->getScalarValue(v);
if (!(ret1 && ret2)) return ExpressionPtr();
if (!(ret1 && ret2)) return false;
init.set(n, v);
}
}
+1 -1
Ver Arquivo
@@ -39,7 +39,7 @@ public:
DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS;
bool isRef() const { return m_ref;}
bool isOptional() const { return m_defaultValue;}
bool isOptional() const { return m_defaultValue != nullptr;}
const std::string &getName() const { return m_name; }
int getLocalEffects() const { return NoEffect; }
void rename(const std::string &name) { m_name = name;}
+1 -1
Ver Arquivo
@@ -29,7 +29,7 @@ public:
ReturnStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp);
DECLARE_STATEMENT_VIRTUAL_FUNCTIONS;
virtual bool hasRetExp() const { return m_exp; }
virtual bool hasRetExp() const { return m_exp != nullptr; }
ExpressionPtr getRetExp() const { return m_exp; }
// During analysis we tag ReturnStatement with a list of the locals
+1 -1
Ver Arquivo
@@ -71,7 +71,7 @@ void TypeAnnotation::functionTypeName(std::string &name) const {
// return value of function types is the first element of type list
TypeAnnotationPtr retType = m_typeArgs;
TypeAnnotationPtr typeEl = m_typeArgs->m_typeList;
bool hasArgs = typeEl;
bool hasArgs = (typeEl != nullptr);
while (typeEl) {
name += typeEl->fullName();
typeEl = typeEl->m_typeList;
+4 -4
Ver Arquivo
@@ -60,7 +60,7 @@ void CmdInfo::sendImpl(DebuggerThriftBuffer &thrift) {
thrift.write(true);
thrift.write((int8_t)DebuggerClient::AutoCompleteCount);
for (int i = 0; i < DebuggerClient::AutoCompleteCount; i++) {
thrift.write((*m_acLiveLists)[i]);
thrift.write(m_acLiveLists[i]);
}
} else {
thrift.write(false);
@@ -80,7 +80,7 @@ void CmdInfo::recvImpl(DebuggerThriftBuffer &thrift) {
thrift.read(count);
for (int i = 0; i < count; i++) {
if (i < DebuggerClient::AutoCompleteCount) {
thrift.read((*m_acLiveLists)[i]);
thrift.read(m_acLiveLists[i]);
} else {
vector<std::string> future;
thrift.read(future);
@@ -240,7 +240,7 @@ bool CmdInfo::onServer(DebuggerProxy &proxy) {
for (unsigned int i = 0 ; i < sizeof(tempList)/sizeof(int); ++i) {
for (unsigned int j = 0 ; j < tmpAcLiveLists[tempList[i]].size(); ++j) {
(*m_acLiveLists)[tempList[i]].push_back(
m_acLiveLists[tempList[i]].push_back(
tmpAcLiveLists[tempList[i]][j]->toCPPString());
}
}
@@ -248,7 +248,7 @@ bool CmdInfo::onServer(DebuggerProxy &proxy) {
Array variables = g_vmContext->getLocalDefinedVariables(0);
variables += CmdVariable::GetGlobalVariables();
vector<std::string> &vars =
(*m_acLiveLists)[DebuggerClient::AutoCompleteVariables];
m_acLiveLists[DebuggerClient::AutoCompleteVariables];
vars.reserve(variables.size());
for (ArrayIter iter(variables); iter; ++iter) {
vars.push_back("$" + iter.first().toString()->toCPPString());
+2 -2
Ver Arquivo
@@ -826,7 +826,7 @@ std::vector<std::string> DebuggerClient::getAllCompletions(
}
for (int i = 0; i < AutoCompleteCount; ++i) {
const std::vector<std::string> &items = (*m_acLiveLists)[i];
const std::vector<std::string> &items = m_acLiveLists[i];
for (size_t j = 0; j < items.size(); ++j) {
const char *p = items[j].c_str();
if (strncasecmp(p, text.c_str(), text.length()) == 0) {
@@ -917,7 +917,7 @@ char *DebuggerClient::getCompletion(const char *text, int state) {
updateLiveLists();
assert(!m_acLiveListsDirty);
}
char *p = getCompletion((*m_acLiveLists)[(int64_t)list], text);
char *p = getCompletion(m_acLiveLists[(int64_t)list], text);
if (p) return p;
} else {
for (const char *p = list[++m_acPos]; p; p = list[++m_acPos]) {
+6 -4
Ver Arquivo
@@ -17,6 +17,8 @@
#ifndef incl_HPHP_EVAL_DEBUGGER_CLIENT_H_
#define incl_HPHP_EVAL_DEBUGGER_CLIENT_H_
#include <boost/smart_ptr/shared_array.hpp>
#include "hphp/runtime/eval/debugger/debugger.h"
#include "hphp/runtime/eval/debugger/debugger_client_settings.h"
#include "hphp/runtime/eval/debugger/inst_point.h"
@@ -92,10 +94,10 @@ public:
};
static const char **GetCommands();
typedef std::vector<std::string> LiveLists[DebuggerClient::AutoCompleteCount];
typedef boost::shared_ptr<LiveLists> LiveListsPtr;
typedef std::vector<std::string> LiveList;
typedef boost::shared_array<LiveList> LiveListsPtr;
static LiveListsPtr CreateNewLiveLists() {
return LiveListsPtr(new LiveLists[DebuggerClient::AutoCompleteCount]());
return LiveListsPtr(new LiveList[DebuggerClient::AutoCompleteCount]);
}
std::vector<std::string> getAllCompletions(std::string const &text);
@@ -276,7 +278,7 @@ public:
void addCompletion(const char **list);
void addCompletion(const char *name);
void addCompletion(const std::vector<std::string> &items);
void setLiveLists(LiveListsPtr liveLists) { m_acLiveLists = liveLists;}
void setLiveLists(LiveListsPtr liveLists) { m_acLiveLists = liveLists; }
/**
* For DebuggerClient API