[flang-commits] [PATCH] D121470: [flang][NFC] rename IsKindParameterizedDerivedType and fix comment typos

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Mar 11 08:42:39 PST 2022


jeanPerier created this revision.
jeanPerier added reviewers: schweitz, clementval, PeteSteinfeld.
jeanPerier added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.

Following post-review feedback on https://reviews.llvm.org/D120804 and
https://reviews.llvm.org/D120801 about type descriptor changes, fix typos in
comments and rename IsKindParameterizedDerivedType to
IsDerivedTypeWithKindParameter. Remove a useless `;`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121470

Files:
  flang/include/flang/Optimizer/CodeGen/CodeGen.h
  flang/include/flang/Semantics/scope.h
  flang/lib/Semantics/compute-offsets.cpp
  flang/lib/Semantics/runtime-type-info.cpp
  flang/lib/Semantics/scope.cpp


Index: flang/lib/Semantics/scope.cpp
===================================================================
--- flang/lib/Semantics/scope.cpp
+++ flang/lib/Semantics/scope.cpp
@@ -374,12 +374,12 @@
   return false;
 }
 
-bool Scope::IsKindParameterizedDerivedType() const {
+bool Scope::IsDerivedTypeWithKindParameter() const {
   if (!IsDerivedType()) {
     return false;
   }
   if (const Scope * parent{GetDerivedTypeParent()}) {
-    if (parent->IsKindParameterizedDerivedType()) {
+    if (parent->IsDerivedTypeWithKindParameter()) {
       return true;
     }
   }
Index: flang/lib/Semantics/runtime-type-info.cpp
===================================================================
--- flang/lib/Semantics/runtime-type-info.cpp
+++ flang/lib/Semantics/runtime-type-info.cpp
@@ -352,7 +352,6 @@
                 *suffix += "."s + std::to_string(*instantiatedValue);
               } else {
                 suffix = "."s + std::to_string(*instantiatedValue);
-                ;
               }
             }
           }
@@ -369,7 +368,7 @@
     return info;
   }
   const DerivedTypeSpec *derivedTypeSpec{dtScope.derivedTypeSpec()};
-  if (!derivedTypeSpec && !dtScope.IsKindParameterizedDerivedType() &&
+  if (!derivedTypeSpec && !dtScope.IsDerivedTypeWithKindParameter() &&
       dtScope.symbol()) {
     // This derived type was declared (obviously, there's a Scope) but never
     // used in this compilation (no instantiated DerivedTypeSpec points here).
@@ -433,7 +432,7 @@
   AddValue(dtValues, derivedTypeSchema_, "name"s,
       SaveNameAsPointerTarget(scope, typeName));
   bool isPDTdefinitionWithKindParameters{
-      !derivedTypeSpec && dtScope.IsKindParameterizedDerivedType()};
+      !derivedTypeSpec && dtScope.IsDerivedTypeWithKindParameter()};
   if (!isPDTdefinitionWithKindParameters) {
     auto sizeInBytes{static_cast<common::ConstantSubscript>(dtScope.size())};
     if (auto alignment{dtScope.alignment().value_or(0)}) {
Index: flang/lib/Semantics/compute-offsets.cpp
===================================================================
--- flang/lib/Semantics/compute-offsets.cpp
+++ flang/lib/Semantics/compute-offsets.cpp
@@ -68,7 +68,7 @@
   for (Scope &child : scope.children()) {
     ComputeOffsets(context_, child);
   }
-  if (scope.symbol() && scope.IsKindParameterizedDerivedType()) {
+  if (scope.symbol() && scope.IsDerivedTypeWithKindParameter()) {
     return; // only process instantiations of kind parameterized derived types
   }
   if (scope.alignment().has_value()) {
Index: flang/include/flang/Semantics/scope.h
===================================================================
--- flang/include/flang/Semantics/scope.h
+++ flang/include/flang/Semantics/scope.h
@@ -104,7 +104,7 @@
   bool IsParameterizedDerivedTypeInstantiation() const {
     return kind_ == Kind::DerivedType && !symbol_;
   }
-  bool IsKindParameterizedDerivedType() const;
+  bool IsDerivedTypeWithKindParameter() const;
   Symbol *symbol() { return symbol_; }
   const Symbol *symbol() const { return symbol_; }
   SemanticsContext &context() const { return context_; }
Index: flang/include/flang/Optimizer/CodeGen/CodeGen.h
===================================================================
--- flang/include/flang/Optimizer/CodeGen/CodeGen.h
+++ flang/include/flang/Optimizer/CodeGen/CodeGen.h
@@ -38,12 +38,12 @@
 /// FIR to LLVM translation pass options.
 struct FIRToLLVMPassOptions {
   // Do not fail when type descriptors are not found when translating
-  // operations that uses them at the LLVM level like fir.embox. Instead,
+  // operations that use them at the LLVM level like fir.embox. Instead,
   // just use a null pointer.
   // This is useful to test translating programs manually written where a
   // frontend did not generate type descriptor data structures. However, note
-  // that this programs would crash at runtime if the derived type descriptors
-  // are required by the runtime, so this only an option to help debugging.
+  // that such programs would crash at runtime if the derived type descriptors
+  // are required by the runtime, so this is only an option to help debugging.
   bool ignoreMissingTypeDescriptors = false;
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121470.414672.patch
Type: text/x-patch
Size: 4195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220311/63246c34/attachment-0001.bin>


More information about the flang-commits mailing list