本文整理汇总了C++中clang::QualType::isBooleanType方法的典型用法代码示例。如果您正苦于以下问题:C++ QualType::isBooleanType方法的具体用法?C++ QualType::isBooleanType怎么用?C++ QualType::isBooleanType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clang::QualType
的用法示例。
在下文中一共展示了QualType::isBooleanType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: analyzeHalter
// Process "bool haltername(const compType *accum)"
void RSExportReduce::analyzeHalter(StateOfAnalyzeTranslationUnit &S) {
if (!S.FnHalter) // halter is always optional
return;
// Must return bool
const clang::QualType ReturnTy = S.FnHalter->getReturnType().getCanonicalType();
if (!ReturnTy->isBooleanType()) {
S.RSC.ReportError(S.FnHalter->getLocation(),
"%0 must return bool not '%1'")
<< S.DiagnosticDescription(KeyHalter, mNameHalter) << ReturnTy.getAsString();
S.Ok = false;
}
// Must have exactly one parameter
if (S.FnHalter->getNumParams() != 1) {
S.RSC.ReportError(S.FnHalter->getLocation(),
"%0 must take exactly 1 parameter (found %1)")
<< S.DiagnosticDescription(KeyHalter, mNameHalter)
<< S.FnHalter->getNumParams();
S.Ok = false;
return;
}
// Parameter must not be a special parameter
const clang::ParmVarDecl *const FnHalterParam = S.FnHalter->getParamDecl(0);
if (isSpecialKernelParameter(FnHalterParam->getName())) {
S.RSC.ReportError(S.FnHalter->getLocation(),
"%0 cannot take special parameter '%1'")
<< S.DiagnosticDescription(KeyHalter, mNameHalter)
<< FnHalterParam->getName();
S.Ok = false;
return;
}
// Parameter must be same type as first accumulator parameter
if (S.FnAccumulatorParamFirstTy.isNull() || !S.FnAccumulatorParamFirstTy->isPointerType()) {
// We're already in an error situation. We could compare against
// the initializer parameter type or the first combiner parameter
// type instead of the first accumulator parameter type (we'd have
// to check for the availability of a parameter type there, too),
// but it does not seem worth the effort.
slangAssert(!S.Ok);
return;
}
const clang::QualType FnHalterParamTy = FnHalterParam->getType().getCanonicalType();
if (!FnHalterParamTy->isPointerType() ||
!S.FnHalter->getASTContext().hasSameUnqualifiedType(
S.FnAccumulatorParamFirstTy->getPointeeType().getCanonicalType(),
FnHalterParamTy->getPointeeType().getCanonicalType())) {
// <halter> parameter '<baz>' (type '<tbaz>')
// and accumulator <goo>() parameter '<gaz>' (type '<tgaz>') must be pointers to the same type
S.RSC.ReportError(S.FnHalter->getLocation(),
"%0 parameter '%1' (type '%2') and %3 %4() parameter '%5' (type '%6')"
" must be pointers to the same type")
<< S.DiagnosticDescription(KeyHalter, mNameHalter)
<< FnHalterParam->getName() << FnHalterParamTy.getAsString()
<< KeyAccumulator << mNameAccumulator
<< S.FnAccumulatorParamFirst->getName() << S.FnAccumulatorParamFirstTy.getAsString();
S.Ok = false;
return;
}
// Parameter must point to const-qualified
checkPointeeConstQualified(S, FN_IDENT_HALTER, mNameHalter, FnHalterParam, true);
}