[flang-commits] [clang] [flang] [mlir] [Flang][Driver] Added support for -funique-internal-linkage-names option (PR #216680)

Kaviya Rajendiran via flang-commits flang-commits at lists.llvm.org
Fri Aug 28 03:48:21 PDT 2026


================
@@ -1220,9 +1220,15 @@ class FirConverter : public Fortran::lower::AbstractConverter {
   }
   std::string
   mangleName(const Fortran::semantics::Symbol &symbol) override final {
-    return Fortran::lower::mangle::mangleName(
+    std::string mangledName = Fortran::lower::mangle::mangleName(
         symbol, scopeBlockIdMap, /*keepExternalInScope=*/false,
         getLoweringOptions().getUnderscoring());
+    const auto &hash = bridge.getModuleNameHash();
----------------
kaviya2510 wrote:

Your understanding is correct. The `hash.empty()` check is necessary because the hash is only populated when `-funique-internal-linkage-names` is passed.

When this option `funique-internal-linkage-names` is not used, hash remains empty and this check prevents appending an empty string (harmless but unnecessary) and makes it clear that the suffix is only added when the flag is passed.

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


More information about the flang-commits mailing list