diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-17 17:57:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-17 17:57:27 +0000 |
commit | 3af66a9335966e9114e660cf7aafbb9272190ec2 (patch) | |
tree | 40149e2916dde3b70835647c84cc0a600ab69782 | |
parent | fc591acc68050ab882fd242f0df2ad9196a1f3d7 (diff) |
Sink getName into DirectoryLookup to simplify the client in clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45106 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Driver/clang.cpp | 11 | ||||
-rw-r--r-- | Lex/HeaderSearch.cpp | 12 | ||||
-rw-r--r-- | clang.xcodeproj/project.pbxproj | 1 | ||||
-rw-r--r-- | include/clang/Lex/DirectoryLookup.h | 19 | ||||
-rw-r--r-- | include/clang/Lex/HeaderMap.h | 5 |
5 files changed, 36 insertions, 12 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 247174e7a1..05b6a0f1fe 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -858,16 +858,17 @@ static void InitializeIncludePaths(HeaderSearch &Headers, FileManager &FM, for (unsigned i = 0, e = SearchList.size(); i != e; ++i) { if (i == QuotedIdx) fprintf(stderr, "#include <...> search starts here:\n"); + const char *Name = SearchList[i].getName(); + const char *Suffix; if (SearchList[i].isNormalDir()) - fprintf(stderr, " %s\n", SearchList[i].getDir()->getName()); + Suffix = ""; else if (SearchList[i].isFramework()) - fprintf(stderr, " %s (framework directory)\n", - SearchList[i].getFrameworkDir()->getName()); + Suffix = " (framework directory)"; else { assert(SearchList[i].isHeaderMap() && "Unknown DirectoryLookup"); - //fprintf(stderr, " %s (headermap)\n", - // SearchList[i].getHeaderMap()->getName()); + Suffix = " (headermap)"; } + fprintf(stderr, " %s%s\n", Name, Suffix); } fprintf(stderr, "End of search list.\n"); } diff --git a/Lex/HeaderSearch.cpp b/Lex/HeaderSearch.cpp index 1d79effc84..99d0d52f11 100644 --- a/Lex/HeaderSearch.cpp +++ b/Lex/HeaderSearch.cpp @@ -82,6 +82,18 @@ const HeaderMap *HeaderSearch::CreateHeaderMap(const FileEntry *FE, // File lookup within a DirectoryLookup scope //===----------------------------------------------------------------------===// +/// getName - Return the directory or filename corresponding to this lookup +/// object. +const char *DirectoryLookup::getName() const { + if (isNormalDir()) + return getDir()->getName(); + if (isFramework()) + return getFrameworkDir()->getName(); + assert(isHeaderMap() && "Unknown DirectoryLookup"); + return getHeaderMap()->getFileName(); +} + + /// LookupFile - Lookup the specified file in this search path, returning it /// if it exists or returning null if not. const FileEntry *DirectoryLookup::LookupFile(const char *FilenameStart, diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj index cf12634213..4fefff29f4 100644 --- a/clang.xcodeproj/project.pbxproj +++ b/clang.xcodeproj/project.pbxproj @@ -780,7 +780,6 @@ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */; - compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 1; mainGroup = 08FB7794FE84155DC02AAC07 /* clang */; projectDirPath = ""; diff --git a/include/clang/Lex/DirectoryLookup.h b/include/clang/Lex/DirectoryLookup.h index d1145840f4..df9b4229dc 100644 --- a/include/clang/Lex/DirectoryLookup.h +++ b/include/clang/Lex/DirectoryLookup.h @@ -76,10 +76,13 @@ public: u.Map = map; } - /// LookupFile - Lookup the specified file in this search path, returning it - /// if it exists or returning null if not. - const FileEntry *LookupFile(const char *FilenameStart, - const char *FilenameEnd, HeaderSearch &HS) const; + /// getLookupType - Return the kind of directory lookup that this is: either a + /// normal directory, a framework path, or a HeaderMap. + LookupType_t getLookupType() const { return (LookupType_t)LookupType; } + + /// getName - Return the directory or filename corresponding to this lookup + /// object. + const char *getName() const; /// getDir - Return the directory that this entry refers to. /// @@ -95,8 +98,6 @@ public: /// const HeaderMap *getHeaderMap() const { return isHeaderMap() ? u.Map : 0; } - LookupType_t getLookupType() const { return (LookupType_t)LookupType; } - /// isNormalDir - Return true if this is a normal directory, not a header map. bool isNormalDir() const { return getLookupType() == LT_NormalDir; } @@ -115,6 +116,12 @@ public: /// bool isUserSupplied() const { return UserSupplied; } + + /// LookupFile - Lookup the specified file in this search path, returning it + /// if it exists or returning null if not. + const FileEntry *LookupFile(const char *FilenameStart, + const char *FilenameEnd, HeaderSearch &HS) const; + private: const FileEntry *DoFrameworkLookup(const char *FilenameStart, const char *FilenameEnd, diff --git a/include/clang/Lex/HeaderMap.h b/include/clang/Lex/HeaderMap.h index 48e00bf375..8b1669f86b 100644 --- a/include/clang/Lex/HeaderMap.h +++ b/include/clang/Lex/HeaderMap.h @@ -38,6 +38,11 @@ public: /// this HeaderMap. If so, open it and return its FileEntry. const FileEntry *LookupFile(const char *FilenameStart,const char *FilenameEnd, FileManager &FM) const; + + /// getFileName - Return the filename of the headermap. + const char *getFileName() const { + return ""; + } }; |