[cfe-commits] r120010 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Frontend/ include/clang/Lex/ include/clang/Serialization/ lib/AST/ lib/Basic/ lib/Frontend/ lib/Lex/ lib/Serialization/ tools/libclang/

Chris Lattner sabre at nondot.org
Tue Nov 23 00:35:13 PST 2010


Author: lattner
Date: Tue Nov 23 02:35:12 2010
New Revision: 120010

URL: http://llvm.org/viewvc/llvm-project?rev=120010&view=rev
Log:
now the FileManager has a FileSystemOpts ivar, stop threading
FileSystemOpts through a ton of apis, simplifying a lot of code.
This also fixes a latent bug in ASTUnit where it would invoke
methods on FileManager without creating one in some code paths
in cindextext.

Modified:
    cfe/trunk/include/clang/AST/ASTImporter.h
    cfe/trunk/include/clang/Basic/FileManager.h
    cfe/trunk/include/clang/Basic/SourceManager.h
    cfe/trunk/include/clang/Frontend/CompilerInstance.h
    cfe/trunk/include/clang/Frontend/Utils.h
    cfe/trunk/include/clang/Lex/HeaderMap.h
    cfe/trunk/include/clang/Lex/HeaderSearch.h
    cfe/trunk/include/clang/Lex/PTHManager.h
    cfe/trunk/include/clang/Lex/Preprocessor.h
    cfe/trunk/include/clang/Serialization/ASTReader.h
    cfe/trunk/lib/AST/ASTImporter.cpp
    cfe/trunk/lib/Basic/FileManager.cpp
    cfe/trunk/lib/Basic/SourceManager.cpp
    cfe/trunk/lib/Frontend/ASTMerge.cpp
    cfe/trunk/lib/Frontend/ASTUnit.cpp
    cfe/trunk/lib/Frontend/CompilerInstance.cpp
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/lib/Frontend/FrontendAction.cpp
    cfe/trunk/lib/Frontend/FrontendActions.cpp
    cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
    cfe/trunk/lib/Frontend/InitPreprocessor.cpp
    cfe/trunk/lib/Lex/HeaderMap.cpp
    cfe/trunk/lib/Lex/HeaderSearch.cpp
    cfe/trunk/lib/Lex/PTHLexer.cpp
    cfe/trunk/lib/Lex/Preprocessor.cpp
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/tools/libclang/CIndex.cpp
    cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp

Modified: cfe/trunk/include/clang/AST/ASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTImporter.h?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTImporter.h (original)
+++ cfe/trunk/include/clang/AST/ASTImporter.h Tue Nov 23 02:35:12 2010
@@ -28,7 +28,6 @@
   class Diagnostic;
   class Expr;
   class FileManager;
-  class FileSystemOptions;
   class IdentifierInfo;
   class NestedNameSpecifier;
   class Stmt;
@@ -47,8 +46,6 @@
     /// \brief The file managers we're importing to and from.
     FileManager &ToFileManager, &FromFileManager;
 
-    const FileSystemOptions &ToFileSystemOpts, &FromFileSystemOpts;
-    
     /// \brief Mapping from the already-imported types in the "from" context
     /// to the corresponding types in the "to" context.
     llvm::DenseMap<Type *, Type *> ImportedTypes;
@@ -75,9 +72,7 @@
     
   public:
     ASTImporter(ASTContext &ToContext, FileManager &ToFileManager,
-                const FileSystemOptions &ToFileSystemOpts,
-                ASTContext &FromContext, FileManager &FromFileManager,
-                const FileSystemOptions &FromFileSystemOpts);
+                ASTContext &FromContext, FileManager &FromFileManager);
     
     virtual ~ASTImporter();
     

Modified: cfe/trunk/include/clang/Basic/FileManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/FileManager.h (original)
+++ cfe/trunk/include/clang/Basic/FileManager.h Tue Nov 23 02:35:12 2010
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_FILEMANAGER_H
 #define LLVM_CLANG_FILEMANAGER_H
 
+#include "clang/Basic/FileSystemOptions.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -33,7 +34,6 @@
 
 namespace clang {
 class FileManager;
-class FileSystemOptions;
 
 /// DirectoryEntry - Cached information about one directory on the disk.
 ///
@@ -141,7 +141,7 @@
 /// names (e.g. symlinked) will be treated as a single file.
 ///
 class FileManager {
-  const FileSystemOptions &FileSystemOpts;
+  FileSystemOptions FileSystemOpts;
   
   class UniqueDirContainer;
   class UniqueFileContainer;
@@ -196,32 +196,26 @@
   /// getDirectory - Lookup, cache, and verify the specified directory.  This
   /// returns null if the directory doesn't exist.
   ///
-  const DirectoryEntry *getDirectory(llvm::StringRef Filename,
-                                     const FileSystemOptions &FileSystemOpts);
+  const DirectoryEntry *getDirectory(llvm::StringRef Filename);
 
   /// 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(llvm::StringRef Filename);
 
   /// \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
   /// itself is not accessed.
   const FileEntry *getVirtualFile(llvm::StringRef Filename, off_t Size,
-                                  time_t ModificationTime,
-                                  const FileSystemOptions &FileSystemOpts);
+                                  time_t ModificationTime);
 
   /// \brief Open the specified file as a MemoryBuffer, returning a new
   /// MemoryBuffer if successful, otherwise returning null.
   llvm::MemoryBuffer *getBufferForFile(const FileEntry *Entry,
-                                       const FileSystemOptions &FileSystemOpts,
                                        std::string *ErrorStr = 0) {
-    return getBufferForFile(Entry->getName(), FileSystemOpts,
-                            ErrorStr, Entry->getSize());
+    return getBufferForFile(Entry->getName(), ErrorStr, Entry->getSize());
   }
   llvm::MemoryBuffer *getBufferForFile(llvm::StringRef Filename,
-                                       const FileSystemOptions &FileSystemOpts,
                                        std::string *ErrorStr = 0,
                                        int64_t FileSize = -1);
 

Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Tue Nov 23 02:35:12 2010
@@ -33,7 +33,6 @@
 class Diagnostic;
 class SourceManager;
 class FileManager;
-class FileSystemOptions;
 class FileEntry;
 class LineTableInfo;
   
@@ -372,7 +371,6 @@
   Diagnostic &Diag;
 
   FileManager &FileMgr;
-  const FileSystemOptions &FileSystemOpts;
 
   mutable llvm::BumpPtrAllocator ContentCacheAlloc;
 
@@ -431,8 +429,7 @@
   explicit SourceManager(const SourceManager&);
   void operator=(const SourceManager&);
 public:
-  SourceManager(Diagnostic &Diag, FileManager &FileMgr,
-                const FileSystemOptions &FSOpts);
+  SourceManager(Diagnostic &Diag, FileManager &FileMgr);
   ~SourceManager();
 
   void clearIDTables();
@@ -440,7 +437,6 @@
   Diagnostic &getDiagnostics() const { return Diag; }
 
   FileManager &getFileManager() const { return FileMgr; }
-  const FileSystemOptions &getFileSystemOpts() const { return FileSystemOpts; }
 
   //===--------------------------------------------------------------------===//
   // MainFileID creation and querying methods.

Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Tue Nov 23 02:35:12 2010
@@ -515,8 +515,7 @@
   void createFileManager();
 
   /// Create the source manager and replace any existing one with it.
-  void createSourceManager(FileManager &FileMgr,
-                           const FileSystemOptions &FSOpts);
+  void createSourceManager(FileManager &FileMgr);
 
   /// Create the preprocessor, using the invocation, file, and source managers,
   /// and replace any existing one with it.
@@ -534,7 +533,6 @@
                                           const DependencyOutputOptions &,
                                           const TargetInfo &,
                                           const FrontendOptions &,
-                                          const FileSystemOptions &,
                                           SourceManager &, FileManager &);
 
   /// Create the AST context.
@@ -635,7 +633,6 @@
   static bool InitializeSourceManager(llvm::StringRef InputFile,
                                       Diagnostic &Diags,
                                       FileManager &FileMgr,
-                                      const FileSystemOptions &FSOpts,
                                       SourceManager &SourceMgr,
                                       const FrontendOptions &Opts);
 

Modified: cfe/trunk/include/clang/Frontend/Utils.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/Utils.h?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/Utils.h (original)
+++ cfe/trunk/include/clang/Frontend/Utils.h Tue Nov 23 02:35:12 2010
@@ -39,7 +39,6 @@
 class Stmt;
 class TargetInfo;
 class FrontendOptions;
-class FileSystemOptions;
 
 /// Normalize \arg File for use in a user defined #include directive (in the
 /// predefines buffer).
@@ -54,7 +53,6 @@
 /// InitializePreprocessor - Initialize the preprocessor getting it and the
 /// environment ready to process a single file.
 void InitializePreprocessor(Preprocessor &PP,
-                            const FileSystemOptions &FSOpts,
                             const PreprocessorOptions &PPOpts,
                             const HeaderSearchOptions &HSOpts,
                             const FrontendOptions &FEOpts);

Modified: cfe/trunk/include/clang/Lex/HeaderMap.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderMap.h?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/HeaderMap.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderMap.h Tue Nov 23 02:35:12 2010
@@ -21,7 +21,6 @@
 namespace clang {
   class FileEntry;
   class FileManager;
-  class FileSystemOptions;
   struct HMapBucket;
   struct HMapHeader;
 
@@ -44,13 +43,11 @@
 
   /// HeaderMap::Create - This attempts to load the specified file as a header
   /// map.  If it doesn't look like a HeaderMap, it gives up and returns null.
-  static const HeaderMap *Create(const FileEntry *FE, FileManager &FM,
-                                 const FileSystemOptions &FSOpts);
+  static const HeaderMap *Create(const FileEntry *FE, FileManager &FM);
 
   /// LookupFile - Check to see if the specified relative filename is located in
   /// this HeaderMap.  If so, open it and return its FileEntry.
-  const FileEntry *LookupFile(llvm::StringRef Filename, FileManager &FM,
-                              const FileSystemOptions &FileSystemOpts) const;
+  const FileEntry *LookupFile(llvm::StringRef Filename, FileManager &FM) const;
 
   /// getFileName - Return the filename of the headermap.
   const char *getFileName() const;

Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderSearch.h Tue Nov 23 02:35:12 2010
@@ -23,7 +23,6 @@
 class ExternalIdentifierLookup;
 class FileEntry;
 class FileManager;
-class FileSystemOptions;
 class IdentifierInfo;
 
 /// HeaderFileInfo - The preprocessor keeps track of this information for each
@@ -72,8 +71,6 @@
 /// file referenced by a #include or #include_next, (sub-)framework lookup, etc.
 class HeaderSearch {
   FileManager &FileMgr;
-  const FileSystemOptions &FileSystemOpts;
-
   /// #include search path information.  Requests for #include "x" search the
   /// directory of the #including file first, then each directory in SearchDirs
   /// consequtively. Requests for <x> search the current dir first, then each
@@ -120,11 +117,10 @@
   explicit HeaderSearch(const HeaderSearch&);
   void operator=(const HeaderSearch&);
 public:
-  HeaderSearch(FileManager &FM, const FileSystemOptions &FSOpts);
+  HeaderSearch(FileManager &FM);
   ~HeaderSearch();
 
   FileManager &getFileMgr() const { return FileMgr; }
-  const FileSystemOptions &getFileSystemOpts() const { return FileSystemOpts; }
 
   /// SetSearchPaths - Interface for setting the file search paths.
   ///

Modified: cfe/trunk/include/clang/Lex/PTHManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PTHManager.h?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/PTHManager.h (original)
+++ cfe/trunk/include/clang/Lex/PTHManager.h Tue Nov 23 02:35:12 2010
@@ -120,7 +120,6 @@
   /// Create - This method creates PTHManager objects.  The 'file' argument
   ///  is the name of the PTH file.  This method returns NULL upon failure.
   static PTHManager *Create(const std::string& file, FileManager &FileMgr,
-                            const FileSystemOptions &FSOpts,
                             Diagnostic &Diags);
 
   void setPreprocessor(Preprocessor *pp) { PP = pp; }

Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Tue Nov 23 02:35:12 2010
@@ -35,7 +35,6 @@
 class SourceManager;
 class ExternalPreprocessorSource;
 class FileManager;
-class FileSystemOptions;
 class FileEntry;
 class HeaderSearch;
 class PragmaNamespace;
@@ -58,7 +57,6 @@
   LangOptions        Features;
   const TargetInfo  &Target;
   FileManager       &FileMgr;
-  const FileSystemOptions &FileSystemOpts;
   SourceManager     &SourceMgr;
   ScratchBuffer     *ScratchBuf;
   HeaderSearch      &HeaderInfo;
@@ -281,7 +279,6 @@
   const LangOptions &getLangOptions() const { return Features; }
   const TargetInfo &getTargetInfo() const { return Target; }
   FileManager &getFileManager() const { return FileMgr; }
-  const FileSystemOptions &getFileSystemOpts() const { return FileSystemOpts; }
   SourceManager &getSourceManager() const { return SourceMgr; }
   HeaderSearch &getHeaderSearchInfo() const { return HeaderInfo; }
 

Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Tue Nov 23 02:35:12 2010
@@ -67,7 +67,6 @@
 class ASTStmtReader;
 class ASTIdentifierLookupTrait;
 class TypeLocReader;
-class FileSystemOptions;
 struct HeaderFileInfo;
 
 struct PCHPredefinesBlock {
@@ -194,7 +193,6 @@
 
   SourceManager &SourceMgr;
   FileManager &FileMgr;
-  const FileSystemOptions &FileSystemOpts;
   Diagnostic &Diags;
 
   /// \brief The semantic analysis object that will be processing the
@@ -808,7 +806,6 @@
   /// of its regular consistency checking, allowing the use of precompiled
   /// headers that cannot be determined to be compatible.
   ASTReader(SourceManager &SourceMgr, FileManager &FileMgr,
-            const FileSystemOptions &FileSystemOpts,
             Diagnostic &Diags, const char *isysroot = 0,
             bool DisableValidation = false);
   ~ASTReader();
@@ -841,7 +838,6 @@
   /// the AST file, without actually loading the AST file.
   static std::string getOriginalSourceFile(const std::string &ASTFileName,
                                            FileManager &FileMgr,
-                                           const FileSystemOptions &FSOpts,
                                            Diagnostic &Diags);
 
   /// \brief Returns the suggested contents of the predefines buffer,

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Tue Nov 23 02:35:12 2010
@@ -3015,12 +3015,9 @@
 }
 
 ASTImporter::ASTImporter(ASTContext &ToContext, FileManager &ToFileManager,
-                         const FileSystemOptions &ToFileSystemOpts,
-                         ASTContext &FromContext, FileManager &FromFileManager,
-                         const FileSystemOptions &FromFileSystemOpts)
+                         ASTContext &FromContext, FileManager &FromFileManager)
   : ToContext(ToContext), FromContext(FromContext),
-    ToFileManager(ToFileManager), FromFileManager(FromFileManager),
-    ToFileSystemOpts(ToFileSystemOpts), FromFileSystemOpts(FromFileSystemOpts) {
+    ToFileManager(ToFileManager), FromFileManager(FromFileManager) {
   ImportedDecls[FromContext.getTranslationUnitDecl()]
     = ToContext.getTranslationUnitDecl();
 }
@@ -3190,8 +3187,7 @@
     // disk again
     // FIXME: We definitely want to re-use the existing MemoryBuffer, rather
     // than mmap the files several times.
-    const FileEntry *Entry = ToFileManager.getFile(Cache->Entry->getName(),
-                                                   ToFileSystemOpts);
+    const FileEntry *Entry = ToFileManager.getFile(Cache->Entry->getName());
     ToID = ToSM.createFileID(Entry, ToIncludeLoc, 
                              FromSLoc.getFile().getFileCharacteristic());
   } else {

Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Tue Nov 23 02:35:12 2010
@@ -199,8 +199,7 @@
 
 /// \brief Retrieve the directory that the given file name resides in.
 static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr,
-                                                  llvm::StringRef Filename,
-                                      const FileSystemOptions &FileSystemOpts) {
+                                                  llvm::StringRef Filename) {
   // Figure out what directory it is in.   If the string contains a / in it,
   // strip off everything after it.
   // FIXME: this logic should be in sys::Path.
@@ -210,7 +209,7 @@
 
   // Use the current directory if file has no path component.
   if (SlashPos == 0)
-    return FileMgr.getDirectory(".", FileSystemOpts);
+    return FileMgr.getDirectory(".");
 
   if (SlashPos == Filename.size()-1)
     return 0;       // If filename ends with a /, it's a directory.
@@ -219,14 +218,13 @@
   while (SlashPos != 0 && IS_DIR_SEPARATOR_CHAR(Filename[SlashPos-1]))
     --SlashPos;
 
-  return FileMgr.getDirectory(Filename.substr(0, SlashPos), FileSystemOpts);
+  return FileMgr.getDirectory(Filename.substr(0, SlashPos));
 }
 
 /// getDirectory - Lookup, cache, and verify the specified directory.  This
 /// returns null if the directory doesn't exist.
 ///
-const DirectoryEntry *FileManager::getDirectory(llvm::StringRef Filename,
-                                      const FileSystemOptions &FileSystemOpts) {
+const DirectoryEntry *FileManager::getDirectory(llvm::StringRef Filename) {
   // stat doesn't like trailing separators (at least on Windows).
   if (Filename.size() > 1 && IS_DIR_SEPARATOR_CHAR(Filename.back()))
     Filename = Filename.substr(0, Filename.size()-1);
@@ -276,8 +274,7 @@
 /// getFile - Lookup, cache, and verify the specified file.  This returns null
 /// if the file doesn't exist.
 ///
-const FileEntry *FileManager::getFile(llvm::StringRef Filename,
-                                      const FileSystemOptions &FileSystemOpts) {
+const FileEntry *FileManager::getFile(llvm::StringRef Filename) {
   ++NumFileLookups;
 
   // See if there is already an entry in the map.
@@ -299,8 +296,7 @@
   // FileEntries map.
   const char *InterndFileName = NamedFileEnt.getKeyData();
 
-  const DirectoryEntry *DirInfo
-    = getDirectoryFromFile(*this, Filename, FileSystemOpts);
+  const DirectoryEntry *DirInfo = getDirectoryFromFile(*this, Filename);
   if (DirInfo == 0)  // Directory doesn't exist, file can't exist.
     return 0;
 
@@ -339,8 +335,7 @@
 
 const FileEntry *
 FileManager::getVirtualFile(llvm::StringRef Filename, off_t Size,
-                            time_t ModificationTime,
-                            const FileSystemOptions &FileSystemOpts) {
+                            time_t ModificationTime) {
   ++NumFileLookups;
 
   // See if there is already an entry in the map.
@@ -357,8 +352,7 @@
   // By default, initialize it to invalid.
   NamedFileEnt.setValue(NON_EXISTENT_FILE);
 
-  const DirectoryEntry *DirInfo
-    = getDirectoryFromFile(*this, Filename, FileSystemOpts);
+  const DirectoryEntry *DirInfo = getDirectoryFromFile(*this, Filename);
   if (DirInfo == 0)  // Directory doesn't exist, file can't exist.
     return 0;
 
@@ -399,7 +393,6 @@
 
 llvm::MemoryBuffer *FileManager::
 getBufferForFile(llvm::StringRef Filename,
-                 const FileSystemOptions &FileSystemOpts,
                  std::string *ErrorStr, int64_t FileSize) {
   if (FileSystemOpts.WorkingDir.empty())
     return llvm::MemoryBuffer::getFile(Filename, ErrorStr, FileSize);

Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Tue Nov 23 02:35:12 2010
@@ -73,9 +73,7 @@
   // Lazily create the Buffer for ContentCaches that wrap files.
   if (!Buffer.getPointer() && Entry) {
     std::string ErrorStr;
-    Buffer.setPointer(SM.getFileManager().getBufferForFile(Entry,
-                                                         SM.getFileSystemOpts(),
-                                                         &ErrorStr));
+    Buffer.setPointer(SM.getFileManager().getBufferForFile(Entry, &ErrorStr));
 
     // If we were unable to open the file, then we are in an inconsistent
     // situation where the content cache referenced a file which no longer
@@ -332,9 +330,8 @@
 // Private 'Create' methods.
 //===----------------------------------------------------------------------===//
 
-SourceManager::SourceManager(Diagnostic &Diag, FileManager &FileMgr,
-                             const FileSystemOptions &FSOpts)
-  : Diag(Diag), FileMgr(FileMgr), FileSystemOpts(FSOpts),
+SourceManager::SourceManager(Diagnostic &Diag, FileManager &FileMgr)
+  : Diag(Diag), FileMgr(FileMgr),
     ExternalSLocEntries(0), LineTable(0), NumLinearScans(0),
     NumBinaryProbes(0) {
   clearIDTables();

Modified: cfe/trunk/lib/Frontend/ASTMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTMerge.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTMerge.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTMerge.cpp Tue Nov 23 02:35:12 2010
@@ -51,10 +51,8 @@
 
     ASTImporter Importer(CI.getASTContext(), 
                          CI.getFileManager(),
-                         CI.getFileSystemOpts(),
                          Unit->getASTContext(), 
-                         Unit->getFileManager(),
-                         Unit->getFileSystemOpts());
+                         Unit->getFileManager());
 
     TranslationUnitDecl *TU = Unit->getASTContext().getTranslationUnitDecl();
     for (DeclContext::decl_iterator D = TU->decls_begin(), 

Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Tue Nov 23 02:35:12 2010
@@ -458,8 +458,8 @@
 llvm::MemoryBuffer *ASTUnit::getBufferForFile(llvm::StringRef Filename,
                                               std::string *ErrorStr,
                                               int64_t FileSize) {
-  return FileMgr->getBufferForFile(Filename, FileSystemOpts,
-                                   ErrorStr, FileSize);
+  assert(FileMgr);
+  return FileMgr->getBufferForFile(Filename, ErrorStr, FileSize);
 }
 
 /// \brief Configure the diagnostics object for use with ASTUnit.
@@ -491,21 +491,17 @@
   AST->OnlyLocalDecls = OnlyLocalDecls;
   AST->CaptureDiagnostics = CaptureDiagnostics;
   AST->Diagnostics = Diags;
-  AST->FileSystemOpts = FileSystemOpts;
   AST->FileMgr.reset(new FileManager(FileSystemOpts));
   AST->SourceMgr.reset(new SourceManager(AST->getDiagnostics(),
-                                         AST->getFileManager(),
-                                         AST->getFileSystemOpts()));
-  AST->HeaderInfo.reset(new HeaderSearch(AST->getFileManager(),
-                                         AST->getFileSystemOpts()));
+                                         AST->getFileManager()));
+  AST->HeaderInfo.reset(new HeaderSearch(AST->getFileManager()));
   
   for (unsigned I = 0; I != NumRemappedFiles; ++I) {
     // Create the file entry for the file that we're mapping from.
     const FileEntry *FromFile
       = AST->getFileManager().getVirtualFile(RemappedFiles[I].first,
                                     RemappedFiles[I].second->getBufferSize(),
-                                             0,
-                                             AST->getFileSystemOpts());
+                                             0);
     if (!FromFile) {
       AST->getDiagnostics().Report(diag::err_fe_remap_missing_from_file)
         << RemappedFiles[I].first;
@@ -530,7 +526,7 @@
   llvm::OwningPtr<ASTReader> Reader;
 
   Reader.reset(new ASTReader(AST->getSourceManager(), AST->getFileManager(),
-                             AST->getFileSystemOpts(), AST->getDiagnostics()));
+                             AST->getDiagnostics()));
   Reader->setListener(new ASTInfoCollector(LangInfo, HeaderInfo, TargetTriple,
                                            Predefines, Counter));
 
@@ -753,9 +749,9 @@
 
   // Configure the various subsystems.
   // FIXME: Should we retain the previous file manager?
-  FileMgr.reset(new FileManager(Clang.getFileSystemOpts()));
   FileSystemOpts = Clang.getFileSystemOpts();
-  SourceMgr.reset(new SourceManager(getDiagnostics(), *FileMgr, FileSystemOpts));
+  FileMgr.reset(new FileManager(Clang.getFileSystemOpts()));
+  SourceMgr.reset(new SourceManager(getDiagnostics(), *FileMgr));
   TheSema.reset();
   Ctx.reset();
   PP.reset();
@@ -899,8 +895,7 @@
 ASTUnit::ComputePreamble(CompilerInvocation &Invocation, 
                          unsigned MaxLines, bool &CreatedBuffer) {
   FrontendOptions &FrontendOpts = Invocation.getFrontendOpts();
-  PreprocessorOptions &PreprocessorOpts
-    = Invocation.getPreprocessorOpts();
+  PreprocessorOptions &PreprocessorOpts = Invocation.getPreprocessorOpts();
   CreatedBuffer = false;
   
   // Try to determine if the main file has been remapped, either from the 
@@ -1249,8 +1244,7 @@
   
   // Create the source manager.
   Clang.setSourceManager(new SourceManager(getDiagnostics(),
-                                           Clang.getFileManager(),
-                                           Clang.getFileSystemOpts()));
+                                           Clang.getFileManager()));
   
   llvm::OwningPtr<PrecompilePreambleAction> Act;
   Act.reset(new PrecompilePreambleAction(*this));
@@ -1477,6 +1471,8 @@
   AST.reset(new ASTUnit(false));
   ConfigureDiags(Diags, *AST, CaptureDiagnostics);
   AST->Diagnostics = Diags;
+  
+  AST->FileMgr.reset(new FileManager(FileSystemOptions()));
   AST->OnlyLocalDecls = OnlyLocalDecls;
   AST->CaptureDiagnostics = CaptureDiagnostics;
   AST->CompleteTranslationUnit = CompleteTranslationUnit;
@@ -1486,7 +1482,7 @@
   AST->NumStoredDiagnosticsInPreamble = StoredDiagnostics.size();
   AST->StoredDiagnostics.swap(StoredDiagnostics);
   AST->Invocation.reset(CI.take());
-  return AST->LoadFromCompilerInvocation(PrecompilePreamble)? 0 : AST.take();
+  return AST->LoadFromCompilerInvocation(PrecompilePreamble) ? 0 : AST.take();
 }
 
 bool ASTUnit::Reparse(RemappedFile *RemappedFiles, unsigned NumRemappedFiles) {

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Tue Nov 23 02:35:12 2010
@@ -153,9 +153,8 @@
 
 // Source Manager
 
-void CompilerInstance::createSourceManager(FileManager &FileMgr,
-                                           const FileSystemOptions &FSOpts) {
-  SourceMgr.reset(new SourceManager(getDiagnostics(), FileMgr, FSOpts));
+void CompilerInstance::createSourceManager(FileManager &FileMgr) {
+  SourceMgr.reset(new SourceManager(getDiagnostics(), FileMgr));
 }
 
 // Preprocessor
@@ -164,8 +163,8 @@
   PP.reset(createPreprocessor(getDiagnostics(), getLangOpts(),
                               getPreprocessorOpts(), getHeaderSearchOpts(),
                               getDependencyOutputOpts(), getTarget(),
-                              getFrontendOpts(), getFileSystemOpts(),
-                              getSourceManager(), getFileManager()));
+                              getFrontendOpts(), getSourceManager(),
+                              getFileManager()));
 }
 
 Preprocessor *
@@ -176,16 +175,15 @@
                                      const DependencyOutputOptions &DepOpts,
                                      const TargetInfo &Target,
                                      const FrontendOptions &FEOpts,
-                                     const FileSystemOptions &FSOpts,
                                      SourceManager &SourceMgr,
                                      FileManager &FileMgr) {
   // Create a PTH manager if we are using some form of a token cache.
   PTHManager *PTHMgr = 0;
   if (!PPOpts.TokenCache.empty())
-    PTHMgr = PTHManager::Create(PPOpts.TokenCache, FileMgr, FSOpts, Diags);
+    PTHMgr = PTHManager::Create(PPOpts.TokenCache, FileMgr, Diags);
 
   // Create the Preprocessor.
-  HeaderSearch *HeaderInfo = new HeaderSearch(FileMgr, FSOpts);
+  HeaderSearch *HeaderInfo = new HeaderSearch(FileMgr);
   Preprocessor *PP = new Preprocessor(Diags, LangInfo, Target,
                                       SourceMgr, *HeaderInfo, PTHMgr,
                                       /*OwnsHeaderSearch=*/true);
@@ -201,7 +199,7 @@
   if (PPOpts.DetailedRecord)
     PP->createPreprocessingRecord();
   
-  InitializePreprocessor(*PP, FSOpts, PPOpts, HSOpts, FEOpts);
+  InitializePreprocessor(*PP, PPOpts, HSOpts, FEOpts);
 
   // Handle generating dependencies, if requested.
   if (!DepOpts.OutputFile.empty())
@@ -278,8 +276,7 @@
                                  unsigned Column) {
   // Tell the source manager to chop off the given file at a specific
   // line and column.
-  const FileEntry *Entry = PP.getFileManager().getFile(Filename,
-                                                       PP.getFileSystemOpts());
+  const FileEntry *Entry = PP.getFileManager().getFile(Filename);
   if (!Entry) {
     PP.getDiagnostics().Report(diag::err_fe_invalid_code_complete_file)
       << Filename;
@@ -469,19 +466,17 @@
 
 bool CompilerInstance::InitializeSourceManager(llvm::StringRef InputFile) {
   return InitializeSourceManager(InputFile, getDiagnostics(), getFileManager(),
-                                 getFileSystemOpts(),
                                  getSourceManager(), getFrontendOpts());
 }
 
 bool CompilerInstance::InitializeSourceManager(llvm::StringRef InputFile,
                                                Diagnostic &Diags,
                                                FileManager &FileMgr,
-                                               const FileSystemOptions &FSOpts,
                                                SourceManager &SourceMgr,
                                                const FrontendOptions &Opts) {
   // Figure out where to get and map in the main file.
   if (InputFile != "-") {
-    const FileEntry *File = FileMgr.getFile(InputFile, FSOpts);
+    const FileEntry *File = FileMgr.getFile(InputFile);
     if (!File) {
       Diags.Report(diag::err_fe_error_reading) << InputFile;
       return false;
@@ -494,8 +489,7 @@
       return false;
     }
     const FileEntry *File = FileMgr.getVirtualFile(SB->getBufferIdentifier(),
-                                                   SB->getBufferSize(), 0,
-                                                   FSOpts);
+                                                   SB->getBufferSize(), 0);
     SourceMgr.createMainFileID(File);
     SourceMgr.overrideFileContents(File, SB);
   }

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Nov 23 02:35:12 2010
@@ -1419,7 +1419,6 @@
 
 static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
                                   FileManager &FileMgr,
-                                  const FileSystemOptions &FSOpts,
                                   Diagnostic &Diags) {
   using namespace cc1options;
   Opts.ImplicitPCHInclude = Args.getLastArgValue(OPT_include_pch);
@@ -1474,8 +1473,7 @@
     // PCH is handled specially, we need to extra the original include path.
     if (A->getOption().matches(OPT_include_pch)) {
       std::string OriginalFile =
-        ASTReader::getOriginalSourceFile(A->getValue(Args), FileMgr, FSOpts,
-                                         Diags);
+        ASTReader::getOriginalSourceFile(A->getValue(Args), FileMgr, Diags);
       if (OriginalFile.empty())
         continue;
 
@@ -1531,8 +1529,8 @@
 //
 
 void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
-                                        const char* const *ArgBegin,
-                                        const char* const *ArgEnd,
+                                        const char *const *ArgBegin,
+                                        const char *const *ArgEnd,
                                         Diagnostic &Diags) {
   // Parse the arguments.
   llvm::OwningPtr<OptTable> Opts(createCC1OptTable());
@@ -1561,11 +1559,10 @@
     ParseLangArgs(Res.getLangOpts(), *Args, DashX, Diags);
   // FIXME: ParsePreprocessorArgs uses the FileManager to read the contents of
   // PCH file and find the original header name. Remove the need to do that in
-  // ParsePreprocessorArgs and remove the FileManager & FileSystemOptions
+  // ParsePreprocessorArgs and remove the FileManager 
   // parameters from the function and the "FileManager.h" #include.
   FileManager FileMgr(Res.getFileSystemOpts());
-  ParsePreprocessorArgs(Res.getPreprocessorOpts(), *Args,
-                        FileMgr, Res.getFileSystemOpts(), Diags);
+  ParsePreprocessorArgs(Res.getPreprocessorOpts(), *Args, FileMgr, Diags);
   ParsePreprocessorOutputArgs(Res.getPreprocessorOutputOpts(), *Args);
   ParseTargetArgs(Res.getTargetOpts(), *Args);
 }

Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Tue Nov 23 02:35:12 2010
@@ -133,7 +133,7 @@
   if (!CI.hasFileManager())
     CI.createFileManager();
   if (!CI.hasSourceManager())
-    CI.createSourceManager(CI.getFileManager(), CI.getFileSystemOpts());
+    CI.createSourceManager(CI.getFileManager());
 
   // IR files bypass the rest of initialization.
   if (InputKind == IK_LLVM_IR) {

Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Tue Nov 23 02:35:12 2010
@@ -209,8 +209,7 @@
   
   CompilerInstance &CI = getCompilerInstance();
   llvm::MemoryBuffer *Buffer
-      = CI.getFileManager().getBufferForFile(getCurrentFile(),
-                                             CI.getFileSystemOpts());
+      = CI.getFileManager().getBufferForFile(getCurrentFile());
   if (Buffer) {
     unsigned Preamble = Lexer::ComputePreamble(Buffer).first;
     llvm::outs().write(Buffer->getBufferStart(), Preamble);

Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
+++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Tue Nov 23 02:35:12 2010
@@ -102,7 +102,6 @@
                                bool IgnoreSysRoot) {
   assert(!Path.isTriviallyEmpty() && "can't handle empty path here");
   FileManager &FM = Headers.getFileMgr();
-  const FileSystemOptions &FSOpts = Headers.getFileSystemOpts();
 
   // Compute the actual path, taking into consideration -isysroot.
   llvm::SmallString<256> MappedPathStorage;
@@ -129,7 +128,7 @@
 
 
   // If the directory exists, add it.
-  if (const DirectoryEntry *DE = FM.getDirectory(MappedPathStr, FSOpts)) {
+  if (const DirectoryEntry *DE = FM.getDirectory(MappedPathStr)) {
     IncludeGroup[Group].push_back(DirectoryLookup(DE, Type, isUserSupplied,
                                                   isFramework));
     return;
@@ -138,7 +137,7 @@
   // Check to see if this is an apple-style headermap (which are not allowed to
   // be frameworks).
   if (!isFramework) {
-    if (const FileEntry *FE = FM.getFile(MappedPathStr, FSOpts)) {
+    if (const FileEntry *FE = FM.getFile(MappedPathStr)) {
       if (const HeaderMap *HM = Headers.CreateHeaderMap(FE)) {
         // It is a headermap, add it to the search path.
         IncludeGroup[Group].push_back(DirectoryLookup(HM, Type,isUserSupplied));

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Tue Nov 23 02:35:12 2010
@@ -478,7 +478,6 @@
 static void InitializeFileRemapping(Diagnostic &Diags,
                                     SourceManager &SourceMgr,
                                     FileManager &FileMgr,
-                                    const FileSystemOptions &FSOpts,
                                     const PreprocessorOptions &InitOpts) {
   // Remap files in the source manager (with buffers).
   for (PreprocessorOptions::const_remapped_file_buffer_iterator
@@ -489,7 +488,7 @@
     // Create the file entry for the file that we're mapping from.
     const FileEntry *FromFile = FileMgr.getVirtualFile(Remap->first,
                                                 Remap->second->getBufferSize(),
-                                                       0, FSOpts);
+                                                       0);
     if (!FromFile) {
       Diags.Report(diag::err_fe_remap_missing_from_file)
         << Remap->first;
@@ -511,7 +510,7 @@
        Remap != RemapEnd;
        ++Remap) {
     // Find the file that we're mapping to.
-    const FileEntry *ToFile = FileMgr.getFile(Remap->second, FSOpts);
+    const FileEntry *ToFile = FileMgr.getFile(Remap->second);
     if (!ToFile) {
       Diags.Report(diag::err_fe_remap_missing_to_file)
       << Remap->first << Remap->second;
@@ -520,8 +519,7 @@
     
     // Create the file entry for the file that we're mapping from.
     const FileEntry *FromFile = FileMgr.getVirtualFile(Remap->first,
-                                                       ToFile->getSize(),
-                                                       0, FSOpts);
+                                                       ToFile->getSize(), 0);
     if (!FromFile) {
       Diags.Report(diag::err_fe_remap_missing_from_file)
       << Remap->first;
@@ -531,7 +529,7 @@
     // Load the contents of the file we're mapping to.
     std::string ErrorStr;
     const llvm::MemoryBuffer *Buffer
-    = FileMgr.getBufferForFile(ToFile->getName(), FSOpts, &ErrorStr);
+      = FileMgr.getBufferForFile(ToFile->getName(), &ErrorStr);
     if (!Buffer) {
       Diags.Report(diag::err_fe_error_opening)
         << Remap->second << ErrorStr;
@@ -548,7 +546,6 @@
 /// environment ready to process a single file. This returns true on error.
 ///
 void clang::InitializePreprocessor(Preprocessor &PP,
-                                   const FileSystemOptions &FSOpts,
                                    const PreprocessorOptions &InitOpts,
                                    const HeaderSearchOptions &HSOpts,
                                    const FrontendOptions &FEOpts) {
@@ -558,7 +555,7 @@
   MacroBuilder Builder(Predefines);
 
   InitializeFileRemapping(PP.getDiagnostics(), PP.getSourceManager(),
-                          PP.getFileManager(), FSOpts, InitOpts);
+                          PP.getFileManager(), InitOpts);
 
   // Emit line markers for various builtin sections of the file.  We don't do
   // this in asm preprocessor mode, because "# 4" is not a line marker directive

Modified: cfe/trunk/lib/Lex/HeaderMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderMap.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderMap.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderMap.cpp Tue Nov 23 02:35:12 2010
@@ -75,14 +75,12 @@
 /// map.  If it doesn't look like a HeaderMap, it gives up and returns null.
 /// If it looks like a HeaderMap but is obviously corrupted, it puts a reason
 /// into the string error argument and returns null.
-const HeaderMap *HeaderMap::Create(const FileEntry *FE, FileManager &FM,
-                                   const FileSystemOptions &FSOpts) {
+const HeaderMap *HeaderMap::Create(const FileEntry *FE, FileManager &FM) {
   // If the file is too small to be a header map, ignore it.
   unsigned FileSize = FE->getSize();
   if (FileSize <= sizeof(HMapHeader)) return 0;
 
-  llvm::OwningPtr<const llvm::MemoryBuffer> FileBuffer(
-    FM.getBufferForFile(FE, FSOpts));
+  llvm::OwningPtr<const llvm::MemoryBuffer> FileBuffer(FM.getBufferForFile(FE));
   if (FileBuffer == 0) return 0;  // Unreadable file?
   const char *FileStart = FileBuffer->getBufferStart();
 
@@ -201,8 +199,7 @@
 /// LookupFile - Check to see if the specified relative filename is located in
 /// this HeaderMap.  If so, open it and return its FileEntry.
 const FileEntry *HeaderMap::LookupFile(llvm::StringRef Filename,
-                                       FileManager &FM,
-                                const FileSystemOptions &FileSystemOpts) const {
+                                       FileManager &FM) const {
   const HMapHeader &Hdr = getHeader();
   unsigned NumBuckets = getEndianAdjustedWord(Hdr.NumBuckets);
 
@@ -225,6 +222,6 @@
     llvm::SmallString<1024> DestPath;
     DestPath += getString(B.Prefix);
     DestPath += getString(B.Suffix);
-    return FM.getFile(DestPath.str(), FileSystemOpts);
+    return FM.getFile(DestPath.str());
   }
 }

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Tue Nov 23 02:35:12 2010
@@ -32,8 +32,8 @@
   return ControllingMacro;
 }
 
-HeaderSearch::HeaderSearch(FileManager &FM, const FileSystemOptions &FSOpts)
-    : FileMgr(FM), FileSystemOpts(FSOpts), FrameworkMap(64) {
+HeaderSearch::HeaderSearch(FileManager &FM)
+    : FileMgr(FM), FrameworkMap(64) {
   SystemDirIdx = 0;
   NoCurDirSearch = false;
 
@@ -84,7 +84,7 @@
         return HeaderMaps[i].second;
   }
 
-  if (const HeaderMap *HM = HeaderMap::Create(FE, FileMgr, FileSystemOpts)) {
+  if (const HeaderMap *HM = HeaderMap::Create(FE, FileMgr)) {
     HeaderMaps.push_back(std::make_pair(FE, HM));
     return HM;
   }
@@ -119,15 +119,14 @@
     TmpDir += getDir()->getName();
     TmpDir.push_back('/');
     TmpDir.append(Filename.begin(), Filename.end());
-    return HS.getFileMgr().getFile(TmpDir.str(), HS.getFileSystemOpts());
+    return HS.getFileMgr().getFile(TmpDir.str());
   }
 
   if (isFramework())
     return DoFrameworkLookup(Filename, HS);
 
   assert(isHeaderMap() && "Unknown directory lookup");
-  return getHeaderMap()->LookupFile(Filename, HS.getFileMgr(),
-                                    HS.getFileSystemOpts());
+  return getHeaderMap()->LookupFile(Filename, HS.getFileMgr());
 }
 
 
@@ -136,7 +135,6 @@
 const FileEntry *DirectoryLookup::DoFrameworkLookup(llvm::StringRef Filename,
                                                     HeaderSearch &HS) const {
   FileManager &FileMgr = HS.getFileMgr();
-  const FileSystemOptions &FileSystemOpts = HS.getFileSystemOpts();
 
   // Framework names must have a '/' in the filename.
   size_t SlashPos = Filename.find('/');
@@ -186,16 +184,14 @@
 
   FrameworkName += "Headers/";
   FrameworkName.append(Filename.begin()+SlashPos+1, Filename.end());
-  if (const FileEntry *FE = FileMgr.getFile(FrameworkName.str(),
-                                            FileSystemOpts)) {
+  if (const FileEntry *FE = FileMgr.getFile(FrameworkName.str()))
     return FE;
-  }
 
   // Check "/System/Library/Frameworks/Cocoa.framework/PrivateHeaders/file.h"
   const char *Private = "Private";
   FrameworkName.insert(FrameworkName.begin()+OrigSize, Private,
                        Private+strlen(Private));
-  return FileMgr.getFile(FrameworkName.str(), FileSystemOpts);
+  return FileMgr.getFile(FrameworkName.str());
 }
 
 
@@ -222,7 +218,7 @@
     if (FromDir) return 0;
 
     // Otherwise, just return the file.
-    return FileMgr.getFile(Filename, FileSystemOpts);
+    return FileMgr.getFile(Filename);
   }
 
   // Step #0, unless disabled, check to see if the file is in the #includer's
@@ -237,7 +233,7 @@
     TmpDir += CurFileEnt->getDir()->getName();
     TmpDir.push_back('/');
     TmpDir.append(Filename.begin(), Filename.end());
-    if (const FileEntry *FE = FileMgr.getFile(TmpDir.str(), FileSystemOpts)) {
+    if (const FileEntry *FE = FileMgr.getFile(TmpDir.str())) {
       // Leave CurDir unset.
       // This file is a system header or C++ unfriendly if the old file is.
       //
@@ -346,8 +342,7 @@
     ++NumSubFrameworkLookups;
 
     // If the framework dir doesn't exist, we fail.
-    const DirectoryEntry *Dir = FileMgr.getDirectory(FrameworkName.str(),
-                                                     FileSystemOpts);
+    const DirectoryEntry *Dir = FileMgr.getDirectory(FrameworkName.str());
     if (Dir == 0) return 0;
 
     // Otherwise, if it does, remember that this is the right direntry for this
@@ -361,13 +356,13 @@
   llvm::SmallString<1024> HeadersFilename(FrameworkName);
   HeadersFilename += "Headers/";
   HeadersFilename.append(Filename.begin()+SlashPos+1, Filename.end());
-  if (!(FE = FileMgr.getFile(HeadersFilename.str(), FileSystemOpts))) {
+  if (!(FE = FileMgr.getFile(HeadersFilename.str()))) {
 
     // Check ".../Frameworks/HIToolbox.framework/PrivateHeaders/HIToolbox.h"
     HeadersFilename = FrameworkName;
     HeadersFilename += "PrivateHeaders/";
     HeadersFilename.append(Filename.begin()+SlashPos+1, Filename.end());
-    if (!(FE = FileMgr.getFile(HeadersFilename.str(), FileSystemOpts)))
+    if (!(FE = FileMgr.getFile(HeadersFilename.str())))
       return 0;
   }
 

Modified: cfe/trunk/lib/Lex/PTHLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PTHLexer.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PTHLexer.cpp (original)
+++ cfe/trunk/lib/Lex/PTHLexer.cpp Tue Nov 23 02:35:12 2010
@@ -435,11 +435,9 @@
 }
 
 PTHManager *PTHManager::Create(const std::string &file, FileManager &FileMgr,
-                               const FileSystemOptions &FSOpts,
                                Diagnostic &Diags) {
   // Memory map the PTH file.
-  llvm::OwningPtr<llvm::MemoryBuffer>
-  File(FileMgr.getBufferForFile(file, FSOpts));
+  llvm::OwningPtr<llvm::MemoryBuffer> File(FileMgr.getBufferForFile(file));
 
   if (!File) {
     Diags.Report(diag::err_invalid_pth_file) << file;

Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Tue Nov 23 02:35:12 2010
@@ -53,7 +53,7 @@
                            IdentifierInfoLookup* IILookup,
                            bool OwnsHeaders)
   : Diags(&diags), Features(opts), Target(target),FileMgr(Headers.getFileMgr()),
-    FileSystemOpts(Headers.getFileSystemOpts()), SourceMgr(SM),
+    SourceMgr(SM),
     HeaderInfo(Headers), ExternalSource(0),
     Identifiers(opts, IILookup), BuiltinInfo(Target), CodeComplete(0),
     CodeCompletionFile(0), SkipMainFilePreamble(0, true), CurPPLexer(0), 

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Tue Nov 23 02:35:12 2010
@@ -1234,7 +1234,7 @@
   case SM_SLOC_FILE_ENTRY: {
     std::string Filename(BlobStart, BlobStart + BlobLen);
     MaybeAddSystemRootToFilename(Filename);
-    const FileEntry *File = FileMgr.getFile(Filename, FileSystemOpts);
+    const FileEntry *File = FileMgr.getFile(Filename);
     if (File == 0) {
       std::string ErrorStr = "could not find file '";
       ErrorStr += Filename;
@@ -1549,8 +1549,7 @@
       const char *FullFileNameStart = BlobStart + Record[3];
       const FileEntry *File
       = PP->getFileManager().getFile(llvm::StringRef(FullFileNameStart,
-                                                     BlobLen - Record[3]),
-                                     FileSystemOpts);
+                                                     BlobLen - Record[3]));
 
       // FIXME: Stable encoding
       InclusionDirective::InclusionKind Kind
@@ -2273,7 +2272,7 @@
   if (FileName == "-")
     F.Buffer.reset(llvm::MemoryBuffer::getSTDIN(&ErrStr));
   else
-    F.Buffer.reset(FileMgr.getBufferForFile(FileName, FileSystemOpts, &ErrStr));
+    F.Buffer.reset(FileMgr.getBufferForFile(FileName, &ErrStr));
   if (!F.Buffer) {
     Error(ErrStr.c_str());
     return IgnorePCH;
@@ -2478,12 +2477,11 @@
 /// file.
 std::string ASTReader::getOriginalSourceFile(const std::string &ASTFileName,
                                              FileManager &FileMgr,
-                                             const FileSystemOptions &FSOpts,
                                              Diagnostic &Diags) {
   // Open the AST file.
   std::string ErrStr;
   llvm::OwningPtr<llvm::MemoryBuffer> Buffer;
-  Buffer.reset(FileMgr.getBufferForFile(ASTFileName, FSOpts, &ErrStr));
+  Buffer.reset(FileMgr.getBufferForFile(ASTFileName, &ErrStr));
   if (!Buffer) {
     Diags.Report(diag::err_fe_unable_to_read_pch_file) << ErrStr;
     return std::string();
@@ -4503,7 +4501,6 @@
                      const char *isysroot, bool DisableValidation)
   : Listener(new PCHValidator(PP, *this)), DeserializationListener(0),
     SourceMgr(PP.getSourceManager()), FileMgr(PP.getFileManager()),
-    FileSystemOpts(PP.getFileSystemOpts()),
     Diags(PP.getDiagnostics()), SemaObj(0), PP(&PP), Context(Context),
     Consumer(0), isysroot(isysroot), DisableValidation(DisableValidation),
     NumStatHits(0), NumStatMisses(0), NumSLocEntriesRead(0),
@@ -4517,11 +4514,9 @@
 }
 
 ASTReader::ASTReader(SourceManager &SourceMgr, FileManager &FileMgr,
-                     const FileSystemOptions &FileSystemOpts,
                      Diagnostic &Diags, const char *isysroot,
                      bool DisableValidation)
   : DeserializationListener(0), SourceMgr(SourceMgr), FileMgr(FileMgr),
-    FileSystemOpts(FileSystemOpts),
     Diags(Diags), SemaObj(0), PP(0), Context(0), Consumer(0),
     isysroot(isysroot), DisableValidation(DisableValidation), NumStatHits(0),
     NumStatMisses(0), NumSLocEntriesRead(0), TotalNumSLocEntries(0),

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Tue Nov 23 02:35:12 2010
@@ -2584,8 +2584,7 @@
   ASTUnit *CXXUnit = static_cast<ASTUnit *>(tu->TUData);
 
   FileManager &FMgr = CXXUnit->getFileManager();
-  const FileEntry *File = FMgr.getFile(file_name, CXXUnit->getFileSystemOpts());
-  return const_cast<FileEntry *>(File);
+  return const_cast<FileEntry *>(FMgr.getFile(file_name));
 }
 
 } // end: extern "C"

Modified: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp?rev=120010&r1=120009&r2=120010&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp Tue Nov 23 02:35:12 2010
@@ -234,12 +234,12 @@
   
   /// \brief Language options used to adjust source locations.
   LangOptions LangOpts;
-  
-  /// \brief File manager, used for diagnostics.
-  FileManager FileMgr;
 
   FileSystemOptions FileSystemOpts;
 
+  /// \brief File manager, used for diagnostics.
+  FileManager FileMgr;
+
   /// \brief Source manager, used for diagnostics.
   SourceManager SourceMgr;
   
@@ -263,7 +263,7 @@
     Diag(new Diagnostic(
                    llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs))),
     FileMgr(FileSystemOpts),
-    SourceMgr(*Diag, FileMgr, FileSystemOpts) { 
+    SourceMgr(*Diag, FileMgr) { 
   if (getenv("LIBCLANG_OBJTRACKING")) {
     ++CodeCompletionResultObjects;
     fprintf(stderr, "+++ %d completion results\n", CodeCompletionResultObjects);





More information about the cfe-commits mailing list