[cfe-commits] r119935 - in /cfe/trunk: include/clang/Basic/FileManager.h lib/Lex/HeaderMap.cpp lib/Lex/HeaderSearch.cpp lib/Serialization/ASTReader.cpp tools/libclang/CIndex.cpp

Chris Lattner sabre at nondot.org
Sun Nov 21 01:55:08 PST 2010


Author: lattner
Date: Sun Nov 21 03:55:08 2010
New Revision: 119935

URL: http://llvm.org/viewvc/llvm-project?rev=119935&view=rev
Log:
remove old compatibility APIs, use StringRef versions instead.

Modified:
    cfe/trunk/include/clang/Basic/FileManager.h
    cfe/trunk/lib/Lex/HeaderMap.cpp
    cfe/trunk/lib/Lex/HeaderSearch.cpp
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/Basic/FileManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=119935&r1=119934&r2=119935&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/FileManager.h (original)
+++ cfe/trunk/include/clang/Basic/FileManager.h Sun Nov 21 03:55:08 2010
@@ -198,23 +198,12 @@
   ///
   const DirectoryEntry *getDirectory(llvm::StringRef Filename,
                                      const FileSystemOptions &FileSystemOpts);
-  const DirectoryEntry *getDirectory(const char *FileStart,const char *FileEnd,
-                                     const FileSystemOptions &FileSystemOpts) {
-    return getDirectory(llvm::StringRef(FileStart, FileEnd-FileStart),
-                        FileSystemOpts);
-  }
 
   /// getFile - Lookup, cache, and verify the specified file.  This returns null
   /// if the file doesn't exist.
   ///
   const FileEntry *getFile(llvm::StringRef Filename,
                            const FileSystemOptions &FileSystemOpts);
-  const FileEntry *getFile(const char *FilenameStart,
-                           const char *FilenameEnd,
-                           const FileSystemOptions &FileSystemOpts) {
-    return getFile(llvm::StringRef(FilenameStart, FilenameEnd-FilenameStart),
-                   FileSystemOpts);
-  }
 
   /// \brief Retrieve a file entry for a "virtual" file that acts as
   /// if there were a file with the given name on disk. The file

Modified: cfe/trunk/lib/Lex/HeaderMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderMap.cpp?rev=119935&r1=119934&r2=119935&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderMap.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderMap.cpp Sun Nov 21 03:55:08 2010
@@ -225,6 +225,6 @@
     llvm::SmallString<1024> DestPath;
     DestPath += getString(B.Prefix);
     DestPath += getString(B.Suffix);
-    return FM.getFile(DestPath.begin(), DestPath.end(), FileSystemOpts);
+    return FM.getFile(DestPath.str(), FileSystemOpts);
   }
 }

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=119935&r1=119934&r2=119935&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Sun Nov 21 03:55:08 2010
@@ -119,8 +119,7 @@
     TmpDir += getDir()->getName();
     TmpDir.push_back('/');
     TmpDir.append(Filename.begin(), Filename.end());
-    return HS.getFileMgr().getFile(TmpDir.begin(), TmpDir.end(),
-                                   HS.getFileSystemOpts());
+    return HS.getFileMgr().getFile(TmpDir.str(), HS.getFileSystemOpts());
   }
 
   if (isFramework())
@@ -187,8 +186,7 @@
 
   FrameworkName += "Headers/";
   FrameworkName.append(Filename.begin()+SlashPos+1, Filename.end());
-  if (const FileEntry *FE = FileMgr.getFile(FrameworkName.begin(),
-                                            FrameworkName.end(),
+  if (const FileEntry *FE = FileMgr.getFile(FrameworkName.str(),
                                             FileSystemOpts)) {
     return FE;
   }
@@ -197,8 +195,7 @@
   const char *Private = "Private";
   FrameworkName.insert(FrameworkName.begin()+OrigSize, Private,
                        Private+strlen(Private));
-  return FileMgr.getFile(FrameworkName.begin(), FrameworkName.end(),
-                         FileSystemOpts);
+  return FileMgr.getFile(FrameworkName.str(), FileSystemOpts);
 }
 
 
@@ -335,7 +332,7 @@
   FrameworkName += ".framework/";
 
   llvm::StringMapEntry<const DirectoryEntry *> &CacheLookup =
-    FrameworkMap.GetOrCreateValue(Filename.begin(), Filename.begin()+SlashPos);
+    FrameworkMap.GetOrCreateValue(Filename.substr(0, SlashPos));
 
   // Some other location?
   if (CacheLookup.getValue() &&
@@ -349,8 +346,7 @@
     ++NumSubFrameworkLookups;
 
     // If the framework dir doesn't exist, we fail.
-    const DirectoryEntry *Dir = FileMgr.getDirectory(FrameworkName.begin(),
-                                                     FrameworkName.end(),
+    const DirectoryEntry *Dir = FileMgr.getDirectory(FrameworkName.str(),
                                                      FileSystemOpts);
     if (Dir == 0) return 0;
 
@@ -365,15 +361,13 @@
   llvm::SmallString<1024> HeadersFilename(FrameworkName);
   HeadersFilename += "Headers/";
   HeadersFilename.append(Filename.begin()+SlashPos+1, Filename.end());
-  if (!(FE = FileMgr.getFile(HeadersFilename.begin(),
-                             HeadersFilename.end(), FileSystemOpts))) {
+  if (!(FE = FileMgr.getFile(HeadersFilename.str(), FileSystemOpts))) {
 
     // Check ".../Frameworks/HIToolbox.framework/PrivateHeaders/HIToolbox.h"
     HeadersFilename = FrameworkName;
     HeadersFilename += "PrivateHeaders/";
     HeadersFilename.append(Filename.begin()+SlashPos+1, Filename.end());
-    if (!(FE = FileMgr.getFile(HeadersFilename.begin(), HeadersFilename.end(),
-                               FileSystemOpts)))
+    if (!(FE = FileMgr.getFile(HeadersFilename.str(), FileSystemOpts)))
       return 0;
   }
 

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=119935&r1=119934&r2=119935&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Sun Nov 21 03:55:08 2010
@@ -1548,8 +1548,8 @@
 
       const char *FullFileNameStart = BlobStart + Record[3];
       const FileEntry *File
-        = PP->getFileManager().getFile(FullFileNameStart,
-                                     FullFileNameStart + (BlobLen - Record[3]),
+      = PP->getFileManager().getFile(llvm::StringRef(FullFileNameStart,
+                                                     BlobLen - Record[3]),
                                      FileSystemOpts);
 
       // FIXME: Stable encoding

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=119935&r1=119934&r2=119935&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Sun Nov 21 03:55:08 2010
@@ -2584,8 +2584,7 @@
   ASTUnit *CXXUnit = static_cast<ASTUnit *>(tu->TUData);
 
   FileManager &FMgr = CXXUnit->getFileManager();
-  const FileEntry *File = FMgr.getFile(file_name, file_name+strlen(file_name),
-                                       CXXUnit->getFileSystemOpts());
+  const FileEntry *File = FMgr.getFile(file_name, CXXUnit->getFileSystemOpts());
   return const_cast<FileEntry *>(File);
 }
 





More information about the cfe-commits mailing list