[flang-commits] [flang] [flang] Use module file hashes for more checking and disambiguation (PR #80354)

via flang-commits flang-commits at lists.llvm.org
Thu Feb 29 08:24:46 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff fc8d48106387b8b79531902788ef93571f924da7 9f850db066512fa92fa615da912f3178f9f35332 -- flang/include/flang/Semantics/module-dependences.h flang/include/flang/Parser/source.h flang/include/flang/Semantics/semantics.h flang/include/flang/Semantics/symbol.h flang/lib/Parser/source.cpp flang/lib/Semantics/mod-file.cpp flang/lib/Semantics/mod-file.h flang/lib/Semantics/resolve-names.cpp flang/lib/Semantics/resolve-names.h flang/lib/Semantics/semantics.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/include/flang/Semantics/module-dependences.h b/flang/include/flang/Semantics/module-dependences.h
index b9ed9fcc1d..29813a19a4 100644
--- a/flang/include/flang/Semantics/module-dependences.h
+++ b/flang/include/flang/Semantics/module-dependences.h
@@ -20,20 +20,23 @@ using ModuleCheckSumType = std::uint64_t;
 
 class ModuleDependences {
 public:
-  void AddDependence(std::string &&name, bool intrinsic, ModuleCheckSumType hash) {
+  void AddDependence(
+      std::string &&name, bool intrinsic, ModuleCheckSumType hash) {
     if (intrinsic) {
       intrinsicMap_.emplace(std::move(name), hash);
     } else {
       nonIntrinsicMap_.emplace(std::move(name), hash);
     }
   }
-  std::optional<ModuleCheckSumType> GetRequiredHash(const std::string &name, bool intrinsic) {
+  std::optional<ModuleCheckSumType> GetRequiredHash(
+      const std::string &name, bool intrinsic) {
     if (intrinsic) {
       if (auto iter{intrinsicMap_.find(name)}; iter != intrinsicMap_.end()) {
         return iter->second;
       }
     } else {
-      if (auto iter{nonIntrinsicMap_.find(name)}; iter != nonIntrinsicMap_.end()) {
+      if (auto iter{nonIntrinsicMap_.find(name)};
+          iter != nonIntrinsicMap_.end()) {
         return iter->second;
       }
     }
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp
index 840c78d537..c8d9ded5c7 100644
--- a/flang/lib/Semantics/mod-file.cpp
+++ b/flang/lib/Semantics/mod-file.cpp
@@ -1279,8 +1279,8 @@ Scope *ModFileReader::Read(SourceName name, std::optional<bool> isIntrinsic,
     }
     ancestorName = ancestor->GetName().value().ToString();
   }
-  auto requiredHash{
-      context_.moduleDependences().GetRequiredHash(name.ToString(), isIntrinsic.value_or(false))};
+  auto requiredHash{context_.moduleDependences().GetRequiredHash(
+      name.ToString(), isIntrinsic.value_or(false))};
   if (!isIntrinsic.value_or(false) && !ancestor) {
     // Already present in the symbol table as a usable non-intrinsic module?
     auto it{context_.globalScope().find(name)};
@@ -1353,7 +1353,8 @@ Scope *ModFileReader::Read(SourceName name, std::optional<bool> isIntrinsic,
       options.searchDirectories.push_back(dir);
     }
     if (!requiredHash) {
-      requiredHash = context_.moduleDependences().GetRequiredHash(name.ToString(), true);
+      requiredHash =
+          context_.moduleDependences().GetRequiredHash(name.ToString(), true);
     }
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/80354


More information about the flang-commits mailing list