本文整理汇总了C++中FunctionScopePtr::isInlined方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionScopePtr::isInlined方法的具体用法?C++ FunctionScopePtr::isInlined怎么用?C++ FunctionScopePtr::isInlined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionScopePtr
的用法示例。
在下文中一共展示了FunctionScopePtr::isInlined方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: analyzeInclude
void IncludeExpression::analyzeInclude(AnalysisResultPtr ar,
const std::string &include) {
ASSERT(ar->getPhase() == AnalysisResult::AnalyzeInclude);
ConstructPtr self = shared_from_this();
FileScopePtr file = ar->findFileScope(include, true);
if (!file) {
ar->getCodeError()->record(self, CodeError::PHPIncludeFileNotFound, self);
return;
}
if (include.find("compiler/") != 0 ||
include.find("/compiler/") == string::npos) {
ar->getCodeError()->record(self, CodeError::PHPIncludeFileNotInLib,
self, ConstructPtr(),
include.c_str());
}
if (!isFileLevel()) { // Not unsupported but potentially bad
ar->getCodeError()->record(self, CodeError::UseDynamicInclude, self);
}
ar->getDependencyGraph()->add
(DependencyGraph::KindOfProgramMaxInclude,
ar->getName(), file->getName(), StatementPtr());
ar->getDependencyGraph()->addParent
(DependencyGraph::KindOfProgramMinInclude,
ar->getName(), file->getName(), StatementPtr());
FunctionScopePtr func = ar->getFunctionScope();
ar->getFileScope()->addIncludeDependency(ar, m_include,
func && func->isInlined());
}
示例2: addUserFunction
void Construct::addUserFunction(AnalysisResultPtr ar,
const std::string &name) {
if (!name.empty()) {
if (ar->getPhase() == AnalysisResult::AnalyzeAll ||
ar->getPhase() == AnalysisResult::AnalyzeFinal) {
FunctionScopePtr func = getFunctionScope();
getFileScope()->addFunctionDependency(ar, name, func &&
func->isInlined());
}
}
}
示例3: outputCPPImpl
void ParameterExpression::outputCPPImpl(CodeGenerator &cg,
AnalysisResultPtr ar) {
FunctionScopePtr func =
dynamic_pointer_cast<FunctionScope>(ar->getScope());
VariableTablePtr variables = func->getVariables();
TypePtr paramType = func->getParamType(cg.getItemIndex());
bool isCVarRef = false;
if (cg.getContext() == CodeGenerator::CppStaticMethodWrapper ||
(!variables->isLvalParam(m_name) &&
!variables->getAttribute(VariableTable::ContainsDynamicVariable) &&
!variables->getAttribute(VariableTable::ContainsExtract) &&
!m_ref)) {
if (paramType->is(Type::KindOfVariant) ||
paramType->is(Type::KindOfSome)) {
cg_printf("CVarRef");
isCVarRef = true;
}
else if (paramType->is(Type::KindOfArray)) cg_printf("CArrRef");
else if (paramType->is(Type::KindOfString)) cg_printf("CStrRef");
else paramType->outputCPPDecl(cg, ar);
} else {
paramType->outputCPPDecl(cg, ar);
}
cg_printf(" %s%s", Option::VariablePrefix, m_name.c_str());
if (m_defaultValue) {
CodeGenerator::Context context = cg.getContext();
bool comment = context == CodeGenerator::CppImplementation ||
(context == CodeGenerator::CppDeclaration && func->isInlined());
if (comment) {
cg_printf(" // ");
}
cg_printf(" = ");
ConstantExpressionPtr con =
dynamic_pointer_cast<ConstantExpression>(m_defaultValue);
if (isCVarRef && con && con->isNull()) {
cg_printf("null_variant");
} else {
if (comment) {
cg.setContext(CodeGenerator::CppParameterDefaultValueImpl);
} else {
cg.setContext(CodeGenerator::CppParameterDefaultValueDecl);
}
m_defaultValue->outputCPP(cg, ar);
cg.setContext(context);
}
if (comment) {
cg_printf("\n");
}
}
}
示例4: analyzeInclude
void IncludeExpression::analyzeInclude(AnalysisResultPtr ar,
const std::string &include) {
ConstructPtr self = shared_from_this();
FileScopePtr file = ar->findFileScope(include);
if (!file && !include.empty()) {
Compiler::Error(Compiler::PHPIncludeFileNotFound, self);
return;
}
FunctionScopePtr func = getFunctionScope();
getFileScope()->addIncludeDependency(ar, m_include,
func && func->isInlined());
if (func && file->getPseudoMain()) {
file->getPseudoMain()->addUse(func, BlockScope::UseKindInclude);
}
}
示例5: analyzeProgram
void IncludeExpression::analyzeProgram(AnalysisResultPtr ar) {
if (!m_include.empty()) {
if (ar->getPhase() == AnalysisResult::AnalyzeAll ||
ar->getPhase() == AnalysisResult::AnalyzeFinal) {
if (analyzeInclude(ar, m_include)) {
FunctionScopePtr func = getFunctionScope();
getFileScope()->addIncludeDependency(ar, m_include,
func && func->isInlined());
}
}
}
VariableTablePtr var = getScope()->getVariables();
var->setAttribute(VariableTable::ContainsLDynamicVariable);
var->forceVariants(ar, VariableTable::AnyVars);
UnaryOpExpression::analyzeProgram(ar);
}
示例6: outputCPPImpl
void ParameterExpression::outputCPPImpl(CodeGenerator &cg,
AnalysisResultPtr ar) {
FunctionScopePtr func = getFunctionScope();
VariableTablePtr variables = func->getVariables();
Symbol *sym = variables->getSymbol(m_name);
assert(sym && sym->isParameter());
bool inHeader = cg.isFileOrClassHeader();
cg.setFileOrClassHeader(true);
CodeGenerator::Context context = cg.getContext();
bool typedWrapper = (context == CodeGenerator::CppTypedParamsWrapperImpl ||
context == CodeGenerator::CppTypedParamsWrapperDecl);
TypePtr paramType =
typedWrapper && func->getParamTypeSpec(sym->getParameterIndex()) ?
Type::Variant : func->getParamType(sym->getParameterIndex());
bool wrapper = typedWrapper ||
context == CodeGenerator::CppFunctionWrapperImpl ||
context == CodeGenerator::CppFunctionWrapperDecl;
bool isCVarRef = false;
const char *prefix = "";
if (m_ref) {
cg_printf("VRefParam");
if (!wrapper) {
prefix = "r";
}
} else if (wrapper ||
(!variables->isLvalParam(m_name) &&
!variables->getAttribute(VariableTable::ContainsDynamicVariable) &&
!variables->getAttribute(VariableTable::ContainsExtract))) {
if (paramType->is(Type::KindOfVariant) ||
paramType->is(Type::KindOfSome)) {
cg_printf("CVarRef");
isCVarRef = true;
}
else if (paramType->is(Type::KindOfArray)) cg_printf("CArrRef");
else if (paramType->is(Type::KindOfString)) cg_printf("CStrRef");
else paramType->outputCPPDecl(cg, ar, getScope());
} else {
paramType->outputCPPDecl(cg, ar, getScope());
}
cg_printf(" %s%s%s",
prefix, Option::VariablePrefix,
CodeGenerator::FormatLabel(m_name).c_str());
if (m_defaultValue && sym->getParameterIndex() >= func->getMinParamCount()) {
bool comment = context == CodeGenerator::CppTypedParamsWrapperImpl ||
context == CodeGenerator::CppFunctionWrapperImpl ||
context == CodeGenerator::CppImplementation ||
(context == CodeGenerator::CppDeclaration && func->isInlined());
if (comment) {
cg_printf(" // ");
}
cg_printf(" = ");
ConstantExpressionPtr con =
dynamic_pointer_cast<ConstantExpression>(m_defaultValue);
bool done = false;
if (con && con->isNull()) {
done = true;
if (isCVarRef) {
cg_printf("null_variant");
} else if (paramType->is(Type::KindOfVariant) ||
paramType->is(Type::KindOfSome)) {
cg_printf("null");
} else if (paramType->is(Type::KindOfObject)) {
cg_printf("Object()");
} else if (paramType->is(Type::KindOfArray)) {
cg_printf("Array()");
} else if (paramType->is(Type::KindOfString)) {
cg_printf("String()");
} else {
done = false;
}
}
if (!done) {
if (comment) {
cg.setContext(CodeGenerator::CppParameterDefaultValueImpl);
} else {
cg.setContext(CodeGenerator::CppParameterDefaultValueDecl);
}
bool isScalar = m_defaultValue->isScalar();
if (isCVarRef && isScalar) {
ASSERT(!cg.hasScalarVariant());
cg.setScalarVariant();
}
m_defaultValue->outputCPP(cg, ar);
if (isCVarRef && isScalar) cg.clearScalarVariant();
ASSERT(!cg.hasScalarVariant());
cg.setContext(context);
}
if (comment) {
cg_printf("\n");
}
}
cg.setFileOrClassHeader(inHeader);
}
示例7: outputCPPImpl
void FunctionStatement::outputCPPImpl(CodeGenerator &cg,
AnalysisResultPtr ar) {
CodeGenerator::Context context = cg.getContext();
FunctionScopePtr funcScope = m_funcScope.lock();
string fname = funcScope->getId(cg).c_str();
bool pseudoMain = funcScope->inPseudoMain();
string origFuncName = !pseudoMain ? funcScope->getOriginalName() :
("run_init::" + funcScope->getFileScope()->getName());
string funcSection;
if (outputFFI(cg, ar)) return;
if (context == CodeGenerator::NoContext) {
string rname = cg.formatLabel(m_name);
if (funcScope->isRedeclaring()) {
cg.printf("g->%s%s = &%s%s;\n", Option::CallInfoPrefix, m_name.c_str(),
Option::CallInfoPrefix, fname.c_str());
}
if (funcScope->isVolatile()) {
cg_printf("g->declareFunctionLit(");
cg_printString(m_name, ar);
cg_printf(");\n");
cg_printf("g->FVF(%s) = true;\n", rname.c_str());
}
return;
}
if (context == CodeGenerator::CppDeclaration &&
!funcScope->isInlined()) return;
if (context == CodeGenerator::CppPseudoMain &&
!pseudoMain) return;
if (context == CodeGenerator::CppImplementation &&
(funcScope->isInlined() || pseudoMain)) return;
ar->pushScope(funcScope);
cg.setPHPLineNo(-1);
if (pseudoMain && !Option::GenerateCPPMain) {
if (context == CodeGenerator::CppPseudoMain) {
if (cg.getOutput() != CodeGenerator::SystemCPP) {
cg.setContext(CodeGenerator::NoContext); // no inner functions/classes
funcScope->getVariables()->setAttribute(VariableTable::ForceGlobal);
outputCPPStmt(cg, ar);
funcScope->getVariables()->clearAttribute(VariableTable::ForceGlobal);
cg.setContext(CodeGenerator::CppPseudoMain);
ar->popScope();
return;
}
} else if (context == CodeGenerator::CppForwardDeclaration &&
cg.getOutput() != CodeGenerator::SystemCPP) {
return;
}
}
if (context == CodeGenerator::CppImplementation) {
printSource(cg);
} else if (context == CodeGenerator::CppForwardDeclaration &&
Option::GenerateCppLibCode) {
cg_printf("\n");
printSource(cg);
cg.printDocComment(funcScope->getDocComment());
}
if (funcScope->isInlined()) cg_printf("inline ");
TypePtr type = funcScope->getReturnType();
if (type) {
type->outputCPPDecl(cg, ar);
} else {
cg_printf("void");
}
funcSection = Option::FunctionSections[origFuncName];
if (!funcSection.empty()) {
cg_printf(" __attribute__ ((section (\".text.%s\")))",
funcSection.c_str());
}
if (pseudoMain) {
cg_printf(" %s%s(", Option::PseudoMainPrefix,
funcScope->getFileScope()->pseudoMainName().c_str());
} else {
cg_printf(" %s%s(", Option::FunctionPrefix, fname.c_str());
}
switch (context) {
case CodeGenerator::CppForwardDeclaration:
funcScope->outputCPPParamsDecl(cg, ar, m_params, true);
cg_printf(");\n");
if (funcScope->hasDirectInvoke()) {
cg_printf("Variant %s%s(void *extra, CArrRef params);\n",
Option::InvokePrefix, fname.c_str());
}
break;
case CodeGenerator::CppDeclaration:
case CodeGenerator::CppImplementation:
case CodeGenerator::CppPseudoMain:
{
//.........这里部分代码省略.........