[flang-commits] [flang] f1a2b50 - [flang][nfc] Tidy up in CodeGen.cpp and TypeConverter.h
Andrzej Warzynski via flang-commits
flang-commits at lists.llvm.org
Thu Nov 11 02:09:08 PST 2021
Author: Andrzej Warzynski
Date: 2021-11-11T10:08:55Z
New Revision: f1a2b507896c3fec8b725e489d9c0a9816d292c0
URL: https://github.com/llvm/llvm-project/commit/f1a2b507896c3fec8b725e489d9c0a9816d292c0
DIFF: https://github.com/llvm/llvm-project/commit/f1a2b507896c3fec8b725e489d9c0a9816d292c0.diff
LOG: [flang][nfc] Tidy up in CodeGen.cpp and TypeConverter.h
Some header `#include`s that belong in TypeConverter.h rather than in
CodeGen.cpp are moved accordingly. As TypeConverter.h is currently only
used in CodeGen.cpp, this wouldn't cause any build issues (ultimately,
all the required headers are included). However, this would become a problem
when including TypeConverter.h elsewhere.
Also, from [1], "(...) include all of the header files that you are
using ". This is currently not the case in TypeConverter.h and hence the
`#include`s should be moved.
I've also added missing namespace qualifiers in a few places in
TypeConverter.h
[1] https://llvm.org/docs/CodingStandards.html#include-as-little-as-possible
Differential Revision: https://reviews.llvm.org/D113569
Added:
Modified:
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/lib/Optimizer/CodeGen/TypeConverter.h
Removed:
################################################################################
diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index 9c9fcb204605..6018429ac51c 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -14,11 +14,8 @@
#include "PassDetail.h"
#include "flang/ISO_Fortran_binding.h"
#include "flang/Optimizer/Dialect/FIROps.h"
-#include "flang/Optimizer/Dialect/FIRType.h"
-#include "flang/Optimizer/Support/FIRContext.h"
#include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
-#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Matchers.h"
diff --git a/flang/lib/Optimizer/CodeGen/TypeConverter.h b/flang/lib/Optimizer/CodeGen/TypeConverter.h
index 859074e55d5a..a9129953797e 100644
--- a/flang/lib/Optimizer/CodeGen/TypeConverter.h
+++ b/flang/lib/Optimizer/CodeGen/TypeConverter.h
@@ -16,9 +16,10 @@
#include "DescriptorModel.h"
#include "Target.h"
#include "flang/Lower/Todo.h" // remove when TODO's are done
+#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Support/FIRContext.h"
#include "flang/Optimizer/Support/KindMapping.h"
-#include "llvm/ADT/StringMap.h"
+#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "llvm/Support/Debug.h"
// Position of the
diff erent values in a `fir.box`.
@@ -111,7 +112,7 @@ class LLVMTypeConverter : public mlir::LLVMTypeConverter {
// the addendum defined in descriptor.h.
mlir::Type convertBoxType(BoxType box, int rank = unknownRank()) {
// (base_addr*, elem_len, version, rank, type, attribute, f18Addendum, [dim]
- SmallVector<mlir::Type> dataDescFields;
+ llvm::SmallVector<mlir::Type> dataDescFields;
mlir::Type ele = box.getEleTy();
// remove fir.heap/fir.ref/fir.ptr
if (auto removeIndirection = fir::dyn_cast_ptrEleTy(ele))
@@ -269,7 +270,7 @@ class LLVMTypeConverter : public mlir::LLVMTypeConverter {
case llvm::Type::TypeID::FP128TyID:
return mlir::FloatType::getF128(&getContext());
default:
- emitError(UnknownLoc::get(&getContext()))
+ mlir::emitError(mlir::UnknownLoc::get(&getContext()))
<< "unsupported type: !fir.real<" << kind << ">";
return {};
}
More information about the flang-commits
mailing list