[cfe-commits] r45106 - in /cfe/trunk: Driver/clang.cpp Lex/HeaderSearch.cpp clang.xcodeproj/project.pbxproj include/clang/Lex/DirectoryLookup.h include/clang/Lex/HeaderMap.h

Chris Lattner sabre at nondot.org
Mon Dec 17 09:57:27 PST 2007


Author: lattner
Date: Mon Dec 17 11:57:27 2007
New Revision: 45106

URL: http://llvm.org/viewvc/llvm-project?rev=45106&view=rev
Log:
Sink getName into DirectoryLookup to simplify the client in clang.

Modified:
    cfe/trunk/Driver/clang.cpp
    cfe/trunk/Lex/HeaderSearch.cpp
    cfe/trunk/clang.xcodeproj/project.pbxproj
    cfe/trunk/include/clang/Lex/DirectoryLookup.h
    cfe/trunk/include/clang/Lex/HeaderMap.h

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=45106&r1=45105&r2=45106&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Mon Dec 17 11:57:27 2007
@@ -858,16 +858,17 @@
     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");
   }

Modified: cfe/trunk/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/HeaderSearch.cpp?rev=45106&r1=45105&r2=45106&view=diff

==============================================================================
--- cfe/trunk/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/Lex/HeaderSearch.cpp Mon Dec 17 11:57:27 2007
@@ -82,6 +82,18 @@
 // 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,

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=45106&r1=45105&r2=45106&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Mon Dec 17 11:57:27 2007
@@ -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 = "";

Modified: cfe/trunk/include/clang/Lex/DirectoryLookup.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/DirectoryLookup.h?rev=45106&r1=45105&r2=45106&view=diff

==============================================================================
--- cfe/trunk/include/clang/Lex/DirectoryLookup.h (original)
+++ cfe/trunk/include/clang/Lex/DirectoryLookup.h Mon Dec 17 11:57:27 2007
@@ -76,10 +76,13 @@
     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 @@
   ///
   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 @@
   ///
   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, 

Modified: cfe/trunk/include/clang/Lex/HeaderMap.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderMap.h?rev=45106&r1=45105&r2=45106&view=diff

==============================================================================
--- cfe/trunk/include/clang/Lex/HeaderMap.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderMap.h Mon Dec 17 11:57:27 2007
@@ -38,6 +38,11 @@
   /// 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 ""; 
+  }
     
 };
 





More information about the cfe-commits mailing list