diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-11-30 00:36:36 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-11-30 00:36:36 +0000 |
commit | 71944203de65adf42c9fa9db7c4bd2b3c83ade1e (patch) | |
tree | 287237c4869b5e06f6888de89072b3e877cd5652 /clang/lib/Lex/PPDirectives.cpp | |
parent | 607fb707506ac6ab0d4bfb8334b9f3f7dc40c90a (diff) | |
download | bcm5719-llvm-71944203de65adf42c9fa9db7c4bd2b3c83ade1e.tar.gz bcm5719-llvm-71944203de65adf42c9fa9db7c4bd2b3c83ade1e.zip |
Switch the module-loading interfaces and parser from a simple
top-level module name to a module path (e.g., std.vector). We're still
missing a number of pieces for this actually to do something.
llvm-svn: 145462
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 88d9429f001..140f793234a 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1279,13 +1279,17 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, // If we are supposed to import a module rather than including the header, // do so now. if (SuggestedModule) { - // FIXME: Actually load the submodule that we were given. - while (SuggestedModule->Parent) - SuggestedModule = SuggestedModule->Parent; - - TheModuleLoader.loadModule(IncludeTok.getLocation(), - Identifiers.get(SuggestedModule->Name), - FilenameTok.getLocation()); + // Compute the module access path corresponding to this module. + // FIXME: Should we have a second loadModule() overload to avoid this + // extra lookup step? + llvm::SmallVector<std::pair<IdentifierInfo *, SourceLocation>, 2> Path; + for (ModuleMap::Module *Mod = SuggestedModule; Mod; Mod = Mod->Parent) + Path.push_back(std::make_pair(getIdentifierInfo(Mod->Name), + FilenameTok.getLocation())); + std::reverse(Path.begin(), Path.end()); + + // Load the module. + TheModuleLoader.loadModule(IncludeTok.getLocation(), Path); return; } |