diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-09-26 21:27:23 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-09-26 21:27:23 +0000 |
commit | 92f23b6427c9004574b36eac34215b9ae19c552f (patch) | |
tree | 320dc6ef8e13f8b989bcba166b4590d1fd1f8d46 /lib/AST/DeclBase.cpp | |
parent | 502c875215dbac3f60d161223595bbd7105fb183 (diff) |
[Modules TS] Diagnose 'export' declaration within 'export' declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282443 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r-- | lib/AST/DeclBase.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index cea511b511..77e74b044f 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -377,6 +377,22 @@ bool Decl::isReferenced() const { return false; } +bool Decl::isExported() const { + if (isModulePrivate()) + return false; + // Namespaces are always exported. + if (isa<TranslationUnitDecl>(this) || isa<NamespaceDecl>(this)) + return true; + // Otherwise, this is a strictly lexical check. + for (auto *DC = getLexicalDeclContext(); DC; DC = DC->getLexicalParent()) { + if (cast<Decl>(DC)->isModulePrivate()) + return false; + if (isa<ExportDecl>(DC)) + return true; + } + return false; +} + bool Decl::hasDefiningAttr() const { return hasAttr<AliasAttr>() || hasAttr<IFuncAttr>(); } |