[cfe-commits] r127890 - in /cfe/trunk: lib/Frontend/ASTUnit.cpp tools/libclang/CIndexCodeCompletion.cpp

Anders Carlsson andersca at mac.com
Fri Mar 18 11:22:40 PDT 2011


Author: andersca
Date: Fri Mar 18 13:22:40 2011
New Revision: 127890

URL: http://llvm.org/viewvc/llvm-project?rev=127890&view=rev
Log:
Correctly store and keep track of the FileSystemOptions in ASTUnit and in clang_codeCompleteAt.

Modified:
    cfe/trunk/lib/Frontend/ASTUnit.cpp
    cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp

Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=127890&r1=127889&r2=127890&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Fri Mar 18 13:22:40 2011
@@ -881,7 +881,7 @@
   // Configure the various subsystems.
   // FIXME: Should we retain the previous file manager?
   FileSystemOpts = Clang.getFileSystemOpts();
-  FileMgr.reset(new FileManager(Clang.getFileSystemOpts()));
+  FileMgr.reset(new FileManager(FileSystemOpts));
   SourceMgr.reset(new SourceManager(getDiagnostics(), *FileMgr));
   TheSema.reset();
   Ctx.reset();
@@ -1537,7 +1537,8 @@
   ConfigureDiags(Diags, 0, 0, *AST, /*CaptureDiagnostics=*/false);
   AST->Diagnostics = Diags;
   AST->Invocation.reset(CI);
-  AST->FileMgr.reset(new FileManager(CI->getFileSystemOpts()));
+  AST->FileSystemOpts = CI->getFileSystemOpts();
+  AST->FileMgr.reset(new FileManager(AST->FileSystemOpts));
   AST->SourceMgr.reset(new SourceManager(*Diags, *AST->FileMgr));
 
   return AST.take();
@@ -1706,8 +1707,9 @@
   AST.reset(new ASTUnit(false));
   ConfigureDiags(Diags, ArgBegin, ArgEnd, *AST, CaptureDiagnostics);
   AST->Diagnostics = Diags;
-  
-  AST->FileMgr.reset(new FileManager(FileSystemOptions()));
+
+  AST->FileSystemOpts = CI->getFileSystemOpts();
+  AST->FileMgr.reset(new FileManager(AST->FileSystemOpts));
   AST->OnlyLocalDecls = OnlyLocalDecls;
   AST->CaptureDiagnostics = CaptureDiagnostics;
   AST->CompleteTranslationUnit = CompleteTranslationUnit;

Modified: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp?rev=127890&r1=127889&r2=127890&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp Fri Mar 18 13:22:40 2011
@@ -201,7 +201,7 @@
 /// \brief The CXCodeCompleteResults structure we allocate internally;
 /// the client only sees the initial CXCodeCompleteResults structure.
 struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults {
-  AllocatedCXCodeCompleteResults();
+  AllocatedCXCodeCompleteResults(const FileSystemOptions& FileSystemOpts);
   ~AllocatedCXCodeCompleteResults();
   
   /// \brief Diagnostics produced while performing code completion.
@@ -243,10 +243,12 @@
 /// Used for debugging purposes only.
 static llvm::sys::cas_flag CodeCompletionResultObjects;
   
-AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults() 
+AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults(
+                                      const FileSystemOptions& FileSystemOpts)
   : CXCodeCompleteResults(),
     Diag(new Diagnostic(
                    llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs))),
+    FileSystemOpts(FileSystemOpts),
     FileMgr(FileSystemOpts),
     SourceMgr(*Diag, FileMgr) { 
   if (getenv("LIBCLANG_OBJTRACKING")) {
@@ -380,7 +382,8 @@
   }
 
   // Parse the resulting source file to find code-completion results.
-  AllocatedCXCodeCompleteResults *Results = new AllocatedCXCodeCompleteResults;
+  AllocatedCXCodeCompleteResults *Results = 
+        new AllocatedCXCodeCompleteResults(AST->getFileSystemOpts());
   Results->Results = 0;
   Results->NumResults = 0;
   





More information about the cfe-commits mailing list