本文整理汇总了C++中AnalysisResultPtr::declareUnknownClass方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisResultPtr::declareUnknownClass方法的具体用法?C++ AnalysisResultPtr::declareUnknownClass怎么用?C++ AnalysisResultPtr::declareUnknownClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnalysisResultPtr
的用法示例。
在下文中一共展示了AnalysisResultPtr::declareUnknownClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collectMethods
void ClassScope::collectMethods(AnalysisResultPtr ar,
StringToFunctionScopePtrMap &funcs,
bool collectPrivate) {
// add all functions this class has
for (FunctionScopePtrVec::const_iterator iter =
m_functionsVec.begin(); iter != m_functionsVec.end(); ++iter) {
const FunctionScopePtr &fs = *iter;
if (!collectPrivate && fs->isPrivate()) continue;
FunctionScopePtr &func = funcs[fs->getScopeName()];
if (!func) {
func = fs;
} else {
func->setVirtual();
fs->setVirtual();
fs->setHasOverride();
if (fs->isFinal()) {
std::string s__MockClass = "__MockClass";
ClassScopePtr derivedClass = func->getContainingClass();
if (derivedClass->m_userAttributes.find(s__MockClass) ==
derivedClass->m_userAttributes.end()) {
Compiler::Error(Compiler::InvalidOverride,
fs->getStmt(), func->getStmt());
}
}
}
}
int n = m_bases.size();
for (int i = 0; i < n; i++) {
const string &base = m_bases[i];
ClassScopePtr super = ar->findClass(base);
if (super) {
if (super->isRedeclaring()) {
const ClassScopePtrVec &classes = ar->findRedeclaredClasses(base);
StringToFunctionScopePtrMap pristine(funcs);
for (auto& cls : classes) {
StringToFunctionScopePtrMap cur(pristine);
derivedMagicMethods(cls);
cls->collectMethods(ar, cur, false);
inheritedMagicMethods(cls);
funcs.insert(cur.begin(), cur.end());
}
m_derivesFromRedeclaring = Derivation::Redeclaring;
setVolatile();
} else {
derivedMagicMethods(super);
super->collectMethods(ar, funcs, false);
inheritedMagicMethods(super);
if (super->derivesFromRedeclaring() == Derivation::Redeclaring) {
m_derivesFromRedeclaring = Derivation::Redeclaring;
setVolatile();
} else if (super->isVolatile()) {
setVolatile();
}
}
} else {
Compiler::Error(Compiler::UnknownBaseClass, m_stmt, base);
if (base == m_parent) {
ar->declareUnknownClass(m_parent);
m_derivesFromRedeclaring = Derivation::Redeclaring;
setVolatile();
} else {
/*
* TODO(#3685260): this should not be removing interfaces from
* the base list.
*/
if (isInterface()) {
m_derivesFromRedeclaring = Derivation::Redeclaring;
}
m_bases.erase(m_bases.begin() + i);
n--;
i--;
}
}
}
}