summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Module.cpp
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-10-21 01:41:56 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-10-21 01:41:56 +0000
commited84df008f609f7245871a9b6d00b57cb19410aa (patch)
treef1023c080423e162cdcdc393264e04ad853ce7b0 /clang/lib/Basic/Module.cpp
parentd15477b09d3142b4301f6e7bc8835ec04d639f59 (diff)
downloadbcm5719-llvm-ed84df008f609f7245871a9b6d00b57cb19410aa.tar.gz
bcm5719-llvm-ed84df008f609f7245871a9b6d00b57cb19410aa.zip
[Modules] Add 'no_undeclared_includes' module map attribute
The 'no_undeclared_includes' attribute should be used in a module to tell that only non-modular headers and headers from used modules are accepted. The main motivation behind this is to prevent dep cycles between system libraries (such as darwin) and libc++. Patch by Richard Smith! llvm-svn: 284797
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r--clang/lib/Basic/Module.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index 8578947db82..80bbc24f3db 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -33,7 +33,7 @@ Module::Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent,
IsExplicit(IsExplicit), IsSystem(false), IsExternC(false),
IsInferred(false), InferSubmodules(false), InferExplicitSubmodules(false),
InferExportWildcard(false), ConfigMacrosExhaustive(false),
- NameVisibility(Hidden) {
+ NoUndeclaredIncludes(false), NameVisibility(Hidden) {
if (Parent) {
if (!Parent->isAvailable())
IsAvailable = false;
@@ -41,6 +41,8 @@ Module::Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent,
IsSystem = true;
if (Parent->IsExternC)
IsExternC = true;
+ if (Parent->NoUndeclaredIncludes)
+ NoUndeclaredIncludes = true;
IsMissingRequirement = Parent->IsMissingRequirement;
Parent->SubModuleIndex[Name] = Parent->SubModules.size();
@@ -181,6 +183,11 @@ bool Module::directlyUses(const Module *Requested) const {
for (auto *Use : Top->DirectUses)
if (Requested->isSubModuleOf(Use))
return true;
+
+ // Anyone is allowed to use our builtin stddef.h and its accompanying module.
+ if (!Requested->Parent && Requested->Name == "_Builtin_stddef_max_align_t")
+ return true;
+
return false;
}
OpenPOWER on IntegriCloud