本文整理汇总了C++中FunctionScopePtr::isReferenceVariableArgument方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionScopePtr::isReferenceVariableArgument方法的具体用法?C++ FunctionScopePtr::isReferenceVariableArgument怎么用?C++ FunctionScopePtr::isReferenceVariableArgument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionScopePtr
的用法示例。
在下文中一共展示了FunctionScopePtr::isReferenceVariableArgument方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecordFunctionInfo
void FunctionScope::RecordFunctionInfo(std::string fname,
FunctionScopePtr func) {
VariableTablePtr variables = func->getVariables();
if (Option::WholeProgram) {
Lock lock(s_refParamInfoLock);
FunctionInfoPtr &info = s_refParamInfo[fname];
if (!info) {
info = std::make_shared<FunctionInfo>();
}
if (func->isStatic()) {
info->setMaybeStatic();
}
if (func->isRefReturn()) {
info->setMaybeRefReturn();
}
if (func->isReferenceVariableArgument()) {
info->setRefVarArg(func->getMaxParamCount());
}
for (int i = 0; i < func->getMaxParamCount(); i++) {
if (func->isRefParam(i)) info->setRefParam(i);
}
}
auto limit = func->getDeclParamCount();
for (int i = 0; i < limit; i++) {
variables->addParam(func->getParamName(i),
AnalysisResultPtr(), ConstructPtr());
}
}
示例2: matchParams
bool FunctionScope::matchParams(FunctionScopePtr func) {
// leaving them alone for now
if (m_overriding || func->m_overriding) return false;
if (isStatic() || func->isStatic()) return false;
// conservative here, as we could normalize them into same counts.
if (m_minParam != func->m_minParam || m_maxParam != func->m_maxParam) {
return false;
}
if (isVariableArgument() != func->isVariableArgument() ||
isReferenceVariableArgument() != func->isReferenceVariableArgument() ||
isMixedVariableArgument() != func->isMixedVariableArgument()) {
return false;
}
// needs perfect match for ref, hint and defaults
for (int i = 0; i < m_maxParam; i++) {
if (m_refs[i] != func->m_refs[i]) return false;
TypePtr type1 = m_paramTypeSpecs[i];
TypePtr type2 = func->m_paramTypeSpecs[i];
if ((type1 && !type2) || (!type1 && type2) ||
(type1 && type2 && !Type::SameType(type1, type2))) return false;
if (m_paramDefaults[i] != func->m_paramDefaults[i]) return false;
}
return true;
}
示例3: markRefParams
void FunctionCall::markRefParams(FunctionScopePtr func,
const std::string &name,
bool canInvokeFewArgs) {
ExpressionList ¶ms = *m_params;
if (func) {
int mpc = func->getMaxParamCount();
for (int i = params.getCount(); i--; ) {
ExpressionPtr p = params[i];
if (i < mpc ? func->isRefParam(i) :
func->isReferenceVariableArgument()) {
p->setContext(Expression::RefValue);
}
}
} else if (!m_name.empty()) {
FunctionScope::RefParamInfoPtr info =
FunctionScope::GetRefParamInfo(m_name);
if (info) {
for (int i = params.getCount(); i--; ) {
if (info->isRefParam(i)) {
m_params->markParam(i, canInvokeFewArgs);
}
}
}
// If we cannot find information of the so-named function, it might not
// exist, or it might go through __call(), either of which cannot have
// reference parameters.
} else {
for (int i = params.getCount(); i--; ) {
m_params->markParam(i, canInvokeFewArgs);
}
}
}
示例4: markRefParams
void FunctionCall::markRefParams(FunctionScopePtr func,
const std::string &fooBarName) {
ExpressionList ¶ms = *m_params;
if (func) {
int mpc = func->getMaxParamCount();
for (int i = params.getCount(); i--; ) {
ExpressionPtr p = params[i];
if (i < mpc ? func->isRefParam(i) :
func->isReferenceVariableArgument()) {
p->setContext(Expression::RefValue);
} else if (i < mpc && p->hasContext(RefParameter)) {
Symbol *sym = func->getVariables()->addSymbol(func->getParamName(i));
sym->setLvalParam();
sym->setCallTimeRef();
}
}
} else if (Option::WholeProgram && !m_origName.empty()) {
FunctionScope::FunctionInfoPtr info =
FunctionScope::GetFunctionInfo(m_origName);
if (info) {
for (int i = params.getCount(); i--; ) {
if (info->isRefParam(i)) {
m_params->markParam(i);
}
}
}
// If we cannot find information of the so-named function, it might not
// exist, or it might go through __call(), either of which cannot have
// reference parameters.
} else {
for (int i = params.getCount(); i--; ) {
m_params->markParam(i);
}
}
}
示例5: RecordRefParamInfo
void FunctionScope::RecordRefParamInfo(string fname, FunctionScopePtr func) {
RefParamInfoPtr info = s_refParamInfo[fname];
if (!info) {
info = RefParamInfoPtr(new RefParamInfo());
s_refParamInfo[fname] = info;
}
if (func->isReferenceVariableArgument()) {
info->setRefVarArg(func->getMaxParamCount());
}
for (int i = 0; i < func->getMaxParamCount(); i++) {
if (func->isRefParam(i)) info->setRefParam(i);
}
}
示例6: analyzeProgram
void ObjectMethodExpression::analyzeProgram(AnalysisResultPtr ar) {
m_params->analyzeProgram(ar);
m_object->analyzeProgram(ar);
m_nameExp->analyzeProgram(ar);
if (ar->getPhase() == AnalysisResult::AnalyzeAll) {
FunctionScopePtr func = m_funcScope;
if (!func && m_object->isThis() && !m_name.empty()) {
ClassScopePtr cls = ar->getClassScope();
if (cls) {
m_classScope = cls;
m_funcScope = func = cls->findFunction(ar, m_name, true, true);
if (!func) {
cls->addMissingMethod(m_name);
}
}
}
ExpressionList ¶ms = *m_params;
if (func) {
int mpc = func->getMaxParamCount();
for (int i = params.getCount(); i--; ) {
ExpressionPtr p = params[i];
if (i < mpc ? func->isRefParam(i) :
func->isReferenceVariableArgument()) {
p->setContext(Expression::RefValue);
}
}
} else if (!m_name.empty()) {
FunctionScope::RefParamInfoPtr info =
FunctionScope::GetRefParamInfo(m_name);
if (info) {
for (int i = params.getCount(); i--; ) {
if (info->isRefParam(i)) {
m_params->markParam(i, canInvokeFewArgs());
}
}
}
// If we cannot find information of the so-named function, it might not
// exist, or it might go through __call(), either of which cannot have
// reference parameters.
} else {
for (int i = params.getCount(); i--; ) {
m_params->markParam(i, canInvokeFewArgs());
}
}
}
}
示例7: RecordRefParamInfo
void FunctionScope::RecordRefParamInfo(string fname, FunctionScopePtr func) {
RefParamInfoPtr info = s_refParamInfo[fname];
if (!info) {
info = RefParamInfoPtr(new RefParamInfo());
s_refParamInfo[fname] = info;
}
if (func->isReferenceVariableArgument()) {
info->setRefVarArg(func->getMaxParamCount());
}
VariableTablePtr variables = func->getVariables();
for (int i = 0; i < func->getMaxParamCount(); i++) {
if (func->isRefParam(i)) info->setRefParam(i);
variables->addParam(func->getParamName(i),
TypePtr(), AnalysisResultPtr(), ConstructPtr());
}
}