From 5604b367bd86fa02fa17c557a8704cfcaa151cbb Mon Sep 17 00:00:00 2001 From: Mandeep Singh Grang Date: Tue, 10 Sep 2019 16:26:36 -0700 Subject: [PATCH] Fix indentation in CheckedCInterop.cpp (#606) Cherry-picked from commit d83ad074927d38cebf0dbc2453c49d8b355ddd3e LLVM/Clang follow an 80-char line limit. --- clang/lib/Sema/CheckedCInterop.cpp | 47 ++++++++++++++++-------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/clang/lib/Sema/CheckedCInterop.cpp b/clang/lib/Sema/CheckedCInterop.cpp index 9242af6b21dc..f588634cd1bf 100644 --- a/clang/lib/Sema/CheckedCInterop.cpp +++ b/clang/lib/Sema/CheckedCInterop.cpp @@ -1,4 +1,4 @@ -//===------ CheckedCInterop - Support Methods for Checked C Interop -----===// +//===------ CheckedCInterop - Support Methods for Checked C Interop ------===// // // The LLVM Compiler Infrastructure // @@ -20,8 +20,7 @@ using namespace sema; /// \brief Create the corresponding Checked C interop type for Ty, given a /// a bounds expression Bounds. Returns the empty type if no interop /// type exists. -QualType Sema::SynthesizeInteropType(QualType Ty, - bool isParam) { +QualType Sema::SynthesizeInteropType(QualType Ty, bool isParam) { // Nothing to do. if (Ty.isNull() || Ty->isCheckedArrayType() || Ty->isCheckedPointerType()) @@ -103,15 +102,16 @@ class TransformFunctionTypeToChecked : const FunctionProtoType *T = TL.getTypePtr(); - // Assert on trailing returning type for now, instead of handling them. - // That's a C++ feature that we cannot test right now. + // Assert on trailing returning type for now, instead of handling them. + // That's a C++ feature that we cannot test right now. if (T->hasTrailingReturn()) { assert(false && "Unexpected trailing return type for Checked C"); return QualType(); } // Update the parameters and return types to be their interop types. Also - // update the extend prototype inofmration to remove interop type annotations. + // update the extend prototype inofmration to remove interop type + // annotations. SmallVector CurrentParamTypes; SmallVector CurrentParamAnnots; TypeLoc ResultLoc = TL.getReturnLoc(); @@ -140,8 +140,9 @@ class TransformFunctionTypeToChecked : llvm::outs() << "\nresult type = "; ResultLoc.getType().dump(llvm::outs()); #endif - // Construct new annotations that do not have the bounds-safe interface type. - if (Bounds) { + // Construct new annotations that do not have the bounds-safe + // interface type. + if (Bounds) { EPI.ReturnAnnots = BoundsAnnotations(Bounds, nullptr); } else EPI.ReturnAnnots = BoundsAnnotations(); @@ -150,11 +151,12 @@ class TransformFunctionTypeToChecked : } } - // Update the parameter types and annotations. The EPI parameter array is still used - // by the original type, so a create and update a copy in CurrentParamAnnots. + // Update the parameter types and annotations. The EPI parameter array is + // still used by the original type, so a create and update a copy in + // CurrentParamAnnots. if (EPI.ParamAnnots) { - // Track whether there are parameter annotations left after removing interop - // annotations. + // Track whether there are parameter annotations left after removing + // interop annotations. bool hasParamAnnots = false; for (unsigned int i = 0; i < CurrentParamTypes.size(); i++) { BoundsAnnotations IndividualAnnots = EPI.ParamAnnots[i]; @@ -213,9 +215,9 @@ class TransformFunctionTypeToChecked : SmallVector ParamTypes; SmallVector ParamDecls; Sema::ExtParameterInfoBuilder ExtParamInfos; - // ParamAnnotsStorage is pre-allocated storage that is used when updating EPI - // in TransformExtendedParameterInfo. Its lifetime must last until the end of - // the lifetime of EPI. + // ParamAnnotsStorage is pre-allocated storage that is used when updating + // EPI in TransformExtendedParameterInfo. Its lifetime must last until the + // end of the lifetime of EPI. SmallVector ParamAnnotsStorage; QualType ResultType = getDerived().TransformType(TLB, ResultLoc); @@ -240,7 +242,8 @@ class TransformFunctionTypeToChecked : QualType Result = TL.getType(); if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType() || T->getParamTypes() != llvm::makeArrayRef(ParamTypes) || EPIChanged) { - Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI); + Result = + getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, EPI); if (Result.isNull()) { #if TRACE_INTEROP llvm::outs() << "Rebuild function prototype failed"; @@ -265,8 +268,8 @@ class TransformFunctionTypeToChecked : } QualType TransformTypedefType(TypeLocBuilder &TLB, TypedefTypeLoc TL) { - // Preserve typedef information, unless the underlying type has a function type - // embedded in it with a bounds-safe interface. + // Preserve typedef information, unless the underlying type has a function + // type embedded in it with a bounds-safe interface. const TypedefType *T = TL.getTypePtr(); // See if the underlying type changes. QualType UnderlyingType = T->desugar(); @@ -282,14 +285,14 @@ class TransformFunctionTypeToChecked : // and use the underlying transformed type. // Synthesize some dummy type source information. - TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo(TransformedType, - getDerived().getBaseLocation()); + TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo( + TransformedType, getDerived().getBaseLocation()); // Use that to get dummy location information. TypeLoc NewTL = DI->getTypeLoc(); TLB.reserve(NewTL.getFullDataSize()); // Re-run the type transformation with the dummy location information so - // that the type location class pushed on to the TypeBuilder is the matching - // class for the underlying type. + // that the type location class pushed on to the TypeBuilder is the + // matching class for the underlying type. QualType Result = getDerived().TransformType(TLB, NewTL); assert(Result == TransformedType); return Result;