diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-11-17 22:44:56 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-11-17 22:44:56 +0000 |
commit | c04f6443115084b4cf00ca336020b80774465b73 (patch) | |
tree | d689dcd7677fe2949c74536da9644c8fc07b206e /clang/lib/Lex/PPDirectives.cpp | |
parent | ee95ed5055ca307a041597f1ba300ae120a76c72 (diff) | |
download | bcm5719-llvm-c04f6443115084b4cf00ca336020b80774465b73.tar.gz bcm5719-llvm-c04f6443115084b4cf00ca336020b80774465b73.zip |
When making a suggestion regarding which module to load rather than
preprocess/parse a header, report back with an actual module (which
may be a submodule) rather than just the name of the module.
llvm-svn: 144925
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 9446d51f9d2..2444364f358 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -486,7 +486,7 @@ const FileEntry *Preprocessor::LookupFile( const DirectoryLookup *&CurDir, SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath, - StringRef *SuggestedModule) { + ModuleMap::Module **SuggestedModule) { // If the header lookup mechanism may be relative to the current file, pass in // info about where the current file is. const FileEntry *CurFileEnt = 0; @@ -1269,7 +1269,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, llvm::SmallString<1024> RelativePath; // We get the raw path only if we have 'Callbacks' to which we later pass // the path. - StringRef SuggestedModule; + ModuleMap::Module *SuggestedModule = 0; const FileEntry *File = LookupFile( Filename, isAngled, LookupFrom, CurDir, Callbacks ? &SearchPath : NULL, Callbacks ? &RelativePath : NULL, @@ -1277,9 +1277,13 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, // If we are supposed to import a module rather than including the header, // do so now. - if (!SuggestedModule.empty()) { + if (SuggestedModule) { + // FIXME: Actually load the submodule that we were given. + while (SuggestedModule->Parent) + SuggestedModule = SuggestedModule->Parent; + TheModuleLoader.loadModule(IncludeTok.getLocation(), - Identifiers.get(SuggestedModule), + Identifiers.get(SuggestedModule->Name), FilenameTok.getLocation()); return; } |