diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-27 19:52:33 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-27 19:52:33 +0000 |
commit | a686e1b05df915030897ec670d9cb15d2a6d0221 (patch) | |
tree | 0c45700a788869289d4dad2a57e18b4e317629bf /clang/lib/Lex/HeaderSearch.cpp | |
parent | 63fe5697f4d9f760fef8ec828d535deec296d119 (diff) | |
download | llvm-a686e1b05df915030897ec670d9cb15d2a6d0221.zip llvm-a686e1b05df915030897ec670d9cb15d2a6d0221.tar.gz llvm-a686e1b05df915030897ec670d9cb15d2a6d0221.tar.bz2 |
Introduce module attributes into the module map grammar, along with a
single attribute ("system") that allows us to mark a module as being a
"system" module. Each of the headers that makes up a system module is
considered to be a system header, so that we (for example) suppress
warnings there.
If a module is being inferred for a framework, and that framework
directory is within a system frameworks directory, infer it as a
system framework.
llvm-svn: 149143
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r-- | clang/lib/Lex/HeaderSearch.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 7af7c93..ff63bdb 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -134,7 +134,9 @@ const FileEntry *HeaderSearch::lookupModule(StringRef ModuleName, llvm::sys::path::append(FrameworkDirName, ModuleName + ".framework"); if (const DirectoryEntry *FrameworkDir = FileMgr.getDirectory(FrameworkDirName)) { - Module = getFrameworkModule(ModuleName, FrameworkDir); + bool IsSystem + = SearchDirs[Idx].getDirCharacteristic() != SrcMgr::C_User; + Module = getFrameworkModule(ModuleName, FrameworkDir, IsSystem); if (Module) break; } @@ -319,8 +321,10 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup( Module *Module = 0; if (SuggestedModule) { if (const DirectoryEntry *FrameworkDir - = FileMgr.getDirectory(FrameworkName)) - Module = HS.getFrameworkModule(ModuleName, FrameworkDir); + = FileMgr.getDirectory(FrameworkName)) { + bool IsSystem = getDirCharacteristic() != SrcMgr::C_User; + Module = HS.getFrameworkModule(ModuleName, FrameworkDir, IsSystem); + } } // Check "/System/Library/Frameworks/Cocoa.framework/Headers/file.h" @@ -858,7 +862,8 @@ Module *HeaderSearch::getModule(StringRef Name, bool AllowSearch) { } Module *HeaderSearch::getFrameworkModule(StringRef Name, - const DirectoryEntry *Dir) { + const DirectoryEntry *Dir, + bool IsSystem) { if (Module *Module = ModMap.findModule(Name)) return Module; @@ -907,7 +912,8 @@ Module *HeaderSearch::getFrameworkModule(StringRef Name, // Try to infer a module map from the top-level framework directory. Module *Result = ModMap.inferFrameworkModule(SubmodulePath.back(), - TopFrameworkDir, + TopFrameworkDir, + IsSystem, /*Parent=*/0); // Follow the submodule path to find the requested (sub)framework module |