================ @@ -1516,6 +1516,23 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target, MSGuidTagDecl = buildImplicitRecord("_GUID"); getTranslationUnitDecl()->addDecl(MSGuidTagDecl); } + + // size_t (C99TC3 6.5.3.4), signed size_t (C++23 5.13.2) and + // ptrdiff_t (C99TC3 6.5.6) Although these types are not built-in, they are + // part of the core language and are widely used. + if (!LangOpts.HLSL) { + // Using PredefinedSugarType makes these types as named sugar types rather + // than standard integer types, enabling better hints and diagnostics. + using Kind = PredefinedSugarType::Kind; + SizeType = getPredefinedSugarType(llvm::to_underlying(Kind::SizeT)); + SignedSizeType = + getPredefinedSugarType(llvm::to_underlying(Kind::SignedSizeT)); + PtrdiffType = getPredefinedSugarType(llvm::to_underlying(Kind::PtrdiffT)); + } else { + SizeType = getFromTargetType(Target.getSizeType()); + SignedSizeType = getFromTargetType(Target.getSignedSizeType()); + PtrdiffType = getFromTargetType(Target.getPtrDiffType(LangAS::Default)); + } ---------------- YexuanXiao wrote:
Several HLSL tests failed in earlier commits. I know nothing about HLSL, but as a shader language, HLSL should not benefit from it. https://github.com/llvm/llvm-project/pull/143653 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits