diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-01-14 17:21:00 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-01-14 17:21:00 +0000 |
commit | b6cbe517237c3c223beb064d60d5b49e56d65c06 (patch) | |
tree | 0eab28e6b330e8534f85b63ed8486be2354ecc5c /lib/Serialization/ASTReader.cpp | |
parent | 2c7739e3cbf1357c0ef8d894045a300331053565 (diff) |
Implement parsing, AST, (de-)serialization, and placeholder global
metadata for linking against the libraries/frameworks for imported
modules.
The module map language is extended with a new "link" directive that
specifies what library or framework to link against when a module is
imported, e.g.,
link "clangAST"
or
link framework "MyFramework"
Importing the corresponding module (or any of its submodules) will
eventually link against the named library/framework.
For now, I've added some placeholder global metadata that encodes the
imported libraries/frameworks, so that we can test that this
information gets through to the IR. The format of the data is still
under discussion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172437 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTReader.cpp')
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 2ed8853bb2..81d3cea7ba 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -3413,6 +3413,9 @@ bool ASTReader::ReadSubmoduleBlock(ModuleFile &F) { DeserializationListener->ModuleRead(GlobalID, CurrentModule); SubmodulesLoaded[GlobalIndex] = CurrentModule; + + // Clear out link libraries; the module file has them. + CurrentModule->LinkLibraries.clear(); break; } @@ -3600,6 +3603,20 @@ bool ASTReader::ReadSubmoduleBlock(ModuleFile &F) { Context.getTargetInfo()); break; } + + case SUBMODULE_LINK_LIBRARY: + if (First) { + Error("missing submodule metadata record at beginning of block"); + return true; + } + + if (!CurrentModule) + break; + + CurrentModule->LinkLibraries.push_back( + Module::LinkLibrary(StringRef(BlobStart, BlobLen), + Record[0])); + break; } } } |