本文整理汇总了C++中FullySpecifiedType::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ FullySpecifiedType::isValid方法的具体用法?C++ FullySpecifiedType::isValid怎么用?C++ FullySpecifiedType::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FullySpecifiedType
的用法示例。
在下文中一共展示了FullySpecifiedType::isValid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visit
void CloneType::visit(NamedType *type)
{
const Name *name = _clone->name(type->name(), _subst);
FullySpecifiedType ty;
if (_subst)
ty = _subst->apply(name);
if (! ty.isValid())
ty = _control->namedType(name);
_type.setType(ty.type());
}
示例2: rewriteDeclaration
/*! Rewrite/format the given type and name. */
QString PointerDeclarationFormatter::rewriteDeclaration(FullySpecifiedType type, const Name *name)
const
{
CHECK_RV(type.isValid(), "Invalid type", QString());
const char *identifier = 0;
if (const Name *declarationName = name) {
if (const Identifier *id = declarationName->identifier())
identifier = id->chars();
}
return m_overview.prettyType(type, QLatin1String(identifier));
}
示例3: builder
QList<Function *> FunctionUtils::overrides(Function *function, Class *functionsClass,
Class *staticClass, const Snapshot &snapshot)
{
QList<Function *> result;
QTC_ASSERT(function && functionsClass && staticClass, return result);
FullySpecifiedType referenceType = function->type();
const Name *referenceName = function->name();
QTC_ASSERT(referenceName && referenceType.isValid(), return result);
// Find overrides
TypeHierarchyBuilder builder(staticClass, snapshot);
const TypeHierarchy &staticClassHierarchy = builder.buildDerivedTypeHierarchy();
QList<TypeHierarchy> l;
if (functionsClass != staticClass)
l.append(TypeHierarchy(functionsClass));
l.append(staticClassHierarchy);
while (!l.isEmpty()) {
// Add derived
const TypeHierarchy hierarchy = l.takeFirst();
QTC_ASSERT(hierarchy.symbol(), continue);
Class *c = hierarchy.symbol()->asClass();
QTC_ASSERT(c, continue);
foreach (const TypeHierarchy &t, hierarchy.hierarchy()) {
if (!l.contains(t))
l << t;
}
// Check member functions
for (int i = 0, total = c->memberCount(); i < total; ++i) {
Symbol *candidate = c->memberAt(i);
const Name *candidateName = candidate->name();
Function *candidateFunc = candidate->type()->asFunctionType();
if (!candidateName || !candidateFunc)
continue;
if (candidateName->match(referenceName)
&& candidateFunc->isSignatureEqualTo(function)) {
result << candidateFunc;
}
}
}
return result;
}
示例4: visit
bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
{
FullySpecifiedType ty = semantic()->check(ast->decl_specifier_seq, _scope);
FullySpecifiedType qualTy = ty.qualifiedType();
Name *name = 0;
FullySpecifiedType funTy = semantic()->check(ast->declarator, qualTy,
_scope, &name);
if (! (funTy && funTy->isFunctionType())) {
translationUnit()->error(ast->firstToken(),
"expected a function prototype");
return false;
}
Function *fun = funTy->asFunctionType();
fun->setVirtual(ty.isVirtual());
fun->setStartOffset(tokenAt(ast->firstToken()).offset);
fun->setEndOffset(tokenAt(ast->lastToken()).offset);
if (ast->declarator)
fun->setSourceLocation(ast->declarator->firstToken());
fun->setName(name);
fun->setTemplateParameters(_templateParameters);
fun->setVisibility(semantic()->currentVisibility());
fun->setMethodKey(semantic()->currentMethodKey());
const bool isQ_SLOT = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SLOT;
const bool isQ_SIGNAL = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SIGNAL;
if (isQ_SIGNAL)
fun->setMethodKey(Function::SignalMethod);
else if (isQ_SLOT)
fun->setMethodKey(Function::SlotMethod);
checkFunctionArguments(fun);
ast->symbol = fun;
_scope->enterSymbol(fun);
if (! semantic()->skipFunctionBodies()) {
if (ast->ctor_initializer) {
bool looksLikeCtor = false;
if (ty.isValid() || ! fun->identity())
looksLikeCtor = false;
else if (fun->identity()->isNameId() || fun->identity()->isTemplateNameId())
looksLikeCtor = true;
if (! looksLikeCtor) {
translationUnit()->error(ast->ctor_initializer->firstToken(),
"only constructors take base initializers");
}
accept(ast->ctor_initializer);
}
const int previousVisibility = semantic()->switchVisibility(Symbol::Public);
const int previousMethodKey = semantic()->switchMethodKey(Function::NormalMethod);
semantic()->check(ast->function_body, fun->members());
semantic()->switchMethodKey(previousMethodKey);
semantic()->switchVisibility(previousVisibility);
}
return false;
}
示例5: noResult
QList<CppQuickFixOperation::Ptr> InsertQtPropertyMembers::match(const CppQuickFixState &state)
{
const QList<AST *> &path = state.path();
if (path.isEmpty())
return noResult();
AST * const ast = path.last();
QtPropertyDeclarationAST *qtPropertyDeclaration = ast->asQtPropertyDeclaration();
if (!qtPropertyDeclaration)
return noResult();
ClassSpecifierAST *klass = 0;
for (int i = path.size() - 2; i >= 0; --i) {
klass = path.at(i)->asClassSpecifier();
if (klass)
break;
}
if (!klass)
return noResult();
CppRefactoringChanges refactoring(state.snapshot());
const CppRefactoringFile &file = refactoring.file(state.document()->fileName());
const QString propertyName = file.textOf(qtPropertyDeclaration->property_name);
QString getterName;
QString setterName;
QString signalName;
int generateFlags = 0;
for (QtPropertyDeclarationItemListAST *it = qtPropertyDeclaration->property_declaration_item_list;
it; it = it->next) {
const QString tokenString = file.tokenAt(it->value->item_name_token).spell();
if (tokenString == QLatin1String("READ")) {
getterName = file.textOf(it->value->expression);
generateFlags |= GenerateGetter;
} else if (tokenString == QLatin1String("WRITE")) {
setterName = file.textOf(it->value->expression);
generateFlags |= GenerateSetter;
} else if (tokenString == QLatin1String("NOTIFY")) {
signalName = file.textOf(it->value->expression);
generateFlags |= GenerateSignal;
}
}
QString storageName = QString("m_%1").arg(propertyName);
generateFlags |= GenerateStorage;
Class *c = klass->symbol;
Overview overview;
for (unsigned i = 0; i < c->memberCount(); ++i) {
Symbol *member = c->memberAt(i);
FullySpecifiedType type = member->type();
if (member->asFunction() || (type.isValid() && type->asFunctionType())) {
const QString name = overview(member->name());
if (name == getterName) {
generateFlags &= ~GenerateGetter;
} else if (name == setterName) {
generateFlags &= ~GenerateSetter;
} else if (name == signalName) {
generateFlags &= ~GenerateSignal;
}
} else if (member->asDeclaration()) {
const QString name = overview(member->name());
if (name == storageName)
generateFlags &= ~GenerateStorage;
}
}
if (getterName.isEmpty() && setterName.isEmpty() && signalName.isEmpty())
return noResult();
return singleResult(new Operation(state, path.size() - 1, qtPropertyDeclaration, c,
generateFlags,
getterName, setterName, signalName, storageName));
}
示例6: hasReturnType
bool Function::hasReturnType() const
{
const FullySpecifiedType ty = returnType();
return ty.isValid() || ty.isSigned() || ty.isUnsigned();
}