Skip to content

Commit e468964

Browse files
authored
Format update (#1330)
1 parent fe4d0f1 commit e468964

File tree

7 files changed

+215
-135
lines changed

7 files changed

+215
-135
lines changed

flang/lib/Lower/CallInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "flang/Lower/CallInterface.h"
10-
#include "flang/Lower/StatementContext.h"
1110
#include "flang/Evaluate/fold.h"
1211
#include "flang/Lower/Bridge.h"
1312
#include "flang/Lower/Mangler.h"
1413
#include "flang/Lower/PFTBuilder.h"
14+
#include "flang/Lower/StatementContext.h"
1515
#include "flang/Lower/Todo.h"
1616
#include "flang/Optimizer/Builder/FIRBuilder.h"
1717
#include "flang/Optimizer/Dialect/FIRDialect.h"

flang/lib/Lower/ConvertExpr.cpp

Lines changed: 181 additions & 111 deletions
Large diffs are not rendered by default.

flang/lib/Lower/ConvertType.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ struct TypeBuilder {
226226
// links, the fir type is built based on the ultimate symbol. This relies
227227
// on the fact volatile and asynchronous are not reflected in fir types.
228228
const Fortran::semantics::Symbol &ultimate = symbol.GetUltimate();
229-
if (const Fortran::semantics::DeclTypeSpec * type = ultimate.GetType()) {
230-
if (const Fortran::semantics::IntrinsicTypeSpec *
231-
tySpec = type->AsIntrinsic()) {
229+
if (const Fortran::semantics::DeclTypeSpec *type = ultimate.GetType()) {
230+
if (const Fortran::semantics::IntrinsicTypeSpec *tySpec =
231+
type->AsIntrinsic()) {
232232
int kind = toInt64(Fortran::common::Clone(tySpec->kind())).value();
233233
llvm::SmallVector<Fortran::lower::LenParameterTy> params;
234234
translateLenParameters(params, tySpec->category(), ultimate);

flang/lib/Lower/HostAssociations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ class CapturedArrays : public CapturedSymbols<CapturedArrays> {
400400
auto boxTy = box.getType().cast<fir::BoxType>();
401401
auto eleTy = boxTy.getEleTy();
402402
if (!fir::isa_ref_type(eleTy))
403-
eleTy = builder.getRefType(eleTy);
403+
eleTy = builder.getRefType(eleTy);
404404
auto addr = builder.create<fir::BoxAddrOp>(loc, eleTy, box);
405405
mlir::Value isPresent = builder.genIsNotNull(loc, addr);
406406
auto absentBox = builder.create<fir::AbsentOp>(loc, boxTy);

flang/lib/Lower/Mangler.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ findInterfaceIfSeperateMP(const Fortran::semantics::Symbol &symbol) {
6464
scope.IsSubmodule()) {
6565
// FIXME symbol from MpSubprogramStmt do not seem to have
6666
// Attr::MODULE set.
67-
const Fortran::semantics::Symbol *iface = scope.parent().FindSymbol(symbol.name());
67+
const Fortran::semantics::Symbol *iface =
68+
scope.parent().FindSymbol(symbol.name());
6869
assert(iface && "Separate module procedure must be declared");
6970
return iface;
7071
}
@@ -97,7 +98,8 @@ Fortran::lower::mangle::mangleName(const Fortran::semantics::Symbol &symbol,
9798
const Fortran::semantics::Symbol *interface = &ultimateSymbol;
9899
if (const auto *mpIface = findInterfaceIfSeperateMP(ultimateSymbol))
99100
interface = mpIface;
100-
llvm::SmallVector<llvm::StringRef> modNames = moduleNames(*interface);
101+
llvm::SmallVector<llvm::StringRef> modNames =
102+
moduleNames(*interface);
101103
return fir::NameUniquer::doProcedure(modNames, hostName(*interface),
102104
symbolName);
103105
},
@@ -115,15 +117,17 @@ Fortran::lower::mangle::mangleName(const Fortran::semantics::Symbol &symbol,
115117
symbolName);
116118
},
117119
[&](const Fortran::semantics::ObjectEntityDetails &) {
118-
llvm::SmallVector<llvm::StringRef> modNames = moduleNames(ultimateSymbol);
120+
llvm::SmallVector<llvm::StringRef> modNames =
121+
moduleNames(ultimateSymbol);
119122
llvm::Optional<llvm::StringRef> optHost = hostName(ultimateSymbol);
120123
if (Fortran::semantics::IsNamedConstant(ultimateSymbol))
121124
return fir::NameUniquer::doConstant(modNames, optHost,
122125
symbolName);
123126
return fir::NameUniquer::doVariable(modNames, optHost, symbolName);
124127
},
125128
[&](const Fortran::semantics::NamelistDetails &) {
126-
llvm::SmallVector<llvm::StringRef> modNames = moduleNames(ultimateSymbol);
129+
llvm::SmallVector<llvm::StringRef> modNames =
130+
moduleNames(ultimateSymbol);
127131
llvm::Optional<llvm::StringRef> optHost = hostName(ultimateSymbol);
128132
return fir::NameUniquer::doNamelistGroup(modNames, optHost,
129133
symbolName);
@@ -145,7 +149,8 @@ Fortran::lower::mangle::mangleName(const Fortran::semantics::Symbol &symbol,
145149
std::string Fortran::lower::mangle::mangleName(
146150
const Fortran::semantics::DerivedTypeSpec &derivedType) {
147151
// Resolve host and module association before mangling
148-
const Fortran::semantics::Symbol &ultimateSymbol = derivedType.typeSymbol().GetUltimate();
152+
const Fortran::semantics::Symbol &ultimateSymbol =
153+
derivedType.typeSymbol().GetUltimate();
149154
llvm::StringRef symbolName = toStringRef(ultimateSymbol.name());
150155
llvm::SmallVector<llvm::StringRef> modNames = moduleNames(ultimateSymbol);
151156
llvm::Optional<llvm::StringRef> optHost = hostName(ultimateSymbol);
@@ -155,11 +160,14 @@ std::string Fortran::lower::mangle::mangleName(
155160
const auto &paramDetails =
156161
param->get<Fortran::semantics::TypeParamDetails>();
157162
if (paramDetails.attr() == Fortran::common::TypeParamAttr::Kind) {
158-
const Fortran::semantics::ParamValue *paramValue = derivedType.FindParameter(param->name());
163+
const Fortran::semantics::ParamValue *paramValue =
164+
derivedType.FindParameter(param->name());
159165
assert(paramValue && "derived type kind parameter value not found");
160-
const Fortran::semantics::MaybeIntExpr paramExpr = paramValue->GetExplicit();
166+
const Fortran::semantics::MaybeIntExpr paramExpr =
167+
paramValue->GetExplicit();
161168
assert(paramExpr && "derived type kind param not explicit");
162-
std::optional<int64_t> init = Fortran::evaluate::ToInt64(paramValue->GetExplicit());
169+
std::optional<int64_t> init =
170+
Fortran::evaluate::ToInt64(paramValue->GetExplicit());
163171
assert(init && "derived type kind param is not constant");
164172
kinds.emplace_back(*init);
165173
}
@@ -206,7 +214,8 @@ std::string Fortran::lower::mangle::mangleArrayLiteral(
206214
if (charLen >= 0)
207215
typeId.append(std::to_string(charLen)).append("x");
208216
typeId.append(typeToString(cat, kind));
209-
std::string name = fir::NameUniquer::doGenerated("ro."s.append(typeId).append("."));
217+
std::string name =
218+
fir::NameUniquer::doGenerated("ro."s.append(typeId).append("."));
210219
if (!size)
211220
return name += "null";
212221
llvm::MD5 hashValue{};

flang/lib/Lower/OpenACC.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ createParallelOp(Fortran::lower::AbstractConverter &converter,
506506

507507
mlir::acc::ParallelOp parallelOp =
508508
createRegionOp<mlir::acc::ParallelOp, mlir::acc::YieldOp>(
509-
firOpBuilder, currentLocation, operands, operandSegments);
509+
firOpBuilder, currentLocation, operands, operandSegments);
510510

511511
if (addAsyncAttr)
512512
parallelOp->setAttr(mlir::acc::ParallelOp::getAsyncAttrName(),
@@ -996,8 +996,8 @@ static void genACC(Fortran::lower::AbstractConverter &converter,
996996
addOperand(operands, operandSegments, waitDevnum);
997997
addOperand(operands, operandSegments, ifCond);
998998

999-
mlir::acc::WaitOp waitOp = createSimpleOp<mlir::acc::WaitOp>(firOpBuilder, currentLocation,
1000-
operands, operandSegments);
999+
mlir::acc::WaitOp waitOp = createSimpleOp<mlir::acc::WaitOp>(
1000+
firOpBuilder, currentLocation, operands, operandSegments);
10011001

10021002
if (addAsyncAttr)
10031003
waitOp.asyncAttr(firOpBuilder.getUnitAttr());

flang/lib/Lower/VectorSubscripts.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ class VectorSubscriptBoxBuilder {
107107

108108
mlir::Type gen(const Fortran::evaluate::Component &component) {
109109
auto recTy = gen(component.base()).cast<fir::RecordType>();
110-
const Fortran::semantics::Symbol &componentSymbol = component.GetLastSymbol();
110+
const Fortran::semantics::Symbol &componentSymbol =
111+
component.GetLastSymbol();
111112
// Parent components will not be found here, they are not part
112113
// of the FIR type and cannot be used in the path yet.
113114
if (componentSymbol.test(Fortran::semantics::Symbol::Flag::ParentComp))
@@ -158,8 +159,8 @@ class VectorSubscriptBoxBuilder {
158159
mlir::Type genRankedArrayRefSubscriptAndBase(
159160
const Fortran::evaluate::ArrayRef &arrayRef) {
160161
// Lower the save the base
161-
Fortran::evaluate::Expr<Fortran::evaluate::SomeType> baseExpr
162-
= namedEntityToExpr(arrayRef.base());
162+
Fortran::evaluate::Expr<Fortran::evaluate::SomeType> baseExpr =
163+
namedEntityToExpr(arrayRef.base());
163164
loweredBase = converter.genExprAddr(baseExpr, stmtCtx);
164165
// Lower and save the subscripts
165166
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
@@ -362,10 +363,10 @@ Fortran::lower::VectorSubscriptBox::genLoopBounds(fir::FirOpBuilder &builder,
362363
continue;
363364
mlir::Value lb, ub, step;
364365
if (const auto *triplet = std::get_if<LoweredTriplet>(&subscript)) {
365-
mlir::Value extent = builder.genExtentFromTriplet(loc, triplet->lb,
366-
triplet->ub, triplet->stride, idxTy);
367-
mlir::Value baseLb = fir::factory::readLowerBound(builder, loc, loweredBase,
368-
dimension, one);
366+
mlir::Value extent = builder.genExtentFromTriplet(
367+
loc, triplet->lb, triplet->ub, triplet->stride, idxTy);
368+
mlir::Value baseLb = fir::factory::readLowerBound(
369+
builder, loc, loweredBase, dimension, one);
369370
baseLb = builder.createConvert(loc, idxTy, baseLb);
370371
lb = baseLb;
371372
ub = builder.create<mlir::arith::SubIOp>(loc, idxTy, extent, one);

0 commit comments

Comments
 (0)