本文整理汇总了C++中clang::QualType::isIncompleteType方法的典型用法代码示例。如果您正苦于以下问题:C++ QualType::isIncompleteType方法的具体用法?C++ QualType::isIncompleteType怎么用?C++ QualType::isIncompleteType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clang::QualType
的用法示例。
在下文中一共展示了QualType::isIncompleteType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: analyzeResultType
void RSExportReduce::analyzeResultType(StateOfAnalyzeTranslationUnit &S) {
if (!(S.FnAccumulatorOk && S.FnOutConverterOk)) {
// No idea what the result type is
slangAssert(!S.Ok);
return;
}
struct ResultInfoType {
const clang::QualType QType;
clang::VarDecl *const Decl;
const char *FnKey;
const std::string &FnName;
std::function<std::string ()> UnlessOutConverter;
} ResultInfo =
S.FnOutConverter
? ResultInfoType({ S.FnOutConverterParamFirstTy, S.FnOutConverterParamFirst,
KeyOutConverter, mNameOutConverter,
[]() { return std::string(""); }})
: ResultInfoType({ S.FnAccumulatorParamFirstTy, S.FnAccumulatorParamFirst,
KeyAccumulator, mNameAccumulator,
[]() { return std::string(" unless ") + KeyOutConverter + " is provided"; }});
const clang::QualType PointeeQType = ResultInfo.QType->getPointeeType();
if (PointeeQType->isPointerType()) {
S.RSC.ReportError(ResultInfo.Decl->getLocation(),
"%0 parameter '%1' (type '%2') must not point to a pointer%3")
<< S.DiagnosticDescription(ResultInfo.FnKey, ResultInfo.FnName)
<< ResultInfo.Decl->getName() << ResultInfo.QType.getAsString()
<< ResultInfo.UnlessOutConverter();
} else if (PointeeQType->isIncompleteType()) {
S.RSC.ReportError(ResultInfo.Decl->getLocation(),
"%0 parameter '%1' (type '%2') must not point to an incomplete type%3")
<< S.DiagnosticDescription(ResultInfo.FnKey, ResultInfo.FnName)
<< ResultInfo.Decl->getName() << ResultInfo.QType.getAsString()
<< ResultInfo.UnlessOutConverter();
} else if (HasRSObjectType(PointeeQType.getTypePtr())) {
S.RSC.ReportError(ResultInfo.Decl->getLocation(),
"%0 parameter '%1' (type '%2') must not point to data containing an object type%3")
<< S.DiagnosticDescription(ResultInfo.FnKey, ResultInfo.FnName)
<< ResultInfo.Decl->getName() << ResultInfo.QType.getAsString()
<< ResultInfo.UnlessOutConverter();
} else if (RSExportType::ValidateType(&S.RSC, S.ASTC, PointeeQType,
ResultInfo.Decl, ResultInfo.Decl->getLocStart(),
S.RSC.getTargetAPI(),
false /* IsFilterscript */,
true /* IsExtern */)) {
// TODO: Better diagnostics on validation or creation failure?
if ((mResultType = RSExportType::Create(&S.RSC, PointeeQType.getTypePtr(),
NotLegacyKernelArgument, ResultInfo.Decl)) != nullptr) {
const RSExportType *CheckType = mResultType;
const char *ArrayErrorPhrase = "";
if (mResultType->getClass() == RSExportType::ExportClassConstantArray) {
CheckType = static_cast<const RSExportConstantArrayType *>(mResultType)->getElementType();
ArrayErrorPhrase = "n array of";
}
switch (CheckType->getClass()) {
case RSExportType::ExportClassMatrix:
// Not supported for now -- what does a matrix result type mean?
S.RSC.ReportError(ResultInfo.Decl->getLocation(),
"%0 parameter '%1' (type '%2') must not point to a%3 matrix type%4")
<< S.DiagnosticDescription(ResultInfo.FnKey, ResultInfo.FnName)
<< ResultInfo.Decl->getName() << ResultInfo.QType.getAsString()
<< ArrayErrorPhrase
<< ResultInfo.UnlessOutConverter();
mResultType = nullptr;
break;
default:
// All's well
break;
}
}
}
if (mResultType)
S.RSC.insertExportReduceResultType(mResultType);
else
S.Ok = false;
}