diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-07-05 01:42:07 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-07-05 01:42:07 +0000 |
commit | e03a65458135813f680420760c4a14a99c24995f (patch) | |
tree | fb9e14410e3f5d57c9ba3a73ea33e094391e6203 /clang/lib/Sema/Sema.cpp | |
parent | b320ef9fab604326507e011bf04aab17dd84a7d6 (diff) | |
download | bcm5719-llvm-e03a65458135813f680420760c4a14a99c24995f.tar.gz bcm5719-llvm-e03a65458135813f680420760c4a14a99c24995f.zip |
[modules ts] Declarations from a module interface unit are only visible outside
the module if declared in an export block.
llvm-svn: 307115
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 34f5e26be81..dc9f977d41a 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -705,6 +705,18 @@ void Sema::emitAndClearUnusedLocalTypedefWarnings() { UnusedLocalTypedefNameCandidates.clear(); } +/// This is called before the very first declaration in the translation unit +/// is parsed. Note that the ASTContext may have already injected some +/// declarations. +void Sema::ActOnStartOfTranslationUnit() { + if (getLangOpts().ModulesTS) { + // We start in the global module; all those declarations are implicitly + // module-private (though they do not have module linkage). + Context.getTranslationUnitDecl()->setModuleOwnershipKind( + Decl::ModuleOwnershipKind::ModulePrivate); + } +} + /// ActOnEndOfTranslationUnit - This is called at the very end of the /// translation unit when EOF is reached and all but the top-level scope is /// popped. |