本文整理汇总了C++中ParameterExpressionPtr::hasRTTI方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterExpressionPtr::hasRTTI方法的具体用法?C++ ParameterExpressionPtr::hasRTTI怎么用?C++ ParameterExpressionPtr::hasRTTI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterExpressionPtr
的用法示例。
在下文中一共展示了ParameterExpressionPtr::hasRTTI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outputCPPArgInjections
void MethodStatement::outputCPPArgInjections(CodeGenerator &cg,
AnalysisResultPtr ar,
const char *name,
ClassScopePtr cls,
FunctionScopePtr funcScope) {
if (cg.getOutput() != CodeGenerator::SystemCPP) {
if (m_params) {
int n = m_params->getCount();
cg_printf("INTERCEPT_INJECTION(\"%s\", ", name);
if (Option::GenArrayCreate && !hasRefParam()) {
ar->m_arrayIntegerKeySizes.insert(n);
outputParamArrayCreate(cg, true);
cg_printf(", %s);\n", funcScope->isRefReturn() ? "ref(r)" : "r");
} else {
cg_printf("(Array(ArrayInit(%d, true)", n);
for (int i = 0; i < n; i++) {
ParameterExpressionPtr param =
dynamic_pointer_cast<ParameterExpression>((*m_params)[i]);
const string ¶mName = param->getName();
cg_printf(".set%s(%d, %s%s)", param->isRef() ? "Ref" : "",
i, Option::VariablePrefix, paramName.c_str());
}
cg_printf(".create())), %s);\n",
funcScope->isRefReturn() ? "ref(r)" : "r");
}
} else {
cg_printf("INTERCEPT_INJECTION(\"%s\", null_array, %s);\n",
name, funcScope->isRefReturn() ? "ref(r)" : "r");
}
}
if (Option::GenRTTIProfileData && m_params) {
for (int i = 0; i < m_params->getCount(); i++) {
ParameterExpressionPtr param =
dynamic_pointer_cast<ParameterExpression>((*m_params)[i]);
if (param->hasRTTI()) {
const string ¶mName = param->getName();
int id = ar->getParamRTTIEntryId(cls, funcScope, paramName);
if (id != -1) {
cg_printf("RTTI_INJECTION(%s%s, %d);\n",
Option::VariablePrefix, paramName.c_str(), id);
}
}
}
}
}
示例2: outputCPPImpl
//.........这里部分代码省略.........
if (type) {
type->outputCPPDecl(cg, ar);
} else {
cg.printf("void");
}
origFuncName = std::string(scope->getOriginalName()) +
"::" + m_originalName;
if (Option::HotFunctions.find(origFuncName) !=
Option::HotFunctions.end()) {
cg.printf(" __attribute((__section__(\".text.hot\")))");
} else if (Option::ColdFunctions.find(origFuncName) !=
Option::ColdFunctions.end()) {
cg.printf(" __attribute((__section__(\".text.cold\")))");
}
if (m_name == "__lval") {
cg.printf(" &%s%s::___lval(",
Option::ClassPrefix, scope->getId().c_str());
} else if (m_name == "__offsetget_lval") {
cg.printf(" &%s%s::___offsetget_lval(",
Option::ClassPrefix, scope->getId().c_str());
} else if (m_modifiers->isStatic()) {
cg.printf(" %s%s::%s%s(const char* cls%s", Option::ClassPrefix,
scope->getId().c_str(),
Option::MethodImplPrefix, m_name.c_str(),
funcScope->isVariableArgument() ||
(m_params && m_params->getCount()) ? ", " : "");
} else {
cg.printf(" %s%s::%s%s(", Option::ClassPrefix, scope->getId().c_str(),
Option::MethodPrefix, m_name.c_str());
}
funcScope->outputCPPParamsDecl(cg, ar, m_params, false);
cg.indentBegin(") {\n");
if (m_modifiers->isStatic()) {
cg.printf("STATIC_METHOD_INJECTION(%s, %s::%s);\n",
scope->getOriginalName(), scope->getOriginalName(),
m_originalName.c_str());
} else {
cg.printf("INSTANCE_METHOD_INJECTION(%s, %s::%s);\n",
scope->getOriginalName(), scope->getOriginalName(),
m_originalName.c_str());
}
if (Option::GenRTTIProfileData && m_params) {
for (int i = 0; i < m_params->getCount(); i++) {
ParameterExpressionPtr param =
dynamic_pointer_cast<ParameterExpression>((*m_params)[i]);
if (param->hasRTTI()) {
const string ¶mName = param->getName();
int id = ar->getParamRTTIEntryId(ar->getClassScope(), funcScope,
paramName);
if (id != -1) {
cg.printf("RTTI_INJECTION(%s%s, %d);\n",
Option::VariablePrefix, paramName.c_str(), id);
}
}
}
}
if (m_name == "__lval" || m_name == "__offsetget_lval") {
ParameterExpressionPtr param =
dynamic_pointer_cast<ParameterExpression>((*m_params)[0]);
cg.printf("Variant &v = %s->__lvalProxy;\n",
cg.getOutput() == CodeGenerator::SystemCPP ?
"get_system_globals()" : "get_global_variables()");
string lowered = Util::toLower(m_originalName);
cg.printf("v = %s%s(%s%s);\n",
Option::MethodPrefix, lowered.c_str(),
Option::VariablePrefix, param->getName().c_str());
cg.printf("return v;\n");
} else {
if (funcScope->isConstructor(scope)) {
cg.printf("bool oldInCtor = gasInCtor(true);\n");
} else if (m_name == "__destruct") {
cg.printf("setInDtor();\n");
} else if (m_name == "__call") {
ParameterExpressionPtr param;
if (m_params->getCount() > 0) {
param = dynamic_pointer_cast<ParameterExpression>((*m_params)[0]);
cg.printf("INCALL_HELPER(%s%s);\n",
Option::VariablePrefix, param->getName().c_str());
} else {
cg.printf("INCALL_HELPER(\"\");\n");
}
}
funcScope->outputCPP(cg, ar);
cg.setContext(CodeGenerator::NoContext); // no inner functions/classes
if (!funcScope->isStatic() && funcScope->getVariables()->
getAttribute(VariableTable::ContainsDynamicVariable)) {
cg.printf("%sthis = this;\n", Option::VariablePrefix);
}
outputCPPStmt(cg, ar);
cg.setContext(CodeGenerator::CppImplementation);
}
cg.indentEnd("} /* function */\n");
}
break;
default:
break;
}
ar->popScope();
}