================
@@ -145,12 +146,17 @@ class ExternalASTSource : public 
RefCountedBase<ExternalASTSource> {
   /// Find all declarations with the given name in the given context,
   /// and add them to the context by calling SetExternalVisibleDeclsForName
   /// or SetNoExternalVisibleDeclsForName.
+  /// \param NamedModule, when this is set the external module local
+  /// declarations within the same module of \param NamedModule will be found
+  /// too. The \param NamedModule may be different than the owning module of
+  /// \param DC since the same namespace can appear in multiple module units.
----------------
ChuanqiXu9 wrote:

I updated the description.

> My understanding of modules is probably insufficient but what are "external 
> module local declarations within the same module"?

If you're still interested, I can explain this to you with a few examples:

```
// a.cppm
export module a;
int a() { return 43; } ; // a module-local declaration.

// a-impl.cc
module a:impl;
int use() { return a(); } // valid. Since we're in the same module `a` with 
`a()`. 

// use.cc
import a;
int get() { return a(); } // error: not in the same module with a()
```

The function `a()` in `a.cppm` has module linkage. And it is only visible to 
module `a`. So I called it as a `module local declaration`. And for 
`a-impl.cc`, from the perspective of compilation, the declaration `a()` is 
external. So it is `external module local declaration`. Then for `use()` in 
`a-impl.cc` and `a` in `a.cppm`, they are in the same module. So, for `use()` 
in `a-impl.cc`, `a()` is "an external module local declaration within the same 
module".

But given this may be confusing, I used the new description.

https://github.com/llvm/llvm-project/pull/122887
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to