Skip to content

clang-scan-deps strips the suffix .private from module names #149594

@illiminable

Description

@illiminable

Version 20.1.7

As far as I'm aware it's allowed to call a c++ module eg. foo.private. And the .private is just a string part of the name and not semantically meaningful (ie. this is not :private) . However if you run clang-scan-deps on a file that imports a module with that name it reports that the logical name it requires is just foo. Which would cause the wrong module to potentially be used or failure.

eg.

// main.cc
import foo.private;

int main() {
  return 0;
}

$ clang-scan-deps -format=p1689 -- clang++ -std=c++20 -c main.cc

{
  "revision": 0,
  "rules": [
    {
      "primary-output": "main.o",
      "requires": [
        {
          "logical-name": "foo"
        }
      ]
    }
  ],
  "version": 1
}

I assume that this is leaking of the implementation of the pre-standardized modules, but maybe just an oversight.

When importing "foo.bar", "fooprivate", "foo.internal", "foo_private", "foo.Private" the behavior is as expected that the full name is respected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions