github-actions[bot] wrote: <!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning: <details> <summary> You can test this locally with the following command: </summary> ``````````bash git-clang-format --diff bf454839a1b3e8d2177bec386d81a48ca6dc4733 8e6049c04b61a207f9f209a802bf2bd960261885 -- clang/test/Driver/dfp-enablement-lang.c clang/test/Driver/dfp-enablement-target.c clang/test/Sema/dfp-types.c clang/test/SemaCXX/dfp-types.cpp clang/include/clang/AST/ASTContext.h clang/include/clang/AST/Type.h clang/include/clang/Basic/TargetInfo.h clang/include/clang/Basic/TargetOptions.h clang/include/clang/Serialization/ASTBitCodes.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ExprConstant.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/MicrosoftMangle.cpp clang/lib/AST/NSAPI.cpp clang/lib/AST/PrintfFormatString.cpp clang/lib/AST/Type.cpp clang/lib/AST/TypeLoc.cpp clang/lib/Basic/TargetInfo.cpp clang/lib/Basic/Targets.cpp clang/lib/Basic/Targets/OSTargets.h clang/lib/Basic/Targets/X86.h clang/lib/CodeGen/BackendUtil.cpp clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CodeGenTypes.cpp clang/lib/CodeGen/ItaniumCXXABI.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Frontend/CompilerInstance.cpp clang/lib/Frontend/InitPreprocessor.cpp clang/lib/Index/USRGeneration.cpp clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaType.cpp clang/lib/Serialization/ASTCommon.cpp clang/lib/Serialization/ASTReader.cpp clang/test/Sema/types.c clang/tools/libclang/CIndex.cpp llvm/include/llvm-c/Core.h llvm/include/llvm/Bitcode/LLVMBitCodes.h llvm/include/llvm/IR/DataLayout.h llvm/include/llvm/IR/IRBuilder.h llvm/include/llvm/IR/Type.h llvm/include/llvm/Target/TargetOptions.h llvm/lib/AsmParser/LLLexer.cpp llvm/lib/Bitcode/Reader/BitcodeReader.cpp llvm/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/lib/IR/AsmWriter.cpp llvm/lib/IR/Core.cpp llvm/lib/IR/DataLayout.cpp llvm/lib/IR/LLVMContextImpl.cpp llvm/lib/IR/LLVMContextImpl.h llvm/lib/IR/Type.cpp llvm/lib/Target/X86/X86TargetMachine.cpp `````````` </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index f862456797b..eb89c734893 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -197,7 +197,7 @@ class ASTContext : public RefCountedBase<ASTContext> { mutable std::vector<VariableArrayType*> VariableArrayTypes; mutable llvm::FoldingSet<DependentSizedArrayType> DependentSizedArrayTypes; mutable llvm::FoldingSet<DependentSizedExtVectorType> - DependentSizedExtVectorTypes; + DependentSizedExtVectorTypes; mutable llvm::FoldingSet<DependentAddressSpaceType> DependentAddressSpaceTypes; mutable llvm::FoldingSet<VectorType> VectorTypes; diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index 3fcec7b594a..332f83b4542 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -2177,7 +2177,7 @@ public: /// Floating point categories. bool isDecimalFloatingType() const; - // C23 6.2.5p13 (_Decimal32/64/128) + // C23 6.2.5p13 (_Decimal32/64/128) bool isRealFloatingType() const; // C99 6.2.5p10 (float, double, long double) // C23 6.2.5p14 (standard + decimal float) // C23 H.2.4p5 (+interchange +extended FP) @@ -3095,9 +3095,7 @@ public: /// an array with a static size (e.g. int X[static 4]), or an array /// with a star size (e.g. int X[*]). /// 'static' is only allowed on function parameters. - enum ArraySizeModifier { - Normal, Static, Star - }; + enum ArraySizeModifier { Normal, Static, Star }; private: /// The element type of the array. @@ -3431,7 +3429,6 @@ public: QualType ElementType, Expr *SizeExpr); }; - /// Represents a GCC generic vector type. This type is created using /// __attribute__((vector_size(n)), where "n" specifies the vector size in /// bytes; or from an Altivec __vector or vector declaration. @@ -3528,8 +3525,8 @@ class DependentVectorType : public Type, public llvm::FoldingSetNode { SourceLocation Loc; DependentVectorType(const ASTContext &Context, QualType ElementType, - QualType CanonType, Expr *SizeExpr, - SourceLocation Loc, VectorType::VectorKind vecKind); + QualType CanonType, Expr *SizeExpr, SourceLocation Loc, + VectorType::VectorKind vecKind); public: Expr *getSizeExpr() const { return SizeExpr; } @@ -4758,8 +4755,8 @@ public: /// This class is used internally by the ASTContext to manage /// canonical, dependent types, only. Clients will only see instances /// of this class via TypeOfExprType nodes. -class DependentTypeOfExprType - : public TypeOfExprType, public llvm::FoldingSetNode { +class DependentTypeOfExprType : public TypeOfExprType, + public llvm::FoldingSetNode { const ASTContext &Context; public: @@ -5479,9 +5476,8 @@ public: /// TemplateArguments, followed by a QualType representing the /// non-canonical aliased type when the template is a type alias /// template. -class alignas(8) TemplateSpecializationType - : public Type, - public llvm::FoldingSetNode { +class alignas(8) TemplateSpecializationType : public Type, + public llvm::FoldingSetNode { friend class ASTContext; // ASTContext creates these /// The name of the template being specialized. This is diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h index c66680d0fe0..a03cf57b1dc 100644 --- a/clang/include/clang/Basic/TargetInfo.h +++ b/clang/include/clang/Basic/TargetInfo.h @@ -225,8 +225,8 @@ enum OpenCLTypeKind : uint8_t { // have been defined for use on various platforms. This enumeration provides // an enumerator for each known encoding. enum class DecimalFloatMode : uint8_t { - BID, // Binary Integer Decimal. - DPD, // Densely Packed Decimal. + BID, // Binary Integer Decimal. + DPD, // Densely Packed Decimal. }; /// Exposes information about the current target. diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 0aef78b6854..e42d82e9878 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -174,8 +174,7 @@ static SourceLocation getDeclLocForCommentSearch(const Decl *D, // For all other declarations multiple declarators are used quite frequently, // so we use the location of the identifier as the "declaration location". if (isa<ObjCMethodDecl>(D) || isa<ObjCContainerDecl>(D) || - isa<ObjCPropertyDecl>(D) || - isa<RedeclarableTemplateDecl>(D) || + isa<ObjCPropertyDecl>(D) || isa<RedeclarableTemplateDecl>(D) || isa<ClassTemplateSpecializationDecl>(D) || // Allow association with Y across {} in `typedef struct X {} Y`. isa<TypedefDecl>(D)) @@ -1699,15 +1698,13 @@ CharUnits ASTContext::getDeclAlign(const Decl *D, bool ForAlignof) const { // ignore that possibility; Sema should diagnose it. if (isa<FieldDecl>(D)) { UseAlignAttrOnly = D->hasAttr<PackedAttr>() || - cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>(); + cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>(); } else { UseAlignAttrOnly = true; } - } - else if (isa<FieldDecl>(D)) - UseAlignAttrOnly = - D->hasAttr<PackedAttr>() || - cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>(); + } else if (isa<FieldDecl>(D)) + UseAlignAttrOnly = D->hasAttr<PackedAttr>() || + cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>(); // If we're using the align attribute only, just ignore everything // else about the declaration and its type. @@ -3485,8 +3482,8 @@ ASTContext::getLValueReferenceType(QualType T, bool SpelledAsLValue) const { assert(!NewIP && "Shouldn't be in the map!"); (void)NewIP; } - auto *New = new (*this, TypeAlignment) LValueReferenceType(T, Canonical, - SpelledAsLValue); + auto *New = new (*this, TypeAlignment) + LValueReferenceType(T, Canonical, SpelledAsLValue); Types.push_back(New); LValueReferenceTypes.InsertNode(New, InsertPos); @@ -3732,12 +3729,10 @@ QualType ASTContext::getVariableArrayDecayedType(QualType type) const { // Turn incomplete types into [*] types. case Type::IncompleteArray: { const auto *iat = cast<IncompleteArrayType>(ty); - result = getVariableArrayType( - getVariableArrayDecayedType(iat->getElementType()), - /*size*/ nullptr, - ArrayType::Normal, - iat->getIndexTypeCVRQualifiers(), - SourceRange()); + result = + getVariableArrayType(getVariableArrayDecayedType(iat->getElementType()), + /*size*/ nullptr, ArrayType::Normal, + iat->getIndexTypeCVRQualifiers(), SourceRange()); break; } @@ -3745,11 +3740,9 @@ QualType ASTContext::getVariableArrayDecayedType(QualType type) const { case Type::VariableArray: { const auto *vat = cast<VariableArrayType>(ty); result = getVariableArrayType( - getVariableArrayDecayedType(vat->getElementType()), - /*size*/ nullptr, - ArrayType::Star, - vat->getIndexTypeCVRQualifiers(), - vat->getBracketsRange()); + getVariableArrayDecayedType(vat->getElementType()), + /*size*/ nullptr, ArrayType::Star, vat->getIndexTypeCVRQualifiers(), + vat->getBracketsRange()); break; } } @@ -3760,8 +3753,7 @@ QualType ASTContext::getVariableArrayDecayedType(QualType type) const { /// getVariableArrayType - Returns a non-unique reference to the type for a /// variable array of the specified element type. -QualType ASTContext::getVariableArrayType(QualType EltTy, - Expr *NumElts, +QualType ASTContext::getVariableArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const { @@ -3779,7 +3771,7 @@ QualType ASTContext::getVariableArrayType(QualType EltTy, } auto *New = new (*this, TypeAlignment) - VariableArrayType(EltTy, Canon, NumElts, ASM, IndexTypeQuals, Brackets); + VariableArrayType(EltTy, Canon, NumElts, ASM, IndexTypeQuals, Brackets); VariableArrayTypes.push_back(New); Types.push_back(New); @@ -3789,11 +3781,9 @@ QualType ASTContext::getVariableArrayType(QualType EltTy, /// getDependentSizedArrayType - Returns a non-unique reference to /// the type for a dependently-sized array of the specified element /// type. -QualType ASTContext::getDependentSizedArrayType(QualType elementType, - Expr *numElements, - ArrayType::ArraySizeModifier ASM, - unsigned elementTypeQuals, - SourceRange brackets) const { +QualType ASTContext::getDependentSizedArrayType( + QualType elementType, Expr *numElements, ArrayType::ArraySizeModifier ASM, + unsigned elementTypeQuals, SourceRange brackets) const { assert((!numElements || numElements->isTypeDependent() || numElements->isValueDependent()) && "Size must be type- or value-dependent!"); @@ -3803,11 +3793,9 @@ QualType ASTContext::getDependentSizedArrayType(QualType elementType, // initializer. We do no canonicalization here at all, which is okay // because they can't be used in most locations. if (!numElements) { - auto *newType - = new (*this, TypeAlignment) - DependentSizedArrayType(*this, elementType, QualType(), - numElements, ASM, elementTypeQuals, - brackets); + auto *newType = new (*this, TypeAlignment) + DependentSizedArrayType(*this, elementType, QualType(), numElements, + ASM, elementTypeQuals, brackets); Types.push_back(newType); return QualType(newType, 0); } @@ -3829,10 +3817,9 @@ QualType ASTContext::getDependentSizedArrayType(QualType elementType, // If we don't have one, build one. if (!canonTy) { - canonTy = new (*this, TypeAlignment) - DependentSizedArrayType(*this, QualType(canonElementType.Ty, 0), - QualType(), numElements, ASM, elementTypeQuals, - brackets); + canonTy = new (*this, TypeAlignment) DependentSizedArrayType( + *this, QualType(canonElementType.Ty, 0), QualType(), numElements, ASM, + elementTypeQuals, brackets); DependentSizedArrayTypes.InsertNode(canonTy, insertPos); Types.push_back(canonTy); } @@ -3849,10 +3836,8 @@ QualType ASTContext::getDependentSizedArrayType(QualType elementType, // Otherwise, we need to build a type which follows the spelling // of the element type. - auto *sugaredType - = new (*this, TypeAlignment) - DependentSizedArrayType(*this, elementType, canon, numElements, - ASM, elementTypeQuals, brackets); + auto *sugaredType = new (*this, TypeAlignment) DependentSizedArrayType( + *this, elementType, canon, numElements, ASM, elementTypeQuals, brackets); Types.push_back(sugaredType); return QualType(sugaredType, 0); } @@ -3887,7 +3872,7 @@ QualType ASTContext::getIncompleteArrayType(QualType elementType, } auto *newType = new (*this, TypeAlignment) - IncompleteArrayType(elementType, canon, ASM, elementTypeQuals); + IncompleteArrayType(elementType, canon, ASM, elementTypeQuals); IncompleteArrayTypes.InsertNode(newType, insertPos); Types.push_back(newType); @@ -4108,7 +4093,7 @@ QualType ASTContext::getVectorType(QualType vecType, unsigned NumElts, assert(!NewIP && "Shouldn't be in the map!"); (void)NewIP; } auto *New = new (*this, TypeAlignment) - VectorType(vecType, NumElts, Canonical, VecKind); + VectorType(vecType, NumElts, Canonical, VecKind); VectorTypes.InsertNode(New, InsertPos); Types.push_back(New); return QualType(New, 0); @@ -4181,8 +4166,8 @@ QualType ASTContext::getExtVectorType(QualType vecType, VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos); assert(!NewIP && "Shouldn't be in the map!"); (void)NewIP; } - auto *New = new (*this, TypeAlignment) - ExtVectorType(vecType, NumElts, Canonical); + auto *New = + new (*this, TypeAlignment) ExtVectorType(vecType, NumElts, Canonical); VectorTypes.InsertNode(New, InsertPos); Types.push_back(New); return QualType(New, 0); @@ -4203,15 +4188,13 @@ ASTContext::getDependentSizedExtVectorType(QualType vecType, if (Canon) { // We already have a canonical version of this array type; use it as // the canonical type for a newly-built type. - New = new (*this, TypeAlignment) - DependentSizedExtVectorType(*this, vecType, QualType(Canon, 0), - SizeExpr, AttrLoc); + New = new (*this, TypeAlignment) DependentSizedExtVectorType( + *this, vecType, QualType(Canon, 0), SizeExpr, AttrLoc); } else { QualType CanonVecTy = getCanonicalType(vecType); if (CanonVecTy == vecType) { - New = new (*this, TypeAlignment) - DependentSizedExtVectorType(*this, vecType, QualType(), SizeExpr, - AttrLoc); + New = new (*this, TypeAlignment) DependentSizedExtVectorType( + *this, vecType, QualType(), SizeExpr, AttrLoc); DependentSizedExtVectorType *CanonCheck = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos); @@ -4318,9 +4301,8 @@ QualType ASTContext::getDependentAddressSpaceType(QualType PointeeType, DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos); if (!canonTy) { - canonTy = new (*this, TypeAlignment) - DependentAddressSpaceType(*this, canonPointeeType, - QualType(), AddrSpaceExpr, AttrLoc); + canonTy = new (*this, TypeAlignment) DependentAddressSpaceType( + *this, canonPointeeType, QualType(), AddrSpaceExpr, AttrLoc); DependentAddressSpaceTypes.InsertNode(canonTy, insertPos); Types.push_back(canonTy); } @@ -4329,10 +4311,8 @@ QualType ASTContext::getDependentAddressSpaceType(QualType PointeeType, canonTy->getAddrSpaceExpr() == AddrSpaceExpr) return QualType(canonTy, 0); - auto *sugaredType - = new (*this, TypeAlignment) - DependentAddressSpaceType(*this, PointeeType, QualType(canonTy, 0), - AddrSpaceExpr, AttrLoc); + auto *sugaredType = new (*this, TypeAlignment) DependentAddressSpaceType( + *this, PointeeType, QualType(canonTy, 0), AddrSpaceExpr, AttrLoc); Types.push_back(sugaredType); return QualType(sugaredType, 0); } @@ -4376,8 +4356,8 @@ ASTContext::getFunctionNoProtoType(QualType ResultTy, assert(!NewIP && "Shouldn't be in the map!"); (void)NewIP; } - auto *New = new (*this, TypeAlignment) - FunctionNoProtoType(ResultTy, Canonical, Info); + auto *New = + new (*this, TypeAlignment) FunctionNoProtoType(ResultTy, Canonical, Info); Types.push_back(New); FunctionNoProtoTypes.InsertNode(New, InsertPos); return QualType(New, 0); @@ -4669,8 +4649,7 @@ QualType ASTContext::getInjectedClassNameType(CXXRecordDecl *Decl, Decl->TypeForDecl = PrevDecl->TypeForDecl; assert(isa<InjectedClassNameType>(Decl->TypeForDecl)); } else { - Type *newType = - new (*this, TypeAlignment) InjectedClassNameType(Decl, TST); + Type *newType = new (*this, TypeAlignment) InjectedClassNameType(Decl, TST); Decl->TypeForDecl = newType; Types.push_back(newType); } @@ -4936,7 +4915,7 @@ QualType ASTContext::getTemplateTypeParmType(unsigned Depth, unsigned Index, (void)TypeCheck; } else TypeParm = new (*this, TypeAlignment) - TemplateTypeParmType(Depth, Index, ParameterPack); + TemplateTypeParmType(Depth, Index, ParameterPack); Types.push_back(TypeParm); TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos); @@ -5019,8 +4998,8 @@ ASTContext::getTemplateSpecializationType(TemplateName Template, // try to unique it: these types typically have location information that // we don't unique and don't want to lose. void *Mem = Allocate(sizeof(TemplateSpecializationType) + - sizeof(TemplateArgument) * Args.size() + - (IsTypeAlias? sizeof(QualType) : 0), + sizeof(TemplateArgument) * Args.size() + + (IsTypeAlias ? sizeof(QualType) : 0), TypeAlignment); auto *Spec = new (Mem) TemplateSpecializationType(Template, Args, CanonType, @@ -5092,8 +5071,9 @@ QualType ASTContext::getElaboratedType(ElaboratedTypeKeyword Keyword, (void)CheckT; } - void *Mem = Allocate(ElaboratedType::totalSizeToAlloc<TagDecl *>(!!OwnedTagDecl), - TypeAlignment); + void *Mem = + Allocate(ElaboratedType::totalSizeToAlloc<TagDecl *>(!!OwnedTagDecl), + TypeAlignment); T = new (Mem) ElaboratedType(Keyword, NNS, NamedType, Canon, OwnedTagDecl); Types.push_back(T); @@ -5195,7 +5175,8 @@ ASTContext::getDependentTemplateSpecializationType( NestedNameSpecifier *CanonNNS = getCanonicalNestedNameSpecifier(NNS); ElaboratedTypeKeyword CanonKeyword = Keyword; - if (Keyword == ETK_None) CanonKeyword = ETK_Typename; + if (Keyword == ETK_None) + CanonKeyword = ETK_Typename; bool AnyNonCanonArgs = false; auto CanonArgs = @@ -5699,8 +5680,7 @@ QualType ASTContext::getTypeOfExprType(Expr *tofExpr, TypeOfKind Kind) const { /// on canonical types (which are always unique). QualType ASTContext::getTypeOfType(QualType tofType, TypeOfKind Kind) const { QualType Canonical = getCanonicalType(tofType); - auto *tot = - new (*this, TypeAlignment) TypeOfType(tofType, Canonical, Kind); + auto *tot = new (*this, TypeAlignment) TypeOfType(tofType, Canonical, Kind); Types.push_back(tot); return QualType(tot, 0); } @@ -5781,18 +5761,15 @@ QualType ASTContext::getUnaryTransformType(QualType BaseType, if (!Canon) { // Build a new, canonical __underlying_type(type) type. Canon = new (*this, TypeAlignment) - DependentUnaryTransformType(*this, getCanonicalType(BaseType), - Kind); + DependentUnaryTransformType(*this, getCanonicalType(BaseType), Kind); DependentUnaryTransformTypes.InsertNode(Canon, InsertPos); } - ut = new (*this, TypeAlignment) UnaryTransformType (BaseType, - QualType(), Kind, - QualType(Canon, 0)); + ut = new (*this, TypeAlignment) + UnaryTransformType(BaseType, QualType(), Kind, QualType(Canon, 0)); } else { QualType CanonType = getCanonicalType(UnderlyingType); - ut = new (*this, TypeAlignment) UnaryTransformType (BaseType, - UnderlyingType, Kind, - CanonType); + ut = new (*this, TypeAlignment) + UnaryTransformType(BaseType, UnderlyingType, Kind, CanonType); } Types.push_back(ut); return QualType(ut, 0); @@ -8924,9 +8901,8 @@ static TypedefDecl *CreatePowerABIBuiltinVaListDecl(const ASTContext *Context) { // typedef __va_list_tag __builtin_va_list[1]; llvm::APInt Size(Context->getTypeSize(Context->getSizeType()), 1); - QualType VaListTagArrayType - = Context->getConstantArrayType(VaListTagTypedefType, - Size, nullptr, ArrayType::Normal, 0); + QualType VaListTagArrayType = Context->getConstantArrayType( + VaListTagTypedefType, Size, nullptr, ArrayType::Normal, 0); return Context->buildImplicitTypedef(VaListTagArrayType, "__builtin_va_list"); } @@ -10855,8 +10831,8 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS, bool OfBlockPointer, } if (getCanonicalType(LHSElem) == getCanonicalType(ResultType)) return LHS; if (getCanonicalType(RHSElem) == getCanonicalType(ResultType)) return RHS; - return getIncompleteArrayType(ResultType, - ArrayType::ArraySizeModifier(), 0); + return getIncompleteArrayType(ResultType, ArrayType::ArraySizeModifier(), + 0); } case Type::FunctionNoProto: return mergeFunctionTypes(LHS, RHS, OfBlockPointer, Unqualified, diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index b048ef1c2c4..8a436f9d640 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -2767,9 +2767,9 @@ static bool EvalAndBitcastToAPInt(EvalInfo &Info, const Expr *E, } unsigned BaseEltSize = EltAsInt.getBitWidth(); if (BigEndian) - Res |= EltAsInt.zextOrTrunc(VecSize).rotr(i*EltSize+BaseEltSize); + Res |= EltAsInt.zextOrTrunc(VecSize).rotr(i * EltSize + BaseEltSize); else - Res |= EltAsInt.zextOrTrunc(VecSize).rotl(i*EltSize); + Res |= EltAsInt.zextOrTrunc(VecSize).rotl(i * EltSize); } return true; } @@ -3227,8 +3227,8 @@ static bool HandleLValueIndirectMember(EvalInfo &Info, const Expr *E, } /// Get the size of the given type in char units. -static bool HandleSizeof(EvalInfo &Info, SourceLocation Loc, - QualType Type, CharUnits &Size) { +static bool HandleSizeof(EvalInfo &Info, SourceLocation Loc, QualType Type, + CharUnits &Size) { // sizeof(void), __alignof__(void), sizeof(function) = 1 as a gcc // extension. if (Type->isVoidType() || Type->isFunctionType()) { @@ -10537,9 +10537,9 @@ bool VectorExprEvaluator::VisitCastExpr(const CastExpr *E) { for (unsigned i = 0; i < NElts; i++) { llvm::APInt Elt; if (BigEndian) - Elt = SValInt.rotl(i*EltSize+EltSize).zextOrTrunc(EltSize); + Elt = SValInt.rotl(i * EltSize + EltSize).zextOrTrunc(EltSize); else - Elt = SValInt.rotr(i*EltSize).zextOrTrunc(EltSize); + Elt = SValInt.rotr(i * EltSize).zextOrTrunc(EltSize); Elts.push_back(APValue(APSInt(Elt, !EltTy->isSignedIntegerType()))); } } else { @@ -11393,8 +11393,8 @@ enum class GCCTypeClass { /// EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way /// as GCC. -static GCCTypeClass -EvaluateBuiltinClassifyType(QualType T, const LangOptions &LangOpts) { +static GCCTypeClass EvaluateBuiltinClassifyType(QualType T, + const LangOptions &LangOpts) { assert(!T->isDependentType() && "unexpected dependent type"); QualType CanTy = T.getCanonicalType(); @@ -11416,8 +11416,9 @@ EvaluateBuiltinClassifyType(QualType T, const LangOptions &LangOpts) { case BuiltinType::ID: return GCCTypeClass::Integer; #define FLOATING_TYPE(ID, SINGLETON_ID) \ case BuiltinType::ID: return GCCTypeClass::RealFloat; -#define DECIMAL_FLOATING_TYPE(ID, SINGLETON_ID) \ - case BuiltinType::ID: return GCCTypeClass::RealFloat; +#define DECIMAL_FLOATING_TYPE(ID, SINGLETON_ID) \ + case BuiltinType::ID: \ + return GCCTypeClass::RealFloat; #define PLACEHOLDER_TYPE(ID, SINGLETON_ID) \ case BuiltinType::ID: break; #include "clang/AST/BuiltinTypes.def" @@ -13564,11 +13565,11 @@ bool IntExprEvaluator::VisitUnaryExprOrTypeTraitExpr( } case UETT_OpenMPRequiredSimdAlign: assert(E->isArgumentType()); - return Success( - Info.Ctx.toCharUnitsFromBits( - Info.Ctx.getOpenMPDefaultSimdAlign(E->getArgumentType())) - .getQuantity(), - E); + return Success(Info.Ctx + .toCharUnitsFromBits(Info.Ctx.getOpenMPDefaultSimdAlign( + E->getArgumentType())) + .getQuantity(), + E); } llvm_unreachable("unknown expr/type trait"); diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 7641f44d722..f56fa859bd6 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -2947,7 +2947,8 @@ void CXXNameMangler::mangleType(const BuiltinType *T) { // UNSUPPORTED: ::= De # IEEE 754r decimal floating point (128 bits) // UNSUPPORTED: ::= Df # IEEE 754r decimal floating point (32 bits) // ::= Dh # IEEE 754r half-precision floating point (16 bits) - // ::= DF <number> _ # ISO/IEC TS 18661 binary floating point type _FloatN (N bits); + // ::= DF <number> _ # ISO/IEC TS 18661 binary floating point + // type _FloatN (N bits); // ::= Di # char32_t // ::= Ds # char16_t // ::= Dn # std::nullptr_t (i.e., decltype(nullptr)) @@ -4103,20 +4104,20 @@ void CXXNameMangler::mangleType(const DependentNameType *T) { // ::= Te <name> # dependent elaborated type specifier using // # 'enum' switch (T->getKeyword()) { - case ETK_None: - case ETK_Typename: - break; - case ETK_Struct: - case ETK_Class: - case ETK_Interface: - Out << "Ts"; - break; - case ETK_Union: - Out << "Tu"; - break; - case ETK_Enum: - Out << "Te"; - break; + case ETK_None: + case ETK_Typename: + break; + case ETK_Struct: + case ETK_Class: + case ETK_Interface: + Out << "Ts"; + break; + case ETK_Union: + Out << "Tu"; + break; + case ETK_Enum: + Out << "Te"; + break; } // Typename types are always nested Out << 'N'; @@ -5527,7 +5528,7 @@ struct TemplateArgManglingInfo { return NTTP && NTTP->getType()->getContainedDeducedType(); } }; -} +} // namespace void CXXNameMangler::mangleTemplateArgs(TemplateName TN, const TemplateArgumentLoc *TemplateArgs, diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 0e68e6acf62..ddbecc6afda 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -540,8 +540,7 @@ bool MicrosoftMangleContextImpl::shouldMangleCXXName(const NamedDecl *D) { DC = getEffectiveParentContext(DC); if (DC->isTranslationUnit() && D->getFormalLinkage() == InternalLinkage && - !isa<VarTemplateSpecializationDecl>(D) && - D->getIdentifier() != nullptr) + !isa<VarTemplateSpecializationDecl>(D) && D->getIdentifier() != nullptr) return false; } @@ -1314,8 +1313,8 @@ void MicrosoftCXXNameMangler::mangleNestedName(GlobalDecl GD) { Out << 'E'; Out << 'A'; mangleArtificialTagType(TTK_Struct, - Discriminate("__block_literal", Discriminator, - ParameterDiscriminator)); + Discriminate("__block_literal", Discriminator, + ParameterDiscriminator)); Out << "@Z"; // If the effective context was a Record, we have fully mangled the @@ -2524,9 +2523,9 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T, Qualifiers, Out << "PA"; mangleArtificialTagType(TTK_Struct, "ocl_reserveid"); break; -#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ - case BuiltinType::Id: \ - mangleArtificialTagType(TTK_Struct, "ocl_" #ExtType); \ +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ + case BuiltinType::Id: \ + mangleArtificialTagType(TTK_Struct, "ocl_" #ExtType); \ break; #include "clang/Basic/OpenCLExtensionTypes.def" @@ -2920,19 +2919,19 @@ void MicrosoftCXXNameMangler::mangleType(const UnresolvedUsingType *T, // <enum-type> ::= W4 <name> void MicrosoftCXXNameMangler::mangleTagTypeKind(TagTypeKind TTK) { switch (TTK) { - case TTK_Union: - Out << 'T'; - break; - case TTK_Struct: - case TTK_Interface: - Out << 'U'; - break; - case TTK_Class: - Out << 'V'; - break; - case TTK_Enum: - Out << "W4"; - break; + case TTK_Union: + Out << 'T'; + break; + case TTK_Struct: + case TTK_Interface: + Out << 'U'; + break; + case TTK_Class: + Out << 'V'; + break; + case TTK_Enum: + Out << "W4"; + break; } } void MicrosoftCXXNameMangler::mangleType(const EnumType *T, Qualifiers, @@ -3186,7 +3185,8 @@ void MicrosoftCXXNameMangler::mangleType(const VectorType *T, Qualifiers Quals, else if (ET->getKind() == BuiltinType::LongLong) mangleArtificialTagType(TTK_Union, "__m" + llvm::utostr(Width) + 'i'); else if (ET->getKind() == BuiltinType::Double) - mangleArtificialTagType(TTK_Struct, "__m" + llvm::utostr(Width) + 'd'); + mangleArtificialTagType(TTK_Struct, + "__m" + llvm::utostr(Width) + 'd'); } } } diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 26d813b160b..ae21c882c26 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -230,8 +230,8 @@ DependentSizedArrayType::DependentSizedArrayType(const ASTContext &Context, Expr *e, ArraySizeModifier sm, unsigned tq, SourceRange brackets) - : ArrayType(DependentSizedArray, et, can, sm, tq, e), - Context(Context), SizeExpr((Stmt*) e), Brackets(brackets) {} + : ArrayType(DependentSizedArray, et, can, sm, tq, e), Context(Context), + SizeExpr((Stmt *)e), Brackets(brackets) {} void DependentSizedArrayType::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, @@ -2481,9 +2481,10 @@ QualType Type::getSveEltType(const ASTContext &Ctx) const { bool Type::isRVVVLSBuiltinType() const { if (const BuiltinType *BT = getAs<BuiltinType>()) { switch (BT->getKind()) { -#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, IsFP) \ - case BuiltinType::Id: \ - return NF == 1; +#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \ + IsFP) \ + case BuiltinType::Id: \ + return NF == 1; #include "clang/Basic/RISCVVTypes.def" default: return false; @@ -3019,24 +3020,36 @@ bool Type::isSpecifierType() const { ElaboratedTypeKeyword TypeWithKeyword::getKeywordForTypeSpec(unsigned TypeSpec) { switch (TypeSpec) { - default: return ETK_None; - case TST_typename: return ETK_Typename; - case TST_class: return ETK_Class; - case TST_struct: return ETK_Struct; - case TST_interface: return ETK_Interface; - case TST_union: return ETK_Union; - case TST_enum: return ETK_Enum; + default: + return ETK_None; + case TST_typename: + return ETK_Typename; + case TST_class: + return ETK_Class; + case TST_struct: + return ETK_Struct; + case TST_interface: + return ETK_Interface; + case TST_union: + return ETK_Union; + case TST_enum: + return ETK_Enum; } } TagTypeKind TypeWithKeyword::getTagTypeKindForTypeSpec(unsigned TypeSpec) { switch(TypeSpec) { - case TST_class: return TTK_Class; - case TST_struct: return TTK_Struct; - case TST_interface: return TTK_Interface; - case TST_union: return TTK_Union; - case TST_enum: return TTK_Enum; + case TST_class: + return TTK_Class; + case TST_struct: + return TTK_Struct; + case TST_interface: + return TTK_Interface; + case TST_union: + return TTK_Union; + case TST_enum: + return TTK_Enum; } llvm_unreachable("Type specifier is not a tag type kind."); @@ -3045,11 +3058,16 @@ TypeWithKeyword::getTagTypeKindForTypeSpec(unsigned TypeSpec) { ElaboratedTypeKeyword TypeWithKeyword::getKeywordForTagTypeKind(TagTypeKind Kind) { switch (Kind) { - case TTK_Class: return ETK_Class; - case TTK_Struct: return ETK_Struct; - case TTK_Interface: return ETK_Interface; - case TTK_Union: return ETK_Union; - case TTK_Enum: return ETK_Enum; + case TTK_Class: + return ETK_Class; + case TTK_Struct: + return ETK_Struct; + case TTK_Interface: + return ETK_Interface; + case TTK_Union: + return ETK_Union; + case TTK_Enum: + return ETK_Enum; } llvm_unreachable("Unknown tag type kind."); } @@ -3057,11 +3075,16 @@ TypeWithKeyword::getKeywordForTagTypeKind(TagTypeKind Kind) { TagTypeKind TypeWithKeyword::getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword) { switch (Keyword) { - case ETK_Class: return TTK_Class; - case ETK_Struct: return TTK_Struct; - case ETK_Interface: return TTK_Interface; - case ETK_Union: return TTK_Union; - case ETK_Enum: return TTK_Enum; + case ETK_Class: + return TTK_Class; + case ETK_Struct: + return TTK_Struct; + case ETK_Interface: + return TTK_Interface; + case ETK_Union: + return TTK_Union; + case ETK_Enum: + return TTK_Enum; case ETK_None: // Fall through. case ETK_Typename: llvm_unreachable("Elaborated type keyword is not a tag type kind."); @@ -3087,13 +3110,20 @@ TypeWithKeyword::KeywordIsTagTypeKind(ElaboratedTypeKeyword Keyword) { StringRef TypeWithKeyword::getKeywordName(ElaboratedTypeKeyword Keyword) { switch (Keyword) { - case ETK_None: return {}; - case ETK_Typename: return "typename"; - case ETK_Class: return "class"; - case ETK_Struct: return "struct"; - case ETK_Interface: return "__interface"; - case ETK_Union: return "union"; - case ETK_Enum: return "enum"; + case ETK_None: + return {}; + case ETK_Typename: + return "typename"; + case ETK_Class: + return "class"; + case ETK_Struct: + return "struct"; + case ETK_Interface: + return "__interface"; + case ETK_Union: + return "union"; + case ETK_Enum: + return "enum"; } llvm_unreachable("Unknown elaborated type keyword."); @@ -3385,7 +3415,8 @@ StringRef FunctionType::getNameForCallConv(CallingConv CC) { case CC_Swift: return "swiftcall"; case CC_SwiftAsync: return "swiftasynccall"; case CC_PreserveMost: return "preserve_most"; - case CC_PreserveAll: return "preserve_all"; + case CC_PreserveAll: + return "preserve_all"; } llvm_unreachable("Invalid calling convention."); diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index 70b265ddda3..edfb0b9b6cd 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -543,7 +543,8 @@ public: SizeType = UnsignedLong; IntPtrType = SignedLong; resetDataLayout("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-" - "f80:128-n8:16:32-S128", "_"); + "f80:128-n8:16:32-S128", + "_"); HasAlignMac68kSupport = true; } @@ -725,28 +726,29 @@ public: Opts.DFPEncoding == TargetOptions::TODFPBinaryEncodingKind::DPD; if (isBIDEncoding) - resetDataLayout(IsX32 ? "e-d:-bid-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-" - "i64:64-f80:128-n8:16:32:64-S128" - : IsWinCOFF ? "e-d:bid-m:w-p270:32:32-p271:32:32-p272:64:" - "64-i64:64-f80:128-n8:16:32:64-S128" - : "e-d:bid-m:e-p270:32:32-p271:32:32-p272:64:" - "64-i64:64-f80:128-n8:16:32:64-S128"); + resetDataLayout( + IsX32 ? "e-d:-bid-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-" + "i64:64-f80:128-n8:16:32:64-S128" + : IsWinCOFF ? "e-d:bid-m:w-p270:32:32-p271:32:32-p272:64:" + "64-i64:64-f80:128-n8:16:32:64-S128" + : "e-d:bid-m:e-p270:32:32-p271:32:32-p272:64:" + "64-i64:64-f80:128-n8:16:32:64-S128"); else if (isDPDEncoding) resetDataLayout( - IsX32 ? "e-d:dpd-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-" - "i64:64-f80:128-n8:16:32:64-S128" + IsX32 ? "e-d:dpd-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-" + "i64:64-f80:128-n8:16:32:64-S128" : IsWinCOFF ? "e-d:dpd-m:w-p270:32:32-p271:32:32-p272:64:" "64-i64:64-f80:128-n8:16:32:64-S128" : "e-d:dpd-m:e-p270:32:32-p271:32:32-p272:64:" "64-i64:64-f80:128-n8:16:32:64-S128"); else - // Pointers are 32-bit in x32. - resetDataLayout(IsX32 ? "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-" - "i64:64-f80:128-n8:16:32:64-S128" - : IsWinCOFF ? "e-m:w-p270:32:32-p271:32:32-p272:64:" - "64-i64:64-f80:128-n8:16:32:64-S128" - : "e-m:e-p270:32:32-p271:32:32-p272:64:" - "64-i64:64-f80:128-n8:16:32:64-S128"); + // Pointers are 32-bit in x32. + resetDataLayout(IsX32 ? "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-" + "i64:64-f80:128-n8:16:32:64-S128" + : IsWinCOFF ? "e-m:w-p270:32:32-p271:32:32-p272:64:" + "64-i64:64-f80:128-n8:16:32:64-S128" + : "e-m:e-p270:32:32-p271:32:32-p272:64:" + "64-i64:64-f80:128-n8:16:32:64-S128"); // Use fpret only for long double. RealTypeUsesObjCFPRetMask = (unsigned)FloatModeKind::LongDouble; @@ -944,7 +946,8 @@ public: if (T.isiOS()) UseSignedCharForObjCBool = false; resetDataLayout("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:" - "16:32:64-S128", "_"); + "16:32:64-S128", + "_"); } bool handleTargetFeatures(std::vector<std::string> &Features, diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index 797103257ed..8985b22fc8c 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -3948,7 +3948,7 @@ llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo( if (OldGV) { GV->takeName(OldGV); llvm::Constant *NewPtr = - llvm::ConstantExpr::getBitCast(GV, OldGV->getType()); + llvm::ConstantExpr::getBitCast(GV, OldGV->getType()); OldGV->replaceAllUsesWith(NewPtr); OldGV->eraseFromParent(); } diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index d98574def75..c80dec2cdb6 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -405,7 +405,7 @@ static bool ShouldEnableAutolink(const ArgList &Args, const ToolChain &TC, } static bool mustUseNonLeafFramePointerForTarget(const llvm::Triple &Triple) { - switch (Triple.getArch()){ + switch (Triple.getArch()) { default: return false; case llvm::Triple::arm: @@ -527,7 +527,7 @@ getFramePointerKind(const ArgList &Args, const llvm::Triple &Triple) { Args.hasFlag(options::OPT_momit_leaf_frame_pointer, options::OPT_mno_omit_leaf_frame_pointer, Triple.isAArch64() || Triple.isPS() || Triple.isVE() || - (Triple.isAndroid() && Triple.isRISCV64())); + (Triple.isAndroid() && Triple.isRISCV64())); if (NoOmitFP || mustUseNonLeafFramePointerForTarget(Triple) || (!OmitFP && useFramePointerForTargetByDefault(Args, Triple))) { if (OmitLeafFP) diff --git a/clang/lib/Index/USRGeneration.cpp b/clang/lib/Index/USRGeneration.cpp index 4ab9370e8a8..a50fef06b24 100644 --- a/clang/lib/Index/USRGeneration.cpp +++ b/clang/lib/Index/USRGeneration.cpp @@ -520,9 +520,14 @@ void USRGenerator::VisitTagDecl(const TagDecl *D) { switch (D->getTagKind()) { case TTK_Interface: case TTK_Class: - case TTK_Struct: Out << "@ST"; break; - case TTK_Union: Out << "@UT"; break; - case TTK_Enum: llvm_unreachable("enum template"); + case TTK_Struct: + Out << "@ST"; + break; + case TTK_Union: + Out << "@UT"; + break; + case TTK_Enum: + llvm_unreachable("enum template"); } VisitTemplateParameterList(ClassTmpl->getTemplateParameters()); } else if (const ClassTemplatePartialSpecializationDecl *PartialSpec @@ -532,9 +537,14 @@ void USRGenerator::VisitTagDecl(const TagDecl *D) { switch (D->getTagKind()) { case TTK_Interface: case TTK_Class: - case TTK_Struct: Out << "@SP"; break; - case TTK_Union: Out << "@UP"; break; - case TTK_Enum: llvm_unreachable("enum partial specialization"); + case TTK_Struct: + Out << "@SP"; + break; + case TTK_Union: + Out << "@UP"; + break; + case TTK_Enum: + llvm_unreachable("enum partial specialization"); } VisitTemplateParameterList(PartialSpec->getTemplateParameters()); } @@ -542,11 +552,17 @@ void USRGenerator::VisitTagDecl(const TagDecl *D) { if (!AlreadyStarted) { switch (D->getTagKind()) { - case TTK_Interface: - case TTK_Class: - case TTK_Struct: Out << "@S"; break; - case TTK_Union: Out << "@U"; break; - case TTK_Enum: Out << "@E"; break; + case TTK_Interface: + case TTK_Class: + case TTK_Struct: + Out << "@S"; + break; + case TTK_Union: + Out << "@U"; + break; + case TTK_Enum: + Out << "@E"; + break; } } @@ -804,11 +820,14 @@ void USRGenerator::VisitType(QualType T) { case BuiltinType::Ibm128: Out << "@BT@__ibm128"; break; case BuiltinType::DecimalFloat32: - Out << "@BT@_Decimal32"; break; + Out << "@BT@_Decimal32"; + break; case BuiltinType::DecimalFloat64: - Out << "@BT@_Decimal64"; break; + Out << "@BT@_Decimal64"; + break; case BuiltinType::DecimalFloat128: - Out << "@BT@_Decimal128"; break; + Out << "@BT@_Decimal128"; + break; case BuiltinType::ObjCId: Out << 'o'; break; case BuiltinType::ObjCClass: diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 97f175f770c..18bb0d0fb1c 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -394,12 +394,11 @@ static bool SemaBuiltinOverflow(Sema &S, CallExpr *TheCall, QualType Ty = Arg.get()->getType(); const auto *PtrTy = Ty->getAs<PointerType>(); - if (!PtrTy || - !PtrTy->getPointeeType()->isIntegerType() || + if (!PtrTy || !PtrTy->getPointeeType()->isIntegerType() || PtrTy->getPointeeType().isConstQualified()) { S.Diag(Arg.get()->getBeginLoc(), diag::err_overflow_builtin_must_be_ptr_int) - << Ty << Arg.get()->getSourceRange(); + << Ty << Arg.get()->getSourceRange(); return true; } } @@ -7641,7 +7640,7 @@ bool Sema::BuiltinWasmRefNullExtern(CallExpr *TheCall) { bool Sema::BuiltinWasmRefNullFunc(CallExpr *TheCall) { if (TheCall->getNumArgs() != 0) { Diag(TheCall->getBeginLoc(), diag::err_typecheck_call_too_many_args) - << 0 /*function call*/ << 0 << TheCall->getNumArgs(); + << 0 /*function call*/ << 0 << TheCall->getNumArgs(); return true; } @@ -8701,8 +8700,7 @@ ExprResult Sema::SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, diag::err_convertvector_non_vector) << E->getSourceRange()); if (!DstTy->isVectorType() && !DstTy->isDependentType()) - return ExprError(Diag(BuiltinLoc, - diag::err_convertvector_non_vector_type)); + return ExprError(Diag(BuiltinLoc, diag::err_convertvector_non_vector_type)); if (!SrcTy->isDependentType() && !DstTy->isDependentType()) { unsigned SrcElts = SrcTy->castAs<VectorType>()->getNumElements(); diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 091b247f479..65add540a84 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -1336,9 +1336,9 @@ static void handleReturnTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) { // FIXME: This check is currently being done in the analysis. It can be // enabled here only after the parser propagates attributes at // template specialization definition, not declaration. - //QualType ReturnType; + // QualType ReturnType; // - //if (const ParmVarDecl *Param = dyn_cast<ParmVarDecl>(D)) { + // if (const ParmVarDecl *Param = dyn_cast<ParmVarDecl>(D)) { // ReturnType = Param->getType(); // //} else if (const CXXConstructorDecl *Constructor = @@ -1350,9 +1350,9 @@ static void handleReturnTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) { // ReturnType = cast<FunctionDecl>(D)->getCallResultType(); //} // - //const CXXRecordDecl *RD = ReturnType->getAsCXXRecordDecl(); + // const CXXRecordDecl *RD = ReturnType->getAsCXXRecordDecl(); // - //if (!RD || !RD->hasAttr<ConsumableAttr>()) { + // if (!RD || !RD->hasAttr<ConsumableAttr>()) { // S.Diag(Attr.getLoc(), diag::warn_return_state_for_unconsumable_type) << // ReturnType.getAsString(); // return; diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 13c50b56972..ab6fc95b51e 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1272,8 +1272,8 @@ TSTToUnaryTransformType(DeclSpec::TST SwitchTST) { } } -static CanQualType -TSTToDecimalFloatType(ASTContext &Context, DeclSpec::TST SwitchTST) { +static CanQualType TSTToDecimalFloatType(ASTContext &Context, + DeclSpec::TST SwitchTST) { switch (SwitchTST) { case DeclSpec::TST_decimal32: return Context.DecimalFloat32Ty; @@ -2750,7 +2750,7 @@ QualType Sema::BuildVectorType(QualType CurType, Expr *SizeExpr, if (SizeExpr->isTypeDependent() || SizeExpr->isValueDependent()) return Context.getDependentVectorType(CurType, SizeExpr, AttrLoc, - VectorType::GenericVector); + VectorType::GenericVector); std::optional<llvm::APSInt> VecSize = SizeExpr->getIntegerConstantExpr(Context); @@ -2763,7 +2763,7 @@ QualType Sema::BuildVectorType(QualType CurType, Expr *SizeExpr, if (CurType->isDependentType()) return Context.getDependentVectorType(CurType, SizeExpr, AttrLoc, - VectorType::GenericVector); + VectorType::GenericVector); // vecSize is specified in bytes - convert to bits. if (!VecSize->isIntN(61)) { @@ -3650,11 +3650,20 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, Error = 6; // Interface member. } else { switch (cast<TagDecl>(SemaRef.CurContext)->getTagKind()) { - case TTK_Enum: llvm_unreachable("unhandled tag kind"); - case TTK_Struct: Error = Cxx ? 1 : 2; /* Struct member */ break; - case TTK_Union: Error = Cxx ? 3 : 4; /* Union member */ break; - case TTK_Class: Error = 5; /* Class member */ break; - case TTK_Interface: Error = 6; /* Interface member */ break; + case TTK_Enum: + llvm_unreachable("unhandled tag kind"); + case TTK_Struct: + Error = Cxx ? 1 : 2; /* Struct member */ + break; + case TTK_Union: + Error = Cxx ? 3 : 4; /* Union member */ + break; + case TTK_Class: + Error = 5; /* Class member */ + break; + case TTK_Interface: + Error = 6; /* Interface member */ + break; } } if (D.getDeclSpec().isFriendSpecified()) @@ -5173,8 +5182,8 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, if (ASM == ArrayType::Static || ATI.TypeQuals) { if (!(D.isPrototypeContext() || D.getContext() == DeclaratorContext::KNRTypeList)) { - S.Diag(DeclType.Loc, diag::err_array_static_outside_prototype) << - (ASM == ArrayType::Static ? "'static'" : "type qualifier"); + S.Diag(DeclType.Loc, diag::err_array_static_outside_prototype) + << (ASM == ArrayType::Static ? "'static'" : "type qualifier"); // Remove the 'static' and the type qualifiers. if (ASM == ArrayType::Static) ASM = ArrayType::Normal; @@ -5185,8 +5194,8 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // C99 6.7.5.2p1: ... and then only in the outermost array type // derivation. if (hasOuterPointerLikeChunk(D, chunkIndex)) { - S.Diag(DeclType.Loc, diag::err_array_static_not_outermost) << - (ASM == ArrayType::Static ? "'static'" : "type qualifier"); + S.Diag(DeclType.Loc, diag::err_array_static_not_outermost) + << (ASM == ArrayType::Static ? "'static'" : "type qualifier"); if (ASM == ArrayType::Static) ASM = ArrayType::Normal; ATI.TypeQuals = 0; @@ -5198,8 +5207,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // necessary if they're marked 'static'. if (complainAboutMissingNullability == CAMN_Yes && !hasNullabilityAttr(DeclType.getAttrs()) && - ASM != ArrayType::Static && - D.isPrototypeContext() && + ASM != ArrayType::Static && D.isPrototypeContext() && !hasOuterPointerLikeChunk(D, chunkIndex)) { checkNullabilityConsistency(S, SimplePointerKind::Array, DeclType.Loc); } @@ -6685,8 +6693,8 @@ ParsedType Sema::CreateParsedType(QualType T, TypeSourceInfo *TInfo) { // FIXME: LocInfoTypes are "transient", only needed for passing to/from Parser // and Sema during declaration parsing. Try deallocating/caching them when // it's appropriate, instead of allocating them and keeping them around. - LocInfoType *LocT = (LocInfoType*)BumpAlloc.Allocate(sizeof(LocInfoType), - TypeAlignment); + LocInfoType *LocT = + (LocInfoType *)BumpAlloc.Allocate(sizeof(LocInfoType), TypeAlignment); new (LocT) LocInfoType(T, TInfo); assert(LocT->getTypeClass() != T->getTypeClass() && "LocInfoType's TypeClass conflicts with an existing Type class"); @@ -9379,9 +9387,12 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, /// \returns diagnostic %select index. static unsigned getLiteralDiagFromTagKind(TagTypeKind Tag) { switch (Tag) { - case TTK_Struct: return 0; - case TTK_Interface: return 1; - case TTK_Class: return 2; + case TTK_Struct: + return 0; + case TTK_Interface: + return 1; + case TTK_Class: + return 2; default: llvm_unreachable("Invalid tag kind for literal type diagnostic!"); } } diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 9d6a018177b..04430757ccf 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -1177,10 +1177,10 @@ ASTDeclContextNameLookupTrait::ReadKey(const unsigned char *d, unsigned) { case DeclarationName::ObjCZeroArgSelector: case DeclarationName::ObjCOneArgSelector: case DeclarationName::ObjCMultiArgSelector: - Data = - (uint64_t)Reader.getLocalSelector( - F, endian::readNext<uint32_t, little, unaligned>( - d)).getAsOpaquePtr(); + Data = (uint64_t)Reader + .getLocalSelector( + F, endian::readNext<uint32_t, little, unaligned>(d)) + .getAsOpaquePtr(); break; case DeclarationName::CXXOperatorName: Data = *d++; // OverloadedOperatorKind @@ -3970,7 +3970,7 @@ void ASTReader::ReadModuleOffsetMap(ModuleFile &F) const { // how it goes... using namespace llvm::support; ModuleKind Kind = static_cast<ModuleKind>( - endian::readNext<uint8_t, little, unaligned>(Data)); + endian::readNext<uint8_t, little, unaligned>(Data)); uint16_t Len = endian::readNext<uint16_t, little, unaligned>(Data); StringRef Name = StringRef((const char*)Data, Len); Data += Len; @@ -3998,8 +3998,7 @@ void ASTReader::ReadModuleOffsetMap(ModuleFile &F) const { endian::readNext<uint32_t, little, unaligned>(Data); uint32_t SelectorIDOffset = endian::readNext<uint32_t, little, unaligned>(Data); - uint32_t DeclIDOffset = - endian::readNext<uint32_t, little, unaligned>(Data); + uint32_t DeclIDOffset = endian::readNext<uint32_t, little, unaligned>(Data); uint32_t TypeIndexOffset = endian::readNext<uint32_t, little, unaligned>(Data); @@ -4129,7 +4128,7 @@ ASTReader::ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F, for (const FileEntry *ModMap : AdditionalStoredMaps) { if (!canRecoverFromOutOfDate(F.FileName, ClientLoadCapabilities)) Diag(diag::err_module_different_modmap) - << F.ModuleName << /*not new*/1 << ModMap->getName(); + << F.ModuleName << /*not new*/ 1 << ModMap->getName(); return OutOfDate; } } @@ -10047,8 +10046,8 @@ void ASTReader::pushExternalDeclIntoScope(NamedDecl *D, DeclarationName Name) { // Adding the decl to IdResolver may have failed because it was already in // (even though it was not added in scope). If it is already in, make sure // it gets in the scope as well. - if (std::find(SemaObj->IdResolver.begin(Name), - SemaObj->IdResolver.end(), D) != SemaObj->IdResolver.end()) + if (std::find(SemaObj->IdResolver.begin(Name), SemaObj->IdResolver.end(), + D) != SemaObj->IdResolver.end()) SemaObj->TUScope->AddDecl(D); } } diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index e9d97d55028..27c167a5318 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -2734,8 +2734,7 @@ void OMPClauseEnqueue::VisitOMPXDynCGroupMemClause( void OMPClauseEnqueue::VisitOMPDoacrossClause(const OMPDoacrossClause *C) { VisitOMPClauseList(C); } -void OMPClauseEnqueue::VisitOMPXAttributeClause(const OMPXAttributeClause *C) { -} +void OMPClauseEnqueue::VisitOMPXAttributeClause(const OMPXAttributeClause *C) {} } // namespace diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h index f821d465b59..9d0abc00311 100644 --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -214,48 +214,48 @@ typedef enum { } LLVMDLLStorageClass; typedef enum { - LLVMCCallConv = 0, - LLVMFastCallConv = 8, - LLVMColdCallConv = 9, - LLVMGHCCallConv = 10, - LLVMHiPECallConv = 11, - LLVMWebKitJSCallConv = 12, - LLVMAnyRegCallConv = 13, - LLVMPreserveMostCallConv = 14, - LLVMPreserveAllCallConv = 15, - LLVMSwiftCallConv = 16, - LLVMCXXFASTTLSCallConv = 17, - LLVMX86StdcallCallConv = 64, - LLVMX86FastcallCallConv = 65, - LLVMARMAPCSCallConv = 66, - LLVMARMAAPCSCallConv = 67, - LLVMARMAAPCSVFPCallConv = 68, - LLVMMSP430INTRCallConv = 69, - LLVMX86ThisCallCallConv = 70, - LLVMPTXKernelCallConv = 71, - LLVMPTXDeviceCallConv = 72, - LLVMSPIRFUNCCallConv = 75, - LLVMSPIRKERNELCallConv = 76, - LLVMIntelOCLBICallConv = 77, - LLVMX8664SysVCallConv = 78, - LLVMWin64CallConv = 79, + LLVMCCallConv = 0, + LLVMFastCallConv = 8, + LLVMColdCallConv = 9, + LLVMGHCCallConv = 10, + LLVMHiPECallConv = 11, + LLVMWebKitJSCallConv = 12, + LLVMAnyRegCallConv = 13, + LLVMPreserveMostCallConv = 14, + LLVMPreserveAllCallConv = 15, + LLVMSwiftCallConv = 16, + LLVMCXXFASTTLSCallConv = 17, + LLVMX86StdcallCallConv = 64, + LLVMX86FastcallCallConv = 65, + LLVMARMAPCSCallConv = 66, + LLVMARMAAPCSCallConv = 67, + LLVMARMAAPCSVFPCallConv = 68, + LLVMMSP430INTRCallConv = 69, + LLVMX86ThisCallCallConv = 70, + LLVMPTXKernelCallConv = 71, + LLVMPTXDeviceCallConv = 72, + LLVMSPIRFUNCCallConv = 75, + LLVMSPIRKERNELCallConv = 76, + LLVMIntelOCLBICallConv = 77, + LLVMX8664SysVCallConv = 78, + LLVMWin64CallConv = 79, LLVMX86VectorCallCallConv = 80, - LLVMHHVMCallConv = 81, - LLVMHHVMCCallConv = 82, - LLVMX86INTRCallConv = 83, - LLVMAVRINTRCallConv = 84, - LLVMAVRSIGNALCallConv = 85, - LLVMAVRBUILTINCallConv = 86, - LLVMAMDGPUVSCallConv = 87, - LLVMAMDGPUGSCallConv = 88, - LLVMAMDGPUPSCallConv = 89, - LLVMAMDGPUCSCallConv = 90, - LLVMAMDGPUKERNELCallConv = 91, - LLVMX86RegCallCallConv = 92, - LLVMAMDGPUHSCallConv = 93, + LLVMHHVMCallConv = 81, + LLVMHHVMCCallConv = 82, + LLVMX86INTRCallConv = 83, + LLVMAVRINTRCallConv = 84, + LLVMAVRSIGNALCallConv = 85, + LLVMAVRBUILTINCallConv = 86, + LLVMAMDGPUVSCallConv = 87, + LLVMAMDGPUGSCallConv = 88, + LLVMAMDGPUPSCallConv = 89, + LLVMAMDGPUCSCallConv = 90, + LLVMAMDGPUKERNELCallConv = 91, + LLVMX86RegCallCallConv = 92, + LLVMAMDGPUHSCallConv = 93, LLVMMSP430BUILTINCallConv = 94, - LLVMAMDGPULSCallConv = 95, - LLVMAMDGPUESCallConv = 96 + LLVMAMDGPULSCallConv = 95, + LLVMAMDGPUESCallConv = 96 } LLVMCallConv; typedef enum { diff --git a/llvm/include/llvm/Bitcode/LLVMBitCodes.h b/llvm/include/llvm/Bitcode/LLVMBitCodes.h index d19978a0820..3cc4c18da1e 100644 --- a/llvm/include/llvm/Bitcode/LLVMBitCodes.h +++ b/llvm/include/llvm/Bitcode/LLVMBitCodes.h @@ -178,9 +178,9 @@ enum TypeCodes { TYPE_CODE_TARGET_TYPE = 26, // TARGET_TYPE - TYPE_CODE_DECIMAL32 = 27, // 32-bit decimal floating point - TYPE_CODE_DECIMAL64 = 28, // 64-bit decimal floating point - TYPE_CODE_DECIMAL128 = 29 // 128-bit decimal floating point + TYPE_CODE_DECIMAL32 = 27, // 32-bit decimal floating point + TYPE_CODE_DECIMAL64 = 28, // 64-bit decimal floating point + TYPE_CODE_DECIMAL128 = 29 // 128-bit decimal floating point }; enum OperandBundleTagCode { diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h index ccae847c1cf..3ab965614dd 100644 --- a/llvm/include/llvm/IR/IRBuilder.h +++ b/llvm/include/llvm/IR/IRBuilder.h @@ -547,19 +547,13 @@ public: } /// Fetch the type representing a 32-bit decimal floating point value. - Type *getDecimal32Ty() { - return Type::getDecimal32Ty(Context); - } + Type *getDecimal32Ty() { return Type::getDecimal32Ty(Context); } /// Fetch the type representing a 64-bit decimal floating point value. - Type *getDecimal64Ty() { - return Type::getDecimal64Ty(Context); - } + Type *getDecimal64Ty() { return Type::getDecimal64Ty(Context); } /// Fetch the type representing a 128-bit decimal floating point value. - Type *getDecimal128Ty() { - return Type::getDecimal128Ty(Context); - } + Type *getDecimal128Ty() { return Type::getDecimal128Ty(Context); } /// Fetch the type representing void. Type *getVoidTy() { @@ -2095,8 +2089,7 @@ public: return CreateCast(Instruction::AddrSpaceCast, V, DestTy, Name); } - Value *CreateZExtOrBitCast(Value *V, Type *DestTy, - const Twine &Name = "") { + Value *CreateZExtOrBitCast(Value *V, Type *DestTy, const Twine &Name = "") { if (V->getType() == DestTy) return V; if (auto *VC = dyn_cast<Constant>(V)) @@ -2104,8 +2097,7 @@ public: return Insert(CastInst::CreateZExtOrBitCast(V, DestTy), Name); } - Value *CreateSExtOrBitCast(Value *V, Type *DestTy, - const Twine &Name = "") { + Value *CreateSExtOrBitCast(Value *V, Type *DestTy, const Twine &Name = "") { if (V->getType() == DestTy) return V; if (auto *VC = dyn_cast<Constant>(V)) @@ -2113,8 +2105,7 @@ public: return Insert(CastInst::CreateSExtOrBitCast(V, DestTy), Name); } - Value *CreateTruncOrBitCast(Value *V, Type *DestTy, - const Twine &Name = "") { + Value *CreateTruncOrBitCast(Value *V, Type *DestTy, const Twine &Name = "") { if (V->getType() == DestTy) return V; if (auto *VC = dyn_cast<Constant>(V)) diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h index 9bebf361ddb..be07079c2c1 100644 --- a/llvm/include/llvm/IR/Type.h +++ b/llvm/include/llvm/IR/Type.h @@ -68,8 +68,8 @@ public: TokenTyID, ///< Tokens // Decimal floating-point types. - Decimal32TyID, ///< 32-bit decimal floating point type - Decimal64TyID, ///< 64-bit decimal floating point type + Decimal32TyID, ///< 32-bit decimal floating point type + Decimal64TyID, ///< 64-bit decimal floating point type Decimal128TyID, ///< 128-bit decimal floating point type // Derived types... see DerivedTypes.h file. diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h index f22717e97d1..b6765cffe4a 100644 --- a/llvm/include/llvm/Target/TargetOptions.h +++ b/llvm/include/llvm/Target/TargetOptions.h @@ -81,11 +81,7 @@ namespace llvm { GNU }; - enum class BinaryEncoding { - None, - BID, - DPD - }; + enum class BinaryEncoding { None, BID, DPD }; /// Identify a debugger for "tuning" the debug info. /// diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index d6ccf83b484..65e1d94179f 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -4875,7 +4875,6 @@ Error BitcodeReader::parseFunctionBody(Function *F) { if (FMF.any()) I->setFastMathFlags(FMF); } - } break; } @@ -4884,7 +4883,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) { Value *Op; unsigned OpTypeID; if (getValueTypePair(Record, OpNum, NextValueNo, Op, OpTypeID, CurBB) || - OpNum+2 != Record.size()) + OpNum + 2 != Record.size()) return error("Invalid record"); ResTypeID = Record[OpNum]; diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 73d74a4729f..adfb12d3dce 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -976,9 +976,15 @@ void ModuleBitcodeWriter::writeTypeTable() { case Type::X86_FP80TyID: Code = bitc::TYPE_CODE_X86_FP80; break; case Type::FP128TyID: Code = bitc::TYPE_CODE_FP128; break; case Type::PPC_FP128TyID: Code = bitc::TYPE_CODE_PPC_FP128; break; - case Type::Decimal32TyID: Code = bitc::TYPE_CODE_DECIMAL32; break; - case Type::Decimal64TyID: Code = bitc::TYPE_CODE_DECIMAL64; break; - case Type::Decimal128TyID: Code = bitc::TYPE_CODE_DECIMAL128; break; + case Type::Decimal32TyID: + Code = bitc::TYPE_CODE_DECIMAL32; + break; + case Type::Decimal64TyID: + Code = bitc::TYPE_CODE_DECIMAL64; + break; + case Type::Decimal128TyID: + Code = bitc::TYPE_CODE_DECIMAL128; + break; case Type::LabelTyID: Code = bitc::TYPE_CODE_LABEL; break; case Type::MetadataTyID: Code = bitc::TYPE_CODE_METADATA; break; case Type::X86_MMXTyID: Code = bitc::TYPE_CODE_X86_MMX; break; diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index 30bc27f5a3e..bc083b248c1 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -290,13 +290,17 @@ static void PrintCallingConv(unsigned cc, raw_ostream &Out) { default: Out << "cc" << cc; break; case CallingConv::Fast: Out << "fastcc"; break; case CallingConv::Cold: Out << "coldcc"; break; - case CallingConv::WebKit_JS: Out << "webkit_jscc"; break; + case CallingConv::WebKit_JS: + Out << "webkit_jscc"; + break; case CallingConv::AnyReg: Out << "anyregcc"; break; case CallingConv::PreserveMost: Out << "preserve_mostcc"; break; case CallingConv::PreserveAll: Out << "preserve_allcc"; break; case CallingConv::CXX_FAST_TLS: Out << "cxx_fast_tlscc"; break; case CallingConv::GHC: Out << "ghccc"; break; - case CallingConv::Tail: Out << "tailcc"; break; + case CallingConv::Tail: + Out << "tailcc"; + break; case CallingConv::CFGuard_Check: Out << "cfguard_checkcc"; break; case CallingConv::X86_StdCall: Out << "x86_stdcallcc"; break; case CallingConv::X86_FastCall: Out << "x86_fastcallcc"; break; @@ -349,7 +353,9 @@ static void PrintCallingConv(unsigned cc, raw_ostream &Out) { Out << "amdgpu_cs_chain_preserve"; break; case CallingConv::AMDGPU_KERNEL: Out << "amdgpu_kernel"; break; - case CallingConv::AMDGPU_Gfx: Out << "amdgpu_gfx"; break; + case CallingConv::AMDGPU_Gfx: + Out << "amdgpu_gfx"; + break; } } @@ -561,9 +567,15 @@ void TypePrinting::print(Type *Ty, raw_ostream &OS) { case Type::IntegerTyID: OS << 'i' << cast<IntegerType>(Ty)->getBitWidth(); return; - case Type::Decimal32TyID: OS << "decimal32"; return; - case Type::Decimal64TyID: OS << "decimal64"; return; - case Type::Decimal128TyID: OS << "decimal128"; return; + case Type::Decimal32TyID: + OS << "decimal32"; + return; + case Type::Decimal64TyID: + OS << "decimal64"; + return; + case Type::Decimal128TyID: + OS << "decimal128"; + return; case Type::FunctionTyID: { FunctionType *FTy = cast<FunctionType>(Ty); diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index 0de684136bd..4405aaacc60 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -1751,43 +1751,43 @@ LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { } LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getSExt(unwrap<Constant>(ConstantVal), - unwrap(ToType))); + return wrap( + ConstantExpr::getSExt(unwrap<Constant>(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getZExt(unwrap<Constant>(ConstantVal), - unwrap(ToType))); + return wrap( + ConstantExpr::getZExt(unwrap<Constant>(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstFPTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPTrunc(unwrap<Constant>(ConstantVal), - unwrap(ToType))); + return wrap( + ConstantExpr::getFPTrunc(unwrap<Constant>(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstFPExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPExtend(unwrap<Constant>(ConstantVal), - unwrap(ToType))); + return wrap( + ConstantExpr::getFPExtend(unwrap<Constant>(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstUIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getUIToFP(unwrap<Constant>(ConstantVal), - unwrap(ToType))); + return wrap( + ConstantExpr::getUIToFP(unwrap<Constant>(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstSIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getSIToFP(unwrap<Constant>(ConstantVal), - unwrap(ToType))); + return wrap( + ConstantExpr::getSIToFP(unwrap<Constant>(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstFPToUI(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPToUI(unwrap<Constant>(ConstantVal), - unwrap(ToType))); + return wrap( + ConstantExpr::getFPToUI(unwrap<Constant>(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPToSI(unwrap<Constant>(ConstantVal), - unwrap(ToType))); + return wrap( + ConstantExpr::getFPToSI(unwrap<Constant>(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { @@ -1842,8 +1842,8 @@ LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, } LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPCast(unwrap<Constant>(ConstantVal), - unwrap(ToType))); + return wrap( + ConstantExpr::getFPCast(unwrap<Constant>(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, @@ -3540,9 +3540,9 @@ LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty)); AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy); - Instruction* Malloc = CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), - ITy, unwrap(Ty), AllocSize, - nullptr, nullptr, ""); + Instruction *Malloc = + CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), ITy, unwrap(Ty), + AllocSize, nullptr, nullptr, ""); return wrap(unwrap(B)->Insert(Malloc, Twine(Name))); } @@ -3551,9 +3551,9 @@ LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty)); AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy); - Instruction* Malloc = CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), - ITy, unwrap(Ty), AllocSize, - unwrap(Val), nullptr, ""); + Instruction *Malloc = + CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), ITy, unwrap(Ty), + AllocSize, unwrap(Val), nullptr, ""); return wrap(unwrap(B)->Insert(Malloc, Twine(Name))); } @@ -3594,7 +3594,7 @@ LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal) { return wrap(unwrap(B)->Insert( - CallInst::CreateFree(unwrap(PointerVal), unwrap(B)->GetInsertBlock()))); + CallInst::CreateFree(unwrap(PointerVal), unwrap(B)->GetInsertBlock()))); } LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp index 5cf2ec8faf2..551eda1e77b 100644 --- a/llvm/lib/IR/Type.cpp +++ b/llvm/lib/IR/Type.cpp @@ -48,9 +48,12 @@ Type *Type::getPrimitiveType(LLVMContext &C, TypeID IDNumber) { case X86_MMXTyID : return getX86_MMXTy(C); case X86_AMXTyID : return getX86_AMXTy(C); case TokenTyID : return getTokenTy(C); - case Decimal32TyID : return getDecimal32Ty(C); - case Decimal64TyID : return getDecimal64Ty(C); - case Decimal128TyID: return getDecimal128Ty(C); + case Decimal32TyID: + return getDecimal32Ty(C); + case Decimal64TyID: + return getDecimal64Ty(C); + case Decimal128TyID: + return getDecimal128Ty(C); default: return nullptr; } @@ -175,18 +178,30 @@ bool Type::isEmptyTy() const { TypeSize Type::getPrimitiveSizeInBits() const { switch (getTypeID()) { - case Type::HalfTyID: return TypeSize::Fixed(16); - case Type::BFloatTyID: return TypeSize::Fixed(16); - case Type::FloatTyID: return TypeSize::Fixed(32); - case Type::DoubleTyID: return TypeSize::Fixed(64); - case Type::X86_FP80TyID: return TypeSize::Fixed(80); - case Type::FP128TyID: return TypeSize::Fixed(128); - case Type::PPC_FP128TyID: return TypeSize::Fixed(128); - case Decimal32TyID: return TypeSize::Fixed(32); - case Decimal64TyID: return TypeSize::Fixed(64); - case Decimal128TyID: return TypeSize::Fixed(128); - case Type::X86_MMXTyID: return TypeSize::Fixed(64); - case Type::X86_AMXTyID: return TypeSize::Fixed(8192); + case Type::HalfTyID: + return TypeSize::Fixed(16); + case Type::BFloatTyID: + return TypeSize::Fixed(16); + case Type::FloatTyID: + return TypeSize::Fixed(32); + case Type::DoubleTyID: + return TypeSize::Fixed(64); + case Type::X86_FP80TyID: + return TypeSize::Fixed(80); + case Type::FP128TyID: + return TypeSize::Fixed(128); + case Type::PPC_FP128TyID: + return TypeSize::Fixed(128); + case Decimal32TyID: + return TypeSize::Fixed(32); + case Decimal64TyID: + return TypeSize::Fixed(64); + case Decimal128TyID: + return TypeSize::Fixed(128); + case Type::X86_MMXTyID: + return TypeSize::Fixed(64); + case Type::X86_AMXTyID: + return TypeSize::Fixed(8192); case Type::IntegerTyID: return TypeSize::Fixed(cast<IntegerType>(this)->getBitWidth()); case Type::FixedVectorTyID: @@ -197,7 +212,8 @@ TypeSize Type::getPrimitiveSizeInBits() const { assert(!ETS.isScalable() && "Vector type should have fixed-width elements"); return {ETS.getFixedValue() * EC.getKnownMinValue(), EC.isScalable()}; } - default: return TypeSize::Fixed(0); + default: + return TypeSize::Fixed(0); } } @@ -226,9 +242,12 @@ int Type::getDFPPrecisionInDigits() const { assert(isDecimalFloatingPointTy() && "Not a decimal floating point type!"); // Precision values per the "Decimal interchange format parameters" table of /// C23 annex H.2.1, "Interchange floating types". - if (getTypeID() == Decimal32TyID) return 7; - if (getTypeID() == Decimal64TyID) return 16; - if (getTypeID() == Decimal128TyID) return 34; + if (getTypeID() == Decimal32TyID) + return 7; + if (getTypeID() == Decimal64TyID) + return 16; + if (getTypeID() == Decimal128TyID) + return 34; report_fatal_error("unknown decimal floating point type"); } diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp index 350dfd3daaa..e01e1354d8f 100644 --- a/llvm/lib/Target/X86/X86TargetMachine.cpp +++ b/llvm/lib/Target/X86/X86TargetMachine.cpp @@ -233,7 +233,7 @@ X86TargetMachine::X86TargetMachine(const Target &T, const Triple &TT, std::optional<CodeModel::Model> CM, CodeGenOptLevel OL, bool JIT) : LLVMTargetMachine( - T, computeDataLayout(TT, Options), TT, CPU, FS, Options, + T, computeDataLayout(TT, Options), TT, CPU, FS, Options, getEffectiveRelocModel(TT, JIT, RM), getEffectiveX86CodeModel(CM, JIT, TT.getArch() == Triple::x86_64), OL), `````````` </details> https://github.com/llvm/llvm-project/pull/74596 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits