diff options
author | David Blaikie <dblaikie@gmail.com> | 2017-01-30 05:00:26 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2017-01-30 05:00:26 +0000 |
commit | 9ffe5a352559434c6abb04639cea57f504767293 (patch) | |
tree | 8d09c027c00ae5bf3f7a0bbadb0cdd8a32561a1b /clang/lib/Lex/ModuleMap.cpp | |
parent | c95726ea39372286ebd3a28e3176921cddc65c62 (diff) | |
download | bcm5719-llvm-9ffe5a352559434c6abb04639cea57f504767293.tar.gz bcm5719-llvm-9ffe5a352559434c6abb04639cea57f504767293.zip |
Prototype of modules codegen
First pass at generating weak definitions of inline functions from module files
(& skipping (-O0) or emitting available_externally (optimizations)
definitions where those modules are used).
External functions defined in modules are emitted into the modular
object file as well (this may turn an existing ODR violation (if that
module were imported into multiple translations) into valid/linkable
code).
Internal symbols (static functions, for example) are not correctly
supported yet. The symbol will be produced, internal, in the modular
object - unreferenceable from the users.
Reviewers: rsmith
Differential Revision: https://reviews.llvm.org/D28845
llvm-svn: 293456
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r-- | clang/lib/Lex/ModuleMap.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 1488f624da6..1db5becac4b 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -91,6 +91,7 @@ ModuleMap::ModuleMap(SourceManager &SourceMgr, DiagnosticsEngine &Diags, HeaderInfo(HeaderInfo), BuiltinIncludeDir(nullptr), SourceModule(nullptr), NumCreatedModules(0) { MMapLangOpts.LineComment = true; + MMapLangOpts.ModularCodegen = LangOpts.ModularCodegen; } ModuleMap::~ModuleMap() { @@ -554,16 +555,17 @@ Module *ModuleMap::lookupModuleQualified(StringRef Name, Module *Context) const{ return Context->findSubmodule(Name); } -std::pair<Module *, bool> -ModuleMap::findOrCreateModule(StringRef Name, Module *Parent, bool IsFramework, - bool IsExplicit) { +std::pair<Module *, bool> ModuleMap::findOrCreateModule(StringRef Name, + Module *Parent, + bool IsFramework, + bool IsExplicit) { // Try to find an existing module with this name. if (Module *Sub = lookupModuleQualified(Name, Parent)) return std::make_pair(Sub, false); // Create a new module with this name. - Module *Result = new Module(Name, SourceLocation(), Parent, - IsFramework, IsExplicit, NumCreatedModules++); + Module *Result = new Module(Name, SourceLocation(), Parent, IsFramework, + IsExplicit, NumCreatedModules++); if (!Parent) { if (LangOpts.CurrentModule == Name) SourceModule = Result; @@ -1499,6 +1501,7 @@ void ModuleMapParser::parseModuleDecl() { (!ActiveModule->Parent && ModuleName == "Darwin")) ActiveModule->NoUndeclaredIncludes = true; ActiveModule->Directory = Directory; + ActiveModule->WithCodegen = L.getLangOpts().ModularCodegen; if (!ActiveModule->Parent) { StringRef MapFileName(ModuleMapFile->getName()); |