More fixing lint: various conversion constructors in compiler/
Left one implicit, but it's arguable. Inspected manually.
Esse commit está contido em:
@@ -263,7 +263,7 @@ void AliasManager::beginScope() {
|
||||
ExpressionPtr e(new ScalarExpression(BlockScopePtr(), LocationPtr(),
|
||||
T_STRING, string("begin")));
|
||||
m_accessList.add(e);
|
||||
m_stack.push_back(m_accessList.size());
|
||||
m_stack.push_back(CondStackElem(m_accessList.size()));
|
||||
m_accessList.beginScope();
|
||||
if (BucketMapEntry *tail = m_bucketList) {
|
||||
BucketMapEntry *bm = tail;
|
||||
@@ -2504,7 +2504,7 @@ static void markAvailable(ExpressionRawPtr e) {
|
||||
|
||||
class TypeAssertionInserter {
|
||||
public:
|
||||
TypeAssertionInserter(AnalysisResultConstPtr ar) :
|
||||
explicit TypeAssertionInserter(AnalysisResultConstPtr ar) :
|
||||
m_ar(ar), m_changed(false) {
|
||||
BuildAssertionMap();
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class AliasManager {
|
||||
enum { SameAccess, SameLValueAccess, InterfAccess,
|
||||
DisjointAccess, NotAccess };
|
||||
|
||||
AliasManager(int opt);
|
||||
explicit AliasManager(int opt);
|
||||
~AliasManager();
|
||||
|
||||
void clear();
|
||||
@@ -141,7 +141,7 @@ class AliasManager {
|
||||
enum { FallThrough, CondBranch, Branch, Converge };
|
||||
enum { NoCopyProp = 1, NoDeadStore = 2 };
|
||||
struct CondStackElem {
|
||||
CondStackElem(size_t s = 0) : m_size(s), m_exprs() {}
|
||||
explicit CondStackElem(size_t s = 0) : m_size(s), m_exprs() {}
|
||||
size_t m_size;
|
||||
ExpressionPtrList m_exprs;
|
||||
};
|
||||
@@ -154,7 +154,7 @@ class AliasManager {
|
||||
|
||||
class LoopInfo {
|
||||
public:
|
||||
LoopInfo(StatementPtr s);
|
||||
explicit LoopInfo(StatementPtr s);
|
||||
|
||||
StatementPtr m_stmt;
|
||||
StatementPtrVec m_inner;
|
||||
|
||||
@@ -853,9 +853,11 @@ struct OptVisitor {
|
||||
OptVisitor(AnalysisResultPtr ar, unsigned nscope) :
|
||||
m_ar(ar), m_nscope(nscope), m_dispatcher(0) {
|
||||
}
|
||||
OptVisitor(const Visitor &po) : m_ar(po.m_ar),
|
||||
m_nscope(po.m_nscope),
|
||||
m_dispatcher(po.m_dispatcher) {
|
||||
/* implicit */ OptVisitor(const Visitor &po)
|
||||
: m_ar(po.m_ar)
|
||||
, m_nscope(po.m_nscope)
|
||||
, m_dispatcher(po.m_dispatcher)
|
||||
{
|
||||
const_cast<Visitor&>(po).m_dispatcher = 0;
|
||||
}
|
||||
~OptVisitor() {
|
||||
|
||||
@@ -91,12 +91,12 @@ public:
|
||||
|
||||
class Locker {
|
||||
public:
|
||||
Locker(const AnalysisResult *ar) :
|
||||
explicit Locker(const AnalysisResult *ar) :
|
||||
m_ar(const_cast<AnalysisResult*>(ar)),
|
||||
m_mutex(m_ar->getMutex()) {
|
||||
m_mutex.lock();
|
||||
}
|
||||
Locker(AnalysisResultConstPtr ar) :
|
||||
explicit Locker(AnalysisResultConstPtr ar) :
|
||||
m_ar(const_cast<AnalysisResult*>(ar.get())),
|
||||
m_mutex(m_ar->getMutex()) {
|
||||
m_mutex.lock();
|
||||
@@ -399,7 +399,7 @@ private:
|
||||
|
||||
class RescheduleException : public Exception {
|
||||
public:
|
||||
RescheduleException(BlockScopeRawPtr scope) :
|
||||
explicit RescheduleException(BlockScopeRawPtr scope) :
|
||||
Exception(), m_scope(scope) {}
|
||||
BlockScopeRawPtr &getScope() { return m_scope; }
|
||||
#ifdef HPHP_INSTRUMENT_TYPE_INF
|
||||
@@ -413,7 +413,7 @@ private:
|
||||
|
||||
class SetCurrentScope {
|
||||
public:
|
||||
SetCurrentScope(BlockScopeRawPtr scope) {
|
||||
explicit SetCurrentScope(BlockScopeRawPtr scope) {
|
||||
assert(!((*AnalysisResult::s_currentScopeThreadLocal).get()));
|
||||
*AnalysisResult::s_currentScopeThreadLocal = scope;
|
||||
scope->setInVisitScopes(true);
|
||||
@@ -499,9 +499,9 @@ private:
|
||||
}
|
||||
}
|
||||
#else
|
||||
BaseTryLock(BlockScopeRawPtr scopeToLock,
|
||||
bool lockCondition = true,
|
||||
bool profile = true)
|
||||
explicit BaseTryLock(BlockScopeRawPtr scopeToLock,
|
||||
bool lockCondition = true,
|
||||
bool profile = true)
|
||||
: m_profiler(profile),
|
||||
m_mutex(scopeToLock->getInferTypesMutex()),
|
||||
m_acquired(false) {
|
||||
@@ -536,8 +536,8 @@ public:
|
||||
bool profile = true) :
|
||||
BaseTryLock(scopeToLock, fromFunction, fromLine, true, profile) {}
|
||||
#else
|
||||
TryLock(BlockScopeRawPtr scopeToLock,
|
||||
bool profile = true) :
|
||||
explicit TryLock(BlockScopeRawPtr scopeToLock,
|
||||
bool profile = true) :
|
||||
BaseTryLock(scopeToLock, true, profile) {}
|
||||
#endif /* HPHP_INSTRUMENT_TYPE_INF */
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace HPHP {
|
||||
class AstWalkerState {
|
||||
public:
|
||||
AstWalkerState() : index(0) {}
|
||||
AstWalkerState(ConstructRawPtr c) : cp(c), index(0) {}
|
||||
explicit AstWalkerState(ConstructRawPtr c) : cp(c), index(0) {}
|
||||
|
||||
friend bool operator==(const AstWalkerState &s1,
|
||||
const AstWalkerState &s2) {
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
class AstWalkerStateVec : public std::vector<AstWalkerState> {
|
||||
public:
|
||||
AstWalkerStateVec() {}
|
||||
AstWalkerStateVec(ConstructRawPtr cp) {
|
||||
explicit AstWalkerStateVec(ConstructRawPtr cp) {
|
||||
push_back(AstWalkerState(cp));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ DECLARE_BOOST_TYPES(ClassScope);
|
||||
*/
|
||||
class ConstantTable : public SymbolTable {
|
||||
public:
|
||||
ConstantTable(BlockScope &blockScope);
|
||||
explicit ConstantTable(BlockScope &blockScope);
|
||||
|
||||
/**
|
||||
* Whether defining something to be non-scalar value or redeclared, or
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#include "compiler/analysis/control_flow.h"
|
||||
|
||||
#include <boost/graph/depth_first_search.hpp>
|
||||
|
||||
#include "compiler/analysis/ast_walker.h"
|
||||
#include "compiler/analysis/control_flow.h"
|
||||
#include "compiler/analysis/data_flow.h"
|
||||
#include "compiler/expression/expression.h"
|
||||
#include "compiler/expression/binary_op_expression.h"
|
||||
@@ -37,8 +39,6 @@
|
||||
#include "compiler/statement/goto_statement.h"
|
||||
#include "compiler/statement/case_statement.h"
|
||||
|
||||
#include <boost/graph/depth_first_search.hpp>
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
|
||||
class dfs_dump : public boost::default_dfs_visitor {
|
||||
public:
|
||||
dfs_dump(AnalysisResultConstPtr ar) : m_ar(ar) {}
|
||||
explicit dfs_dump(AnalysisResultConstPtr ar) : m_ar(ar) {}
|
||||
|
||||
void discover_vertex(ControlFlowGraph::vertex_descriptor u,
|
||||
const ControlFlowGraph &g) {
|
||||
|
||||
@@ -309,7 +309,10 @@ inline void put(boost::vertex_color_t c,
|
||||
|
||||
class ControlFlowGraphWalker : public FunctionWalker {
|
||||
public:
|
||||
ControlFlowGraphWalker(ControlFlowGraph *g) : m_block(0), m_graph(*g) {}
|
||||
explicit ControlFlowGraphWalker(ControlFlowGraph *g)
|
||||
: m_block(0)
|
||||
, m_graph(*g)
|
||||
{}
|
||||
template <class T>
|
||||
void walk(T &t) {
|
||||
std::pair<ControlFlowGraph::vertex_iterator,
|
||||
|
||||
@@ -91,7 +91,7 @@ private:
|
||||
|
||||
class DataFlowWalker : public ControlFlowGraphWalker {
|
||||
public:
|
||||
DataFlowWalker(ControlFlowGraph *g) : ControlFlowGraphWalker(g) {}
|
||||
explicit DataFlowWalker(ControlFlowGraph *g) : ControlFlowGraphWalker(g) {}
|
||||
|
||||
template<class T>
|
||||
void walk(T &t) { ControlFlowGraphWalker::walk(t); }
|
||||
|
||||
@@ -32,7 +32,7 @@ class Dictionary {
|
||||
public:
|
||||
typedef std::vector<ExpressionPtr> IdMap;
|
||||
|
||||
Dictionary(AliasManager &am);
|
||||
explicit Dictionary(AliasManager &am);
|
||||
void build(MethodStatementPtr s);
|
||||
void build(StatementPtr s);
|
||||
void build(ExpressionPtr s);
|
||||
|
||||
@@ -27,7 +27,7 @@ typedef std::vector<TypePtrIdxPair> TypePtrIdxPairVec;
|
||||
|
||||
class ExprDict : public Dictionary {
|
||||
public:
|
||||
ExprDict(AliasManager &am);
|
||||
explicit ExprDict(AliasManager &am);
|
||||
/* Building the dictionary */
|
||||
void build(MethodStatementPtr m);
|
||||
void visit(ExpressionPtr e);
|
||||
@@ -43,8 +43,8 @@ public:
|
||||
TypePtr propagateType(ExpressionPtr e);
|
||||
|
||||
void getTypes(ExpressionPtr e, TypePtrIdxPairVec &types);
|
||||
private:
|
||||
|
||||
private:
|
||||
/**
|
||||
* types is filled with (type assertion, canon id for that type assertion)
|
||||
* tuples
|
||||
|
||||
@@ -398,8 +398,11 @@ public:
|
||||
|
||||
class FunctionInfo {
|
||||
public:
|
||||
FunctionInfo(int rva = -1) : m_maybeStatic(false), m_maybeRefReturn(false),
|
||||
m_refVarArg(rva) { }
|
||||
explicit FunctionInfo(int rva = -1)
|
||||
: m_maybeStatic(false)
|
||||
, m_maybeRefReturn(false)
|
||||
, m_refVarArg(rva)
|
||||
{}
|
||||
|
||||
bool isRefParam(int p) const {
|
||||
if (m_refVarArg >= 0 && p >= m_refVarArg) return true;
|
||||
|
||||
@@ -326,10 +326,10 @@ void LiveDict::updateAccess(ExpressionPtr e) {
|
||||
}
|
||||
|
||||
struct Colorizer {
|
||||
Colorizer(int w) : toNode(w) {}
|
||||
explicit Colorizer(int w) : toNode(w) {}
|
||||
|
||||
struct NodeInfo {
|
||||
NodeInfo(int index) : originalIndex(index), size(0), color(-1) {}
|
||||
explicit NodeInfo(int index) : originalIndex(index), size(0), color(-1) {}
|
||||
int originalIndex;
|
||||
int size;
|
||||
int color;
|
||||
@@ -359,7 +359,7 @@ struct Colorizer {
|
||||
|
||||
class NodeCmp {
|
||||
public:
|
||||
NodeCmp(const Colorizer *c) : m_c(c) {}
|
||||
explicit NodeCmp(const Colorizer *c) : m_c(c) {}
|
||||
bool operator()(int a, int b) {
|
||||
const NodeInfo &n1 = m_c->nodes[a];
|
||||
const NodeInfo &n2 = m_c->nodes[b];
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace HPHP {
|
||||
|
||||
class LiveDict : public Dictionary {
|
||||
public:
|
||||
LiveDict(AliasManager &am) : Dictionary(am) {}
|
||||
explicit LiveDict(AliasManager &am) : Dictionary(am) {}
|
||||
/* Building the dictionary */
|
||||
void build(MethodStatementPtr m);
|
||||
void visit(ExpressionPtr e);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace HPHP {
|
||||
|
||||
class RefDict : public Dictionary {
|
||||
public:
|
||||
RefDict(AliasManager &am) : Dictionary(am), first_pass(true) {}
|
||||
explicit RefDict(AliasManager &am) : Dictionary(am), first_pass(true) {}
|
||||
|
||||
/* Building the dictionary */
|
||||
void build(MethodStatementPtr m);
|
||||
@@ -52,7 +52,7 @@ private:
|
||||
|
||||
class RefDictWalker : public ControlFlowGraphWalker {
|
||||
public:
|
||||
RefDictWalker(ControlFlowGraph *g) :
|
||||
explicit RefDictWalker(ControlFlowGraph *g) :
|
||||
ControlFlowGraphWalker(g), first_pass(true) {}
|
||||
void walk() { ControlFlowGraphWalker::walk(*this); }
|
||||
int after(ConstructRawPtr cp);
|
||||
|
||||
@@ -254,7 +254,7 @@ private:
|
||||
|
||||
class SymParamWrapper : public JSON::DocTarget::ISerializable {
|
||||
public:
|
||||
SymParamWrapper(const Symbol* sym) : m_sym(sym) {
|
||||
explicit SymParamWrapper(const Symbol* sym) : m_sym(sym) {
|
||||
assert(sym);
|
||||
}
|
||||
virtual void serialize(JSON::DocTarget::OutputStream &out) const {
|
||||
@@ -266,7 +266,7 @@ private:
|
||||
|
||||
class SymClassVarWrapper : public JSON::DocTarget::ISerializable {
|
||||
public:
|
||||
SymClassVarWrapper(const Symbol* sym) : m_sym(sym) {
|
||||
explicit SymClassVarWrapper(const Symbol* sym) : m_sym(sym) {
|
||||
assert(sym);
|
||||
}
|
||||
virtual void serialize(JSON::DocTarget::OutputStream &out) const {
|
||||
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
/**
|
||||
* KindOf testing.
|
||||
*/
|
||||
Type(KindOf kindOf);
|
||||
explicit Type(KindOf kindOf);
|
||||
bool is(KindOf kindOf) const { return m_kindOf == kindOf;}
|
||||
bool isExactType() const { return IsExactType(m_kindOf); }
|
||||
bool mustBe(KindOf kindOf) const { return !(m_kindOf & ~kindOf); }
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
VariableTable(BlockScope &blockScope);
|
||||
explicit VariableTable(BlockScope &blockScope);
|
||||
|
||||
/**
|
||||
* Get/set attributes.
|
||||
|
||||
@@ -454,7 +454,8 @@ private:
|
||||
|
||||
void Construct::dump(int spc, AnalysisResultConstPtr ar) {
|
||||
ConstructDumper cd(spc, ar);
|
||||
cd.walk(ConstructRawPtr(this), ConstructRawPtr(), ConstructRawPtr());
|
||||
cd.walk(AstWalkerStateVec(ConstructRawPtr(this)),
|
||||
ConstructRawPtr(), ConstructRawPtr());
|
||||
}
|
||||
|
||||
void Construct::dump(int spc, AnalysisResultConstPtr ar, bool functionOnly,
|
||||
|
||||
@@ -314,7 +314,7 @@ public:
|
||||
int getLocalEffects() const { return m_localEffects; }
|
||||
virtual void effectsCallback() = 0;
|
||||
protected:
|
||||
LocalEffectsContainer(Construct::Effect localEffect) :
|
||||
explicit LocalEffectsContainer(Construct::Effect localEffect) :
|
||||
m_localEffects(localEffect) {}
|
||||
LocalEffectsContainer() :
|
||||
m_localEffects(0) {}
|
||||
|
||||
@@ -33,8 +33,8 @@ public:
|
||||
ListKindLeft
|
||||
};
|
||||
|
||||
ExpressionList(EXPRESSION_CONSTRUCTOR_PARAMETERS,
|
||||
ListKind kind = ListKindParam);
|
||||
explicit ExpressionList(EXPRESSION_CONSTRUCTOR_PARAMETERS,
|
||||
ListKind kind = ListKindParam);
|
||||
|
||||
// change case to lower so to make it case insensitive
|
||||
void toLower();
|
||||
|
||||
@@ -208,7 +208,10 @@ void FunctionCall::analyzeProgram(AnalysisResultPtr ar) {
|
||||
}
|
||||
|
||||
struct InlineCloneInfo {
|
||||
InlineCloneInfo(FunctionScopePtr fs) : func(fs), callWithThis(false) {}
|
||||
explicit InlineCloneInfo(FunctionScopePtr fs)
|
||||
: func(fs)
|
||||
, callWithThis(false)
|
||||
{}
|
||||
|
||||
FunctionScopePtr func;
|
||||
StringToExpressionPtrMap sepm;
|
||||
|
||||
@@ -26,7 +26,7 @@ DECLARE_BOOST_TYPES(ModifierExpression);
|
||||
|
||||
class ModifierExpression : public Expression {
|
||||
public:
|
||||
ModifierExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS);
|
||||
explicit ModifierExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS);
|
||||
|
||||
DECLARE_BASE_EXPRESSION_VIRTUAL_FUNCTIONS;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace HPHP {
|
||||
|
||||
class StaticClassName : public IParseHandler {
|
||||
public:
|
||||
StaticClassName(ExpressionPtr classExp);
|
||||
explicit StaticClassName(ExpressionPtr classExp);
|
||||
|
||||
void onParse(AnalysisResultConstPtr ar, FileScopePtr scope);
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@ DECLARE_BOOST_TYPES(AnalysisResult);
|
||||
*/
|
||||
class Package {
|
||||
public:
|
||||
Package(const char *root, bool bShortTags = true, bool bAspTags = false);
|
||||
explicit Package(const char *root,
|
||||
bool bShortTags = true,
|
||||
bool bAspTags = false);
|
||||
|
||||
void addAllFiles(bool force); // add from Option::PackageDirectories/Files
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ DECLARE_BOOST_TYPES(LoopStatement);
|
||||
|
||||
class LoopStatement : public Statement {
|
||||
protected:
|
||||
LoopStatement(STATEMENT_CONSTRUCTOR_BASE_PARAMETERS);
|
||||
explicit LoopStatement(STATEMENT_CONSTRUCTOR_BASE_PARAMETERS);
|
||||
public:
|
||||
void clearStringBufs();
|
||||
void addStringBuf(const std::string &name);
|
||||
|
||||
@@ -26,7 +26,7 @@ DECLARE_BOOST_TYPES(StatementList);
|
||||
|
||||
class StatementList : public Statement {
|
||||
public:
|
||||
StatementList(STATEMENT_CONSTRUCTOR_PARAMETERS);
|
||||
explicit StatementList(STATEMENT_CONSTRUCTOR_PARAMETERS);
|
||||
|
||||
DECLARE_STATEMENT_VIRTUAL_FUNCTIONS;
|
||||
StatementPtr preOptimize(AnalysisResultConstPtr ar);
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário