本文整理汇总了C++中BlockScopeRawPtr::addUpdates方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockScopeRawPtr::addUpdates方法的具体用法?C++ BlockScopeRawPtr::addUpdates怎么用?C++ BlockScopeRawPtr::addUpdates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockScopeRawPtr
的用法示例。
在下文中一共展示了BlockScopeRawPtr::addUpdates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: triggerUpdates
void Symbol::triggerUpdates(BlockScopeRawPtr scope) const {
int useKind = BlockScope::GetNonStaticRefUseKind(getHash());
if (isConstant()) {
useKind = BlockScope::UseKindConstRef;
if (m_declaration) {
BlockScopeRawPtr declScope(m_declaration->getScope());
/**
* Constants can only belong to a file or class scope
*/
assert(scope->is(BlockScope::FileScope) ||
scope->is(BlockScope::ClassScope));
/**
* Constants can only be declared in a function or
* class scope
*/
assert(declScope->is(BlockScope::FunctionScope) ||
declScope->is(BlockScope::ClassScope));
/**
* For class scopes, the declaration scope *must*
* match the scope the symbol lives in
*/
assert(!scope->is(BlockScope::ClassScope) ||
scope == declScope);
/**
* For file scopes, the declaration scope *must*
* live in a function scope
*/
assert(!scope->is(BlockScope::FileScope) ||
declScope->is(BlockScope::FunctionScope));
/**
* This is really only for file scopes (constants created with
* define('FOO', ...)). const FOO = 1 outside of a class is re-written
* into a define('FOO', 1) by earlier phases of the compiler
*/
if (scope->is(BlockScope::FileScope)) {
declScope->announceUpdates(BlockScope::UseKindConstRef);
return;
}
}
} else if (isStatic()) {
useKind = BlockScope::UseKindStaticRef;
} else if (isParameter()) {
useKind = BlockScope::UseKindCallerParam;
}
if (isPassClosureVar()) {
useKind |= BlockScope::UseKindClosure;
}
scope->addUpdates(useKind);
}
示例2: lock
int DepthFirstVisitor<Pre, OptVisitor>::visitScope(BlockScopeRawPtr scope) {
int updates, all_updates = 0;
StatementPtr stmt = scope->getStmt();
if (MethodStatementPtr m =
dynamic_pointer_cast<MethodStatement>(stmt)) {
WriteLock lock(m->getFunctionScope()->getInlineMutex());
do {
scope->clearUpdated();
if (Option::LocalCopyProp || Option::EliminateDeadCode) {
AliasManager am(-1);
if (am.optimize(this->m_data.m_ar, m)) {
scope->addUpdates(BlockScope::UseKindCaller);
}
} else {
StatementPtr rep = this->visitStmtRecur(stmt);
always_assert(!rep);
}
updates = scope->getUpdated();
all_updates |= updates;
} while (updates);
if (all_updates & BlockScope::UseKindCaller &&
!m->getFunctionScope()->getInlineAsExpr()) {
all_updates &= ~BlockScope::UseKindCaller;
}
return all_updates;
}
do {
scope->clearUpdated();
StatementPtr rep = this->visitStmtRecur(stmt);
always_assert(!rep);
updates = scope->getUpdated();
all_updates |= updates;
} while (updates);
return all_updates;
}