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

via flang-commits flang-commits at lists.llvm.org
Fri Feb 2 07:23:55 PST 2024


================
@@ -0,0 +1,39 @@
+//===-- include/flang/Semantics/module-dependences.h ------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef FORTRAN_SEMANTICS_MODULE_DEPENDENCES_H_
+#define FORTRAN_SEMANTICS_MODULE_DEPENDENCES_H_
+
+#include <cinttypes>
+#include <map>
+#include <optional>
+#include <string>
+
+namespace Fortran::semantics {
+
+using ModuleCheckSumType = std::uint64_t;
+
+class ModuleDependences {
+public:
+  void AddDependence(std::string &&name, ModuleCheckSumType hash) {
+    map_.emplace(std::move(name), hash);
----------------
jeanPerier wrote:

Maybe it would be worth complaining if there is already a conflicting hash that was added to prevent these bad usages (that may also be caused if File1 and File 2 were the same but File3 was outdated and not File4 or vice/versa).

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


More information about the flang-commits mailing list