[flang-commits] [flang] fac0fb4 - [flang] Use X->foo() instead of X.getValue().foo() (NFC)
Kazu Hirata via flang-commits
flang-commits at lists.llvm.org
Mon Jul 25 00:55:16 PDT 2022
Author: Kazu Hirata
Date: 2022-07-25T00:55:06-07:00
New Revision: fac0fb4d966efe8c70d3e566cca6a5d0bd049302
URL: https://github.com/llvm/llvm-project/commit/fac0fb4d966efe8c70d3e566cca6a5d0bd049302
DIFF: https://github.com/llvm/llvm-project/commit/fac0fb4d966efe8c70d3e566cca6a5d0bd049302.diff
LOG: [flang] Use X->foo() instead of X.getValue().foo() (NFC)
Flang C++ Style Guide tells us to use *X when the reference is
protected by a presense test. However, (*X).foo() is a little harder
to read, especially when X is a complicated expression.
This patch slightly deviates from the guide (but retains the spirit)
by using X->foo() instead.
Differential Revision: https://reviews.llvm.org/D130413
Added:
Modified:
flang/lib/Optimizer/Transforms/AffinePromotion.cpp
flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
Removed:
################################################################################
diff --git a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
index 90b4364866c96..4d2aa0ee20355 100644
--- a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
+++ b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
@@ -239,9 +239,8 @@ struct AffineIfCondition {
cmpOp.getPredicate(), rhsAffine.getValue() - lhsAffine.getValue());
if (!constraintPair)
return;
- integerSet = mlir::IntegerSet::get(dimCount, symCount,
- {constraintPair.getValue().first},
- {constraintPair.getValue().second});
+ integerSet = mlir::IntegerSet::get(
+ dimCount, symCount, {constraintPair->first}, {constraintPair->second});
}
llvm::Optional<std::pair<AffineExpr, bool>>
diff --git a/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp b/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
index b88c186a7a695..42260ad2826ac 100644
--- a/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
@@ -50,8 +50,8 @@ class MangleNameOnCallOp : public mlir::OpRewritePattern<fir::CallOp> {
rewriter.startRootUpdate(op);
auto callee = op.getCallee();
if (callee) {
- auto result = fir::NameUniquer::deconstruct(
- callee.getValue().getRootReference().getValue());
+ auto result =
+ fir::NameUniquer::deconstruct(callee->getRootReference().getValue());
if (fir::NameUniquer::isExternalFacingUniquedName(result))
op.setCalleeAttr(
SymbolRefAttr::get(op.getContext(), mangleExternalName(result)));
@@ -139,7 +139,7 @@ void ExternalNameConversionPass::runOnOperation() {
target.addDynamicallyLegalOp<fir::CallOp>([](fir::CallOp op) {
if (op.getCallee())
return !fir::NameUniquer::needExternalNameMangling(
- op.getCallee().getValue().getRootReference().getValue());
+ op.getCallee()->getRootReference().getValue());
return true;
});
More information about the flang-commits
mailing list