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

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Fri Feb 2 08:21:26 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);
----------------
klausler wrote:

I think that I mentioned this in the commit comment.  Supporting multiple modules with the same name and distinct hashes is something we might consider doing in the future.  An attempt to do this now should get an error message about the module having the wrong checksum on its second use.

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


More information about the flang-commits mailing list