diff options
author | Nathan Sidwell <nathan@acm.org> | 2022-09-01 10:21:24 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2022-10-17 09:30:50 -0700 |
commit | 245da0a451e193dc4229ed8aed28cf34fa083ed4 (patch) | |
tree | 5e05b3445aaa999751b18bd98daffd0dcf3de324 /clang/lib/Basic/Module.cpp | |
parent | c870f2067a3bffbb06a5b549321564b5dfbd5481 (diff) | |
download | llvm-245da0a451e193dc4229ed8aed28cf34fa083ed4.zip llvm-245da0a451e193dc4229ed8aed28cf34fa083ed4.tar.gz llvm-245da0a451e193dc4229ed8aed28cf34fa083ed4.tar.bz2 |
[modules] Fix callback argument thinko
VisbleModuleSet::setVisible takes a callback, to inform of modules
being made (transitively) visible. However, we were calling it as
'Vis(M)' from a recursive lambda, where 'M' is a capture of
setVisible's M, module parameter. Thus we can invoke the callback
multiple times, passing the same value to it each time.
Everywhere else in the lambda, we refer to V.M of the lambda's
Visiting parameter. We should be doing so for the callback. Thus
we'll pass the outermost module on the outermost recursive call, and
as we descend the imports, we'll pass each import to the callback.
Reviewed By: iains
Differential Revision: https://reviews.llvm.org/D135958
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r-- | clang/lib/Basic/Module.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 17b8318..9a58fae 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -653,7 +653,7 @@ void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc, return; ImportLocs[ID] = Loc; - Vis(M); + Vis(V.M); // Make any exported modules visible. SmallVector<Module *, 16> Exports; |