本文整理汇总了C++中Func::isIgnoreRedefinition方法的典型用法代码示例。如果您正苦于以下问题:C++ Func::isIgnoreRedefinition方法的具体用法?C++ Func::isIgnoreRedefinition怎么用?C++ Func::isIgnoreRedefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func::isIgnoreRedefinition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rename
bool RenamedFuncDict::rename(const StringData* old, const StringData* n3w) {
assert(isFunctionRenameable(old) ||
isFunctionRenameable(n3w));
NamedEntity *oldNe = const_cast<NamedEntity *>(Unit::GetNamedEntity(old));
NamedEntity *newNe = const_cast<NamedEntity *>(Unit::GetNamedEntity(n3w));
Func* func = Unit::lookupFunc(oldNe);
if (!func) {
// It's the caller's responsibility to ensure that the old function
// exists.
not_reached();
}
if (!(func->attrs() & AttrDynamicInvoke)) {
// When EvalJitEnableRenameFunction is false, the translator may wire
// non-DynamicInvoke Func*'s into the TC. Don't rename functions.
if (RuntimeOption::EvalJit && !RuntimeOption::EvalJitEnableRenameFunction) {
raise_error("You must explicitly enable fb_rename_function in the JIT "
"(-v Eval.JitEnableRenameFunction=true)");
}
}
Func *fnew = Unit::lookupFunc(newNe);
if (fnew && fnew != func) {
// To match hphpc, we silently ignore functions defined in user code that
// have the same name as a function defined in a separable extension
if (!fnew->isIgnoreRedefinition()) {
raise_error("Function already defined: %s", n3w->data());
} else {
return false;
}
}
oldNe->setCachedFunc(nullptr);
if (UNLIKELY(newNe->m_cachedFuncOffset == 0)) {
Transl::TargetCache::allocFixedFunction(newNe, false);
}
newNe->setCachedFunc(func);
if (RuntimeOption::EvalJit) {
Transl::TargetCache::invalidateForRename(old);
}
return true;
}