summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-07-05 01:42:07 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-07-05 01:42:07 +0000
commite03a65458135813f680420760c4a14a99c24995f (patch)
treefb9e14410e3f5d57c9ba3a73ea33e094391e6203 /clang/lib/Sema/Sema.cpp
parentb320ef9fab604326507e011bf04aab17dd84a7d6 (diff)
downloadbcm5719-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.cpp12
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.
OpenPOWER on IntegriCloud